Skip to main content

Play/Pause Campaign

The Play/Pause Campaign API allows users to start or pause an active campaign at any time, providing flexibility in campaign management.

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/campaings/{campaignId}/update-status

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
supplierIdstringGet the supplier ID from the supplier API
campaignIdGUIDId of the campaign

Example Request Payload

{
"status": true
}
ParameterTypeRequiredDescription
statusBooleanStatus of the campaign.
If status = true (We are running the campaign if it is paused.).
If status = false(We are pausing the campaign if it is running).

Response Payload

Success Response

  • Status Code: 200 OK
  • Payload: Returns the created campaign information in JSON format
{
"status": "success",
"message": "Campaign status updated successfully",
"campaignId": "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(
{
"status": true
}
)

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

fetch("https://<PA_RM_END_POINT>/retail-media/campaings/{campaignId}/update-status", requestOptions)
.then(response => response.json())
.then(result=> {
console.log(result);
})
.catch(error => console.log('error', error));