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.
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
Name | Value |
---|---|
Content-Type | application/json |
Authorization | Bearer ACCESS_TOKEN |
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": []
}
Parameter | Type | Required | Description |
---|---|---|---|
id | GUID | Id of the existing collection. If is it provided existing collection will be updated otherwise a new collection will be created. | |
name | string | ✅ | Name of the collection. |
retailerId | string | ✅ | Unique identifier of the retailer. |
supplierId | string | Unique identifier of the supplier. | |
collectionType | string | ✅ | Type of collection. Available values are Fixed & Dynamic . |
products | array of string | Array of product ref ids. | |
collectionRules | array of object | List of rules for the dynamic product select. |
Please refer to the Supplier API documentation for detailed instructions on how to retrieve the supplierId
and Retailer API for retailer.
- 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
Parameter | Type | Required | Description |
---|---|---|---|
id | GUID | ✅ | Unique identifier for the placement. |
slot | string | The slot number that you want to target. | |
maxCost | decimal | Maximum cost for this placement. Should be greater than Placement cost. | |
startDate | string | ✅ (If placement Strategy type is Fixed) | Start date for this placement in ISO format (YYYY-MM-DDTHH:mm:ss.sssZ) |
endDate | string | ✅ (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));