The Take API searches for a suitable coupon based on the entered IRIs.
If matching coupons are not found, an empty array response will be returned with a status code of 200.
You can test this API endpoint and inspect the possible responses using Swagger UI
Request
URL: https://api.takeads.com/v1/product/monetize-api/v1/coupon/search
Method: POST
Request headers
Header | Value | Description |
Authorization | Bearer | Header with a platform public key value, which is a string of alphanumeric characters with Bearer as prefix, used to authenticate and authorize your API requests.
To learn how to get your Public key, refer to the Authorization article. |
Request body
A request body must contain the required iris
parameter.
Context-Type: application/json
Property | Type | Description |
iris
(required) |
array of strings | List of links to the advertiser or product that you search a coupon for. |
languageCodes
(optional) |
array of strings | ISO 639-1 alpha-2 language code supported by the coupon merchant. |
categoryIds
(optional) |
array of integers | Coupon category identifiers. |
subId
(optional) |
string | SubID parameter that you want to add to the affiliate link.
|
Request examples
-
curl --location 'https://api.takeads.com/v1/product/monetize-api/v1/coupon/search' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer <Public Key>' \
--data '{
"iris": [
"https://aliexpress.com/item/1005003993360501.html",
"https://www.agoda.com/",
"https://xn--99zt52a.example.org/%e2%80%ae"
],
"languageCodes": [
"en"
],
"categoryIds": [
12
],
"subId": "product_page"
}' -
const myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Authorization", "Bearer <Public Key>");
const raw = JSON.stringify({
"iris": [
"https://aliexpress.com/item/1005003993360501.html",
"https://www.agoda.com/",
"https://xn--99zt52a.example.org/%e2%80%ae"
],
"languageCodes": [
"en"
],
"categoryIds": [
12
],
"subId": "product_page"
});
const requestOptions = {
method: "POST",
headers: myHeaders,
body: raw,
redirect: "follow"
};
fetch("https://api.takeads.com/v1/product/monetize-api/v1/coupon/search", requestOptions)
.then((response) => response.text())
.then((result) => console.log(result))
.catch((error) => console.error(error)); -
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://api.takeads.com/v1/product/monetize-api/v1/coupon/search',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS =>'{
"iris": [
"https://aliexpress.com/item/1005003993360501.html",
"https://www.agoda.com/",
"https://xn--99zt52a.example.org/%e2%80%ae"
],
"languageCodes": [
"en"
],
"categoryIds": [
12
],
"subId": "product_page"
}',
CURLOPT_HTTPHEADER => array(
'Content-Type: application/json',
'Authorization: Bearer <Public Key>'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response; -
import http.client
import json
conn = http.client.HTTPSConnection("api.takeads.com")
payload = json.dumps({
"iris": [
"https://aliexpress.com/item/1005003993360501.html",
"https://www.agoda.com/",
"https://xn--99zt52a.example.org/%e2%80%ae"
],
"languageCodes": [
"en"
],
"categoryIds": [
12
],
"subId": "product_page"
})
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer <Public Key>'
}
conn.request("POST", "/v1/product/monetize-api/v1/coupon/search", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
Response
If the request was successfully processed by the server, the HTTP response with a status code of 200 and a list of available coupons is returned.
The response payload is a JSON object that contains a data array. Each item of the array is an object with details of the coupon.
The following table describes the response properties.
Property | Type | Description |
iri | string | Link sent in the request. |
coupons | string | The result of affiliation of the link you requested for monetization. |
couponId | string | Coupon unique identifier. |
trackingLink | string | Affiliate link (RFC 3986). |
name | string | Coupon name. |
code | string | Coupon code. |
merchantId | integer | Merchant unique identifier. |
imageUri | string | URI to the coupon logo. |
languageCodes | string | Array of languages supported by the website in ISO 639-1 alpha-2 format. If the value is empty, the coupon languages are unknown. |
startDate | string | Date from which the coupon can be applied. |
endDate | string | Date after which the coupon will no longer apply. |
description | string | Detailed information about the coupon, including usage conditions and limitations. |
countryCodes | string | List of the country codes in ISO 3166-1 alpha-2 format where the coupon operates. |
categoryIds | integer | List of merchant category identifiers. |
createdAt | string | Date of the last update of the coupon in ISO 8601: 1988 (E) format. |
updatedAt | string | Date of the last update of the coupon in ISO 8601: 1988 (E) format. |
Example value
{
"data": [
{
"iri": "https://aliexpress.com/item/1005003993360501.html",
"coupons": [
{
"couponId": "V1StGXR8_Z5jdHi6B-myT",
"trackingLink": "https://tatrck.com/h/0Hu30w1D0KX9?url=https://aliexpress.com/item/1005003993360501.html&s=subid",
"name": "ACME",
"code": "10OFF",
"merchantId": 12345,
"imageUri": "https://sitesample.com/image.svg",
"languageCodes": [
"en",
"de"
],
"startDate": "2023-01-30T08:07:12.166Z",
"endDate": "2023-01-30T08:07:12.166Z",
"description": "string",
"countryCodes": [
"US",
"DE",
"FR"
],
"categoryIds": [
12
],
"createdAt": "2023-01-30T08:07:12.166Z",
"updatedAt": "2023-01-30T08:07:12.166Z"
}
]
}
]
}
To view possible error responses, refer to the Error responses article.