query
Prerequisites¶
Authentication tokenProject nameandslicer name- Column names
- Machine-readable column names are available in the
infomethod or by hovering over a column in the UI.
- Machine-readable column names are available in the
- For detailed parameter definitions, refer to the
full API reference.
Minimal example¶
Request
curl 'https://uslicer.criteo.com/API/v2/query' \
-H 'authorization: Bearer YOUR_TOKEN_GOES_HERE' \
-H 'accept: application/json' \
-H 'content-type: application/json;charset=UTF-8' \
-H 'user-agent: Just testing uSlicer API examples' \
--data-raw '{
"project_name":"test",
"slicer_name":"Traffic Demo",
"start_date":"2012-03-17",
"end_date":"2012-03-30",
"split_by":["campaign_id"],
"data_fields":["imps","bids","clicks","pvc","pcc"],
"order_by":[{"name":"imps","direction":"DESC"}],
"limit":100,
"offset":0
}'
import requests
import pprint
TOKEN = "YOUR_TOKEN_GOES_HERE"
response = requests.post(
url="https://uslicer.criteo.com/API/v2/query",
headers={
"Authorization": f"Bearer {TOKEN}",
"User-Agent": "Just testing uSlicer API examples"
},
json={
"project_name": "test",
"slicer_name": "Traffic Demo",
"start_date": "2012-03-17",
"end_date": "2012-03-30",
"split_by": ["campaign_id"],
"data_fields": ["imps", "bids", "clicks", "pvc", "pcc"],
"order_by": [{"name": "imps", "direction": "DESC"}],
"limit": 100,
"offset": 0
}
)
if not response.ok:
print(f"uSlicer request failed. "
f"Status: {response.status_code}. Response: {response.content}")
else:
# Print JSON response with human-readable formatting
pprint.pprint(response.json(), compact=True)
Currency conversion¶
Currency conversion is enabled by adding the data_field_options parameter to the request.
See the full API reference for detailed specification.
Request
curl 'https://uslicer.criteo.com/API/v2/query' \
-H 'authorization: Bearer YOUR_TOKEN_GOES_HERE' \
-H 'accept: application/json' \
-H 'content-type: application/json;charset=UTF-8' \
-H 'user-agent: Just testing uSlicer API examples' \
--data-raw '{
"project_name":"test",
"slicer_name":"Traffic Demo",
"start_date":"2012-03-17",
"end_date":"2012-03-30",
"split_by":["campaign_id"],
"data_fields":["imps","clicks","pub_payout"],
"data_field_options": [
{
"name": "pub_payout",
"currency_conversion": {
"currency_from": "USD",
"currency_to": "EUR",
"mode": "daily"
}
}
],
"order_by":[{"name":"pub_payout","direction":"DESC"}],
"limit":100,
"offset":0
}'
import requests
import pprint
TOKEN = "YOUR_TOKEN_GOES_HERE"
response = requests.post(
url="https://uslicer.criteo.com/API/v2/query",
headers={
"Authorization": f"Bearer {TOKEN}",
"User-Agent": "Just testing uSlicer API examples"
},
json={
"project_name": "test",
"slicer_name": "Traffic Demo",
"start_date": "2012-03-17",
"end_date": "2012-03-30",
"split_by": ["campaign_id"],
"data_fields": ["imps", "clicks", "pub_payout"],
"data_field_options": [
{
"name": "pub_payout",
"currency_conversion": {
"currency_from": "USD",
"currency_to": "EUR",
"mode": "daily"
}
}
],
"order_by": [{"name": "pub_payout", "direction": "DESC"}],
"limit": 100,
"offset": 0
}
)
if not response.ok:
print(f"uSlicer request failed. "
f"Status: {response.status_code}. Response: {response.content}")
else:
# Print JSON response with human-readable formatting
pprint.pprint(response.json(), compact=True)
Relative dates¶
{
"start_date": "-7d",
"end_date": "-1d"
}
Relative dates can be used instead of fixed dates. In the above example, the request retrieves data from 7 days ago up to yesterday.
Other options are available, such as: - Beginning of the current month - N days from the end of the previous month
See the full API reference or r there is a hint in the UI:
- 
