The below elements will help you test our Criteo REST API from the command line or from a browser, using Curl to simulate the different GET and POST calls that will enable you to retrieve your first reports.
Highlighted in orange are the elements you will need to change in your calls.
Curl for authentication
curl -X POST --header 'Content-Type: application/x-www-form-urlencoded' --header 'Accept: application/json' -d 'client_id=[clientId]&client_secret=[clientSecret]&grant_type=client_credentials' 'https://api.criteo.com/marketing/oauth2/token'
API response: Token
Curl for portfolio
curl -X GET
--header 'Accept: application/json'
--header 'Authorization: Bearer [token]'
'https://api.criteo.com/marketing/v1/portfolio'
API response: Advertiser_ID
Curl for statistics retrieval
curl -X POST
--header 'Content-Type: application/json'
--header 'Accept: application/octet-stream'
--header 'Authorization: Bearer [token]
-d '{
"reportType": "CampaignPerformance",
"ignoreXDevice": true,
"startDate": "[startDate]",
"endDate": "[endDate]"
"dimensions": [ "Day", "CampaignId" ],
"metrics": [ "Clicks", "Displays"],
"format": "Csv",
"currency": "[Currency]",
"timezone": "GMT"
}'
'https://api.criteo.com/marketing/v1/statistics'
API response: Download link to the report
Curl to create an API audience
curl -X POST
--header 'Content-Type: application/json'
--header 'Accept: application/octet-stream'
--header 'Authorization: Bearer [token]
-d '{ "advertiser_id": 0,
"name": "string",
"description": "string"}'
'https://api.criteo.com/marketing/v1/audiences/userlist'
API response: audience_id
Curl to update a user audience
curl -X PUT
--header 'Content-Type: application/json'
--header 'Accept: application/octet-stream'
--header 'Authorization: Bearer [token]
-d '{
"name": "string",
"description": "string"
}'
'https://api.criteo.com/marketing/v1/audiences/audience_ id'
API response: OK/ERROR
curl -X GET
--header 'Accept: application/json'
--header 'Authorization: Bearer [token]'
Swagger
Swagger is the world's largest framework of API developer tools enabling test and deployment. You can also use our Swagger tools to manually test the API.
Swagger is available at this url: https://api.criteo.com/marketing/swagger/
Note: This Swagger links to the live Criteo Production environment. Any test applied there will thus impact real campaigns.