Update AdSet Collection
The Update AdSet Collection API allows users to attach an existing collection or create and attach a new collection to the adset, providing flexibility in adset management.
It is important to handle adset data securely and ensure that access is restricted to authorized users only.
Be careful when updating a collection, in case it is shared by multiple adsets, updating the collection will affect all the adsets that are using the collection. If unsure, create a new collection.
API Endpoint
Method: POST
URL: https://<PA_RM_END_POINT>/retail-media/adsets/{adsetId}/update-collection
Please refer to the Supplier API documentation for detailed instructions on how to retrieve the supplierId
.
Request Header
Name | Value |
---|---|
Content-Type | application/json |
Authorization | Bearer ACCESS_TOKEN |
Request Parameters
Parameter | Type | Description |
---|---|---|
adsetId | GUID | Id of the adset to update |
Example Request Payload
{
"collectionId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"collection": {
"name": "New Collection Name",
"products": ["refId1", "refId2", "refId"]
}
}
Parameter | Type | Required | Description |
---|---|---|---|
collectionId | GUID | conditionally optional | Existing collectionId. If collectionId is provided, system will update the adset collection using this collectionId. |
collection | object | conditionally optional | Collection details. If collection Id not provided, system will create a new collection using this collection information and update the AdSet collectionId accoringly. |
- If collectionId is provided → The system updates the AdSet using the specified collectionId.
- If a collection object is provided (without collectionId) → The system creates a new collection and updates the AdSet accordingly.
- Requirement: At least one of collectionId or collection must be provided.
Response Payload
Success Response
- Status Code:
200 OK
- Payload: Returns the success message of the operation in JSON format
{
"status": "success",
"message": "Collection successfully attached to the AdSet",
"adSetId": "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(
{
"collectionId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"collection": {
"name": "New Collection Name",
"products": ["refId1", "refId2", "refId"]
}
}
)
var requestOptions = {
method: 'POST',
headers: myHeaders,
body: body
};
fetch("https://<PA_RM_END_POINT>/retail-media/adsets/{adsetId}/update-collection", requestOptions)
.then(response => response.json())
.then(result=> {
console.log(result);
})
.catch(error => console.log('error', error));