Skip to main content

Create/Update AdSet Collection

The Create/Update AdSet Collection API is designed to update the product selection within a specific AdSet. This endpoint enables users to dynamically select or deselect products, ensuring the AdSet reflects current strategic decisions and campaign goals.

Users can also define Dynamic Collections, from a cocktail of attribute filters. Dynamic Collections stay up to date over time, even as new items are added and old items go out of stock.

warning

It is important to handle campaign data securely and ensure that access is restricted to authorized users only.

API Endpoint

Method: POST

URL: https://<PA_RM_END_POINT>/retail-media/addSetCollections/create-edit-collection

Request Header

NameValue
Content-Typeapplication/json
AuthorizationBearer ACCESS_TOKEN
info

Please refer to the Authentication API documentation for bearer token.

Example Request Payload

{
"id": "xxxxxxxxxxxxxxxxxxxxxxxxx",
"collectionType": "Fixed",
"retailerId": "xxxxxxxxxxxxxxxxxxxxxxxxx",
"supplierId": "xxxxxxxxxxxxxxxxxxxxxxxxx",
"name": "Test Collection",
"products": "288722,279270,141831,300135",
"collectionRules": []
}
ParameterTypeRequiredDescription
idGUIDId of the existing collection. If is it provided existing collection will be updated otherwise a new collection will be created.
namestringName of the collection.
retailerIdstringUnique identifier of the retailer.
supplierIdstringUnique identifier of the supplier.
collectionTypestringType of collection. Available values are Fixed & Dynamic.
productsarray of stringArray of product ref ids.
collectionRulesarray of objectList of rules for the dynamic product select.
info

Please refer to the Supplier API documentation for detailed instructions on how to retrieve the supplierId and Retailer API for retailer.

IMPORTANT
  • If the collection type Fixed then the 'products' parameter is required.
  • If the collection type is Dynamic then the 'collectionRules' parameter is required. If collection rules is empty it will consider all the available products for the collection, for that supplier.

collectionRule object details

ParameterTypeRequiredDescription
idGUIDUnique identifier for the placement.
slotstringThe slot number that you want to target.
maxCostdecimalMaximum cost for this placement. Should be greater than Placement cost.
startDatestring✅ (If placement Strategy type is Fixed)Start date for this placement in ISO format (YYYY-MM-DDTHH:mm:ss.sssZ)
endDatestring✅ (If placement Strategy type is Fixed)End date for this placement in ISO format (YYYY-MM-DDTHH:mm:ss.sssZ).

Response Payload

Success Response

  • Status Code: 200 OK
  • Payload: Returns the created campaign information in JSON format
{
"message": "Collection created successfully",
"id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
}

Error Response

If an error occurs, the API will return an appropriate status code along with an error message.

  • Sample Error Response (400 Bad Request):
{
"errors": [
"Error message 1",
"Error message 2"
],
"type": "https://tools.ietf.org/html/rfc7231#section-6.5.1",
"title": "One or more validation errors occurred.",
"status": 400,
"traceId": "xxxxxxxxxxxxxxxxxxx"
}

Example Usage (JavaScript)

var myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Authorization", "BEARER YOUR_ACCESS_TOKEN");

const body = JSON.stringify(
{
"id": "xxxxxxxxxxxxxxxxxxxxxxxxx",
"collectionType": "Fixed",
"retailerId": "xxxxxxxxxxxxxxxxxxxxxxxxx",
"supplierId": "xxxxxxxxxxxxxxxxxxxxxxxxx",
"name": "Test Collection",
"products": "288722,279270,141831,300135",
"collectionRules": []
}
)

var requestOptions = {
method: 'POST',
headers: myHeaders,
body: body
};

fetch("https://<PA_RM_END_POINT>/retail-media/addSetCollections/create-edit-collection", requestOptions)
.then(response => response.json())
.then(result=> {
console.log(result);
})
.catch(error => console.log('error', error));