Skip to main content

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.

warning

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

warning

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

info

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

Request Header

NameValue
Content-Typeapplication/json
AuthorizationBearer ACCESS_TOKEN

Request Parameters

ParameterTypeDescription
adsetIdGUIDId of the adset to update

Example Request Payload

{
"collectionId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"collection": {
"name": "New Collection Name",
"products": ["refId1", "refId2", "refId"]
}
}
ParameterTypeRequiredDescription
collectionIdGUIDconditionally optionalExisting collectionId. If collectionId is provided, system will update the adset collection using this collectionId.
collectionobjectconditionally optionalCollection details. If collection Id not provided, system will create a new collection using this collection information and update the AdSet collectionId accoringly.
IMPORTANT
  • 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));