Skip to content

[API] Polling

Polling API Documentation

Overview

The Polling API is designed to increment a selected value in an array and return the updated dataset using an HTTP POST request. The API also supports an HTTP GET request, which retrieves the current dataset without performing an increment operation.

Endpoints

1. Increment and Retrieve Data (POST Method)

Endpoint:

POST https://sumsavn4gi.execute-api.us-east-1.amazonaws.com/prod/polling/creative

Description:

This endpoint increments a selected value in the dataset and returns the updated array.

Request Parameters:

creative (string) - The name of the project or campaign.
property (string) - The property associated with the request (e.g., "nyt"). List of possible properties: - droidapp, drtabapp, athdroid, athios, iapp, cookiapp, cooktabapp, nyt, mnyt, athweb, itabapp for our flex ads, we can use the GAM prop ( %%PATTERN:prop%% ) value to populate this property attribute.
options (array of integers) - An array representing current selection values, where the selected index is incremented.

Example Request:

fetch("https://sumsavn4gi.execute-api.us-east-1.amazonaws.com/prod/polling/creative", {
method: "POST",
body: JSON.stringify({
"creative": "demo-project",
"property": "nyt",
"options": [0,0,1]
})
})
.then((response) => response.json())
.then((json) => {
let returnedData = json.response.body.options;
console.log("Returned data:", returnedData);
});

Example Response:

{
"response": {
"version": 1.99,
"statusCode": 200,
"body": {
"creative": "demo-project",
"options": [
8,
0,
0
]
}
}
}

2. Retrieve Data Without Incrementing (GET Method)

Endpoint:

GET https://sumsavn4gi.execute-api.us-east-1.amazonaws.com/prod/polling/creative

Description:

This endpoint retrieves the current dataset without modifying any values.

Request Parameters:

creative (string) - The name of the project or campaign.

Example Request:

fetch("https://sumsavn4gi.execute-api.us-east-1.amazonaws.com/prod/polling/creative", {
method: "GET",
body: JSON.stringify({
"creative": "demo-project",
"property": "nyt"
})
})
.then((response) => response.json())
.then((json) => {
let returnedData = json.response.body.options;
console.log("Returned data:", returnedData);
});

Example Response:

{
"response": {
"version": 1.99,
"statusCode": 200,
"body": {
"creative": "demo-project",
"options": [
8,
0,
0
]
}
}
}

Example Use Cases

Table 1
Selection
Request Data (Array)
Returned Data (Array)
1
[1,0,0]
[1,0,0]
2
[0,1,0]
[1,1,0]
1
[1,0,0]
[2,1,0]
3
[0,0,1]
[2,1,1]
There are no rows in this table

Additional Resources

For more details, visit the API repository:
Postman Example: Post - read / write:
Postman Example: Get - read:
Want to print your doc?
This is not the way.
Try clicking the ⋯ next to your doc name or using a keyboard shortcut (
CtrlP
) instead.