JavaScript required
We’re sorry, but Coda doesn’t work properly without JavaScript enabled.
Skip to content
Gallery
CreativeTech Wiki (internal)
creativeTECH Wiki
More
Share
Explore
Internal Use Only
Poll Api
this document will go over our new polling api and how to use it
our polling api is a simple increment data return request that takes in a array of data and returns an updated array
for example,
it will take [0,0,1] and return [0,0,2]
here is a little more on this:
sampe of request and return of data
sampe of request and return of data
selection
request data (data type Array)
return data (data type Array)
selection
request data (data type Array)
return data (data type Array)
1
1
[1,0,0]
[1,0,0]
2
2
[0,1,0]
[1,1,0]
3
1
[1,0,0]
[2,1,0]
4
3
[0,0,1]
[2,1,1]
There are no rows in this table
How to use it:
SEND & RECEIVE DATA (Post Method):
you can make a fetch call
Requirements
:
project / campaign name
selection index #
fetch
(
"https://sumsavn4gi.execute-api.us-east-1.amazonaws.com/prod/polling/creative"
,
{
method
:
"POST"
,
body
:
JSON
.
stringify
(
{
"creative"
:
"your-project-name"
,
"options"
:
[
0
,
0
,
1
]
// here the third item is selected
}
)
}
)
.
then
(
(
response
)
=>
response
.
json
(
)
)
.
then
(
(
json
)
=>
{
let
returnedData
=
json
.
response
.
body
.
options
;
console
.
log
(
"returned data: "
,
returnedData
)
;
}
)
;
RECEIVE / READ DATA (Get Method):
you can make a fetch call
Requirements
:
project / campaign name
fetch
(
"https://sumsavn4gi.execute-api.us-east-1.amazonaws.com/prod/polling/creative"
,
{
method
:
"GET"
,
body
:
JSON
.
stringify
(
{
"creative"
:
"your-project-name"
}
)
}
)
.
then
(
(
response
)
=>
response
.
json
(
)
)
.
then
(
(
json
)
=>
{
let
returnedData
=
json
.
response
.
body
.
options
;
console
.
log
(
"returned data: "
,
returnedData
)
;
}
)
;
to learn more about the API, checkout the repository
https://github.com/nytimes/dv-awsma-accounts-tbrand-dev/tree/feature/polling
sampe of request and return of data
How to use it:
SEND & RECEIVE DATA (Post Method):
RECEIVE / READ DATA (Get Method):
Want to print your doc?
This is not the way.
Try clicking the ⋯ next to your doc name or using a keyboard shortcut (
Ctrl
P
) instead.