Get affiliate link

This endpoint lets you monetize links in the content of your project. Take API replaces the direct link with the affiliate link if an offer from the advertiser is found for it in Takeads catalog.

You can test this API endpoint and inspect the possible responses using Swagger UI.

Request

URL: https://api.takeads.com/v1/product/monetize-api/v2/resolve

Method: PUT

Request headers

Header Value Description
Authorization Bearer <PublicKey>

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. Optionally, you can specify a SubID for the tracking link to be received, and request a link to the advertisers' logo.

Context-Type: application/json

Property Type Description
iris
(required)
string[] List of links that you want to affiliate (IRI, RFC 3987).
subId
(optional)
string / undefined SubID parameter that you would like to add to the affiliate link.
  • Only one SubID can be sent in each request.
  • If you are sending several links in one request, the specified SubID will be added to each of them.

    SubID format:

    • does not exceed 6144 symbols
    • may include numbers 1 through 9, Latin letters, and the _ and - symbols.
withImages
(optional)
boolean / undefined If set to true, a link to the advertiser's logo will be included in the response.


Request examples

  •       curl --request PUT \ --url https://api.takeads.com/v1/product/monetize-api/v2/resolve
          \
    --header 'Authorization: Bearer <Public Key>' \ --header 'Content-Type: application/json' \ --data '{ "iris": ["https://example.com/"] } '
  •       fetch("https://api.takeads.com/v1/product/monetize-api/v2/resolve", {
    "method": "PUT",
    "headers": {
    "Content-Type": "application/json",
    "Authorization": "Bearer <Public Key>"
    },
    "body": "{\"iris\":[\"https://example.com/\"]}"
    })
    .then(response => {
    console.log(response);
    })
    .catch(err => {
    console.error(err);
    });
  • $curl = curl_init();
    curl_setopt_array($curl, [
    CURLOPT_URL => "https://api.takeads.com/v1/product/monetize-api/v2/resolve",
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_ENCODING => "",
    CURLOPT_MAXREDIRS => 10,
    CURLOPT_TIMEOUT => 30,
    CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
    CURLOPT_CUSTOMREQUEST => "PUT",
    CURLOPT_POSTFIELDS => "{\n\t\"iris\": [\n\t\t\"https://example.com/\"\n\t]\n}\n",
    CURLOPT_HTTPHEADER => [
    "Authorization: Bearer <Public Key>",
    "Content-Type: application/json"
    ],
    ]);
    $response = curl_exec($curl);
    $err = curl_error($curl);

    curl_close($curl);
    if ($err) {
    echo "cURL Error #:" . $err;
    } else {
    echo $response;
    }
  •       import http.client
    conn = http.client.HTTPSConnection("api.takeads.com")
    payload = "{\n\t\"iris\": [\n\t\t\"https://example.com/\"\n\t]\n}\n"
    headers = {
    'Content-Type': "application/json",
    'Authorization': "Bearer <Public Key>"
    }
    conn.request("PUT", "/v1/product/monetize-api/v2/resolve", 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 200 status code is returned.

The response payload is a JSON object that contains data array. Each item of the array is an object with the IRI, affiliated link, and link to the advertiser's logo (if requested).

The following table describes the response properties.

Property Type Description
iri string Link sent in the request.
trackingLink string Affiliate link to the advertiser's website (RFC 3986). You can update the s (SubID) and url (Deeplink) parameters after the tracking link is generated.
imageUrl string / null Link to the advertiser's logo, if requested (RFC 3986).


If an offer from the advertiser is not found in Takeads catalog, an empty array is returned in the response.


Example value

{
data: [
{
iri: 'https://example-one.de/item/1005003993360501.html',
trackingLink: 'https://tatrck.com/h/Q1w2e3R4T5y6?url=https://examplelink.com&s=product_subid,
imageUrl: 'https://mtusimg.de/logos_v2/90x45/7f5c65985ea0f99602873287fb19602e.gif'
},
{
iri: 'https://www.example-two.de/',
trackingLink: 'https://tatrck.com/h/Q1w2e3R4T5y6?url=https://examplelink.com&s=product_subid,
imageUrl: 'https://mtusimg.de/logos_v2/90x45/d4c4f0c0e5fe9da6493fd975d82e7abf.gif'
}
]
}


To view possible error responses, refer to the Error responses article.