Requesting Ads (the "Context" and its Parts)

How to request Ads to display on your site.

In order to request ads, you must provide a context.

An example of a context is shown below. In this example, the type of each kind of data is shown. For example, "string" means an alphanumeric string. number means a number like "1" or "950.49". Integer means a whole number, like "1" or "25".

JSON
cURL
POST $BASE_URL/v1/ads/generate HTTP/1.1
accept: application/json
content-type: application/json
Authorization: Basic your_api_key_goes_here
{
"catalogId": "String"
"customerId": "String"
"searchTerm": "String"
"productFilters": [
[
"String",
"String",
"String"
],
]
"pageType": "String",
"maxNumberOfAds": "Number",
"sessionId": "String"
}
curl -iX POST "$BASE_URL/v1/ads/generate" \
-H "accept: application/json" \
-H "content-type: application/json" \
-H "Authorization: Basic your_api_key_goes_here" \
-d \
'{
"catalogId": "String"
"customerId": "String"
"searchTerm": "String"
"productFilters": [
[
"String",
"String",
"String"
],
]
"pageType": "String",
"maxNumberOfAds": "Number",
"sessionId": "String"
}'

When you have successfully requested an ad, you receive the following object:

HTTP
cURL
HTTP/2 200
{
"ads": [
{
"id": "string",
"gtin": "string",
"expiry": "string",
}
],
}
{
"ads": [
{
"id": "string",
"gtin": "string",
"expiry": "string",
}
],
}

A mock version can be seen below:

HTTP
cURL
POST $BASE_URL/v1/ads/generate HTTP/1.1
accept: application/json
content-type: application/json
Authorization: Basic 4ww25f70-b52s-40de-8f29-07b139b5cdc8
{
"catalogId": "628dbe95-2ec9-4e07-881d-3e9f92ab2e0b",
"customerId”: "EB0003456#123#432",
"searchTerm”: "null",
"productFilters": [
[
"ComputersAndLaptops",
"AllLaptops",
"WindowsLaptops"
],
]
"pageType": "Category",
"maxNumberOfAds": 4,
"sessionId": "23dn3923-323d (this is a generated id that you control which identifies a user's session). Optional"
}
curl -iX POST "$BASE_URL/v1/ads/generate" \
-H "accept: application/json" \
-H "content-type: application/json" \
-H "Authorization: Basic 4ww25f70-b52s-40de-8f29-07b139b5cdc8" \
-d \
'{
"catalogId": "628dbe95-2ec9-4e07-881d-3e9f92ab2e0b",
"customerId”: "EB0003456#123#432",
"searchTerm”: "null",
"productFilters": [
[
"ComputersAndLaptops",
"AllLaptops",
"WindowsLaptops"
],
]
"pageType": "Category",
"maxNumberOfAds": 4,
"sessionId": "23dn3923-323d (this is a generated id that you control which identifies a user's session). Optional"
}'

When you have successfully requested an ad, you receive the following object:

HTTP
cURL
HTTP/2 200
{
"ads": [
{
"id": "34558f9b-bbb9-49fb-93fe-3ad481cr443",
"gtin": "88560901388694",
"expiry": "2018-04-30T01:14:99.832ZD",
}
],
}
{
"ads": [
{
"id": "34558f9b-bbb9-49fb-93fe-3ad481cr443",
"gtin": "88560901388694",
"expiry": "2018-04-30T01:14:99.832ZD",
}
],

If you are unsure of the strings displayed on this page. Take a look at the Reference page.