Home Page ads require a simple "context' to be sent to Project Agora Commerce. A "context" is a bit of code that defines the conditions under which a product is shown to a customer.
Context:
Below are the values needed to generate a home page ad:
POST $BASE_URL/v1/ads/generate HTTP/1.1
accept: application/json
content-type: application/json
Authorization: Basic your_api_key_here
{
"pageType": "Home",
"catalogId": "$MY_CATALOG_ID",
"productFilters": [["placement:SponsoredProducts"]],
"maxNumberOfAds": number
}
No customer information or cart items are necessary in this simple context. The simple context consists only of necessary filters.
The discount and products fields are legacy and can be ignored
The static filterplacement:SponsoredProducts should be included in all SPL requests
In gtin field of the above responses you will get the pa_id as in the product feed for the product to be displayed.
Reminder: the pa_id is the concatenation of the catalog prefix and each product SKU, so to identify which SKU to display on your side you may need to remove the catalog prefix and the symbols "--"
pa_id= catprefix--SKU
If you are unsure of the strings displayed on this page. Take a look at the Reference page.