All URIs are relative to https://api.criteo.com/marketing
Method | HTTP request | Description |
---|---|---|
get_campaign_report | POST /v1/statistics/report | Generates a statistics report |
get_stats | POST /v1/statistics | Generates a statistics report |
str get_campaign_report(authorization, report_query)
Generates a statistics report
###This Statistics endpoint is an upgrade of our previous Statistics endpoint, and includes new metrics and customization capabilities. It is currently in beta and subject to change. Reach out to your Criteo contact if you’re interesting in participating in the beta### AdvertiserIds:(mandatory) The list of advertiser ids, comma-separated. Advertisers not in your portfolio will be skipped. If no id is present, all the advertisers in the portfolio will be used.
StartDate, EndDate: (mandatory) Start date (beginning of day) and end date (beginning of day) to be used for the report generation. Format to use: yyyy-mm-dd (e.g. 2017-10-30).
Dimensions: (mandatory) The dimensions to be used in the report. Possible values: CampaignId, Campaign, AdvertiserId, Advertiser, CategoryId, Category, Hour, Day, Week, Month, Year.
Metrics:(mandatory) The metrics to be used in the report. For a list of possible values, please see <a href="https://support.criteo.com/s/article?article=API-Statistics-Reference\">the full documentation.
Format: (mandatory)The file format of the generated report. Possible values: Csv, Excel, Xml, Json
Currency: (optional) The currency to be used in the report. ISO 4217 code (three-letter capitals). For a list of supported values, please see <a href="https://support.criteo.com/s/article?article=Supported-currencies-API\">the full documentation. If not set, the user's preference setting will be used.
Timezone: (optional) Timezone to be used in the report. Possible format
- TZ format (e.g. Europe/London) - UTC format (e.g. UTC+1:00) - Timezone abbreviation (e.g. PST) If not set, GMT is used.
#### Functional cases #### Statistic export in a file might be corrupted through Swagger. It's recommended to access this file through a CURL request or other programmatic methods. #### Validation rules #### StartDate and EndDate are mandatory.
StartDate should come before, or be equal to EndDate.
The requested dimensions must be in a supported combination.
At least one metric must be provided.
All metrics must be supported.
No duplicated metric in the list.
The selected advertisers must have at least one campaign.
- Api Key Authentication (Authorization):
from __future__ import print_function
import time
import criteo_marketing
from criteo_marketing.rest import ApiException
from pprint import pprint
configuration = criteo_marketing.Configuration()
# Configure API key authorization: Authorization
configuration.api_key['Authorization'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['Authorization'] = 'Bearer'
# Defining host is optional and default to https://api.criteo.com/marketing
configuration.host = "https://api.criteo.com/marketing"
# Create an instance of the API class
api_instance = criteo_marketing.StatisticsApi(criteo_marketing.ApiClient(configuration))
authorization = 'Bearer VALID_JWT_TOKEN_BASE64' # str | JWT Bearer Token (default to 'Bearer VALID_JWT_TOKEN_BASE64')
report_query = criteo_marketing.CampaignReportQueryMessage() # CampaignReportQueryMessage |
try:
# Generates a statistics report
api_response = api_instance.get_campaign_report(authorization, report_query)
pprint(api_response)
except ApiException as e:
print("Exception when calling StatisticsApi->get_campaign_report: %s\n" % e)
Name | Type | Description | Notes |
---|---|---|---|
authorization | str | JWT Bearer Token | [default to 'Bearer VALID_JWT_TOKEN_BASE64'] |
report_query | CampaignReportQueryMessage |
str
- Content-Type: application/json, text/json, application/xml, text/xml, application/x-www-form-urlencoded, text/html
- Accept: application/json, text/json, application/xml, text/xml, text/html
Status code | Description | Response headers |
---|---|---|
200 | Report generated OK. | - |
401 | Authentication failed. | - |
403 | Access denied (Endpoint in beta) | - |
429 | Throttling failure. Maximum sending rate exceeded. | - |
500 | Unknown error. | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
str get_stats(authorization, stats_query)
Generates a statistics report
ReportType: The type of report to generate. Possible values: CampaignPerformance, FacebookDPA, TransactionID. (mandatory)
AdvertiserIds: The list of advertiser ids, comma-separated. Advertisers not in your portfolio will be skipped. If not present, all the advertisers in the portfolio will be used. (optional)
StartDate, EndDate: Start date (beginning of day) and end date (end of day) to be used for the report generation. Format to use: yyyy-MM-dd (e.g. 2017-10-30). (mandatory)
Dimensions: The dimensions to be used in the report. Between one and three. Possible values: CampaignId, AdvertiserId, Category, Hour, Day, Week, Month, Year. (mandatory)
Metrics: The metrics to be used in the report. For a list of possible values, please see <a href="https://support.criteo.com/s/article?article=Criteo-Marketing-API-Intro\">the full documentation. (mandatory)
Format: The file format of the generated report. Possible values: Csv, Excel, Xml, Json (mandatory)
Currency: The currency to be used in the report. Three-letter capitals. For a list of possible values, please see <a href="https://support.criteo.com/s/article?article=Criteo-Marketing-API-Intro\">the full documentation. If not set, the user's preference setting will be used. (optional)
Timezone: Timezone to be used in the report. Possible values: GMT, PST, JST. If not set, the user's preference setting will be used. (optional)
IgnoreXDevice: Ignore cross-device data. Also can explicitly set to null for TransactionID ReportType to get all data. Defaults to false. (optional)
StartDate should come before, or be equal to EndDate.
The requested dimensions must be in a supported combination.
At least one metric must be provided.
All metrics must be supported.
The selected advertisers must have at least one campaign.
Seller dimension is not supported.
If you are asking for a CampaignPerformance report and sales metrics are late, response will have a custom header latest-available-sales, a datetime with format yyyy-MM-dd HH:mm using the requested timezone.
- Api Key Authentication (Authorization):
from __future__ import print_function
import time
import criteo_marketing
from criteo_marketing.rest import ApiException
from pprint import pprint
configuration = criteo_marketing.Configuration()
# Configure API key authorization: Authorization
configuration.api_key['Authorization'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['Authorization'] = 'Bearer'
# Defining host is optional and default to https://api.criteo.com/marketing
configuration.host = "https://api.criteo.com/marketing"
# Create an instance of the API class
api_instance = criteo_marketing.StatisticsApi(criteo_marketing.ApiClient(configuration))
authorization = 'Bearer VALID_JWT_TOKEN_BASE64' # str | JWT Bearer Token (default to 'Bearer VALID_JWT_TOKEN_BASE64')
stats_query = criteo_marketing.StatsQueryMessageEx() # StatsQueryMessageEx | The report query details
try:
# Generates a statistics report
api_response = api_instance.get_stats(authorization, stats_query)
pprint(api_response)
except ApiException as e:
print("Exception when calling StatisticsApi->get_stats: %s\n" % e)
Name | Type | Description | Notes |
---|---|---|---|
authorization | str | JWT Bearer Token | [default to 'Bearer VALID_JWT_TOKEN_BASE64'] |
stats_query | StatsQueryMessageEx | The report query details |
str
- Content-Type: application/json, text/json, application/xml, text/xml, application/x-www-form-urlencoded, text/html
- Accept: application/json, text/json, application/xml, text/xml, text/html
Status code | Description | Response headers |
---|---|---|
200 | Statistics report generated OK. | - |
400 | Bad request, invalid syntax or validation error. | - |
401 | Authentication failed. | - |
403 | No campaigns found. | - |
429 | Throttling failure. Maximum sending rate exceeded. | - |
500 | Unknown error. | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]