Skip to content
This repository has been archived by the owner on Sep 19, 2022. It is now read-only.

Latest commit

 

History

History
161 lines (125 loc) · 11.2 KB

StatisticsApi.md

File metadata and controls

161 lines (125 loc) · 11.2 KB

StatisticsApi

All URIs are relative to https://api.criteo.com/marketing

Method HTTP request Description
getCampaignReport POST /v1/statistics/report Generates a statistics report
getStats POST /v1/statistics Generates a statistics report

getCampaignReport

byte[] getCampaignReport(authorization, reportQuery)

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.<br /> 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).<br /> Dimensions: (mandatory) The dimensions to be used in the report. Possible values: CampaignId, Campaign, AdvertiserId, Advertiser, CategoryId, Category, Hour, Day, Week, Month, Year.<br /> Metrics:(mandatory) The metrics to be used in the report. For a list of possible values, please see <a href=&quot;https://support.criteo.com/s/article?article&#x3D;API-Statistics-Reference\&quot;&gt;the full documentation</a>.<br /> Format: (mandatory)The file format of the generated report. Possible values: Csv, Excel, Xml, Json<br /> 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=&quot;https://support.criteo.com/s/article?article&#x3D;Supported-currencies-API\&quot;&gt;the full documentation</a>. If not set, the user's preference setting will be used.<br /> Timezone: (optional) Timezone to be used in the report. Possible format<br /> - TZ format (e.g. Europe/London) - UTC format (e.g. UTC+1:00) - Timezone abbreviation (e.g. PST) If not set, GMT is used.<br /> #### 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.<br /> StartDate should come before, or be equal to EndDate.<br /> The requested dimensions must be in a supported combination.<br /> At least one metric must be provided.<br /> All metrics must be supported.<br /> No duplicated metric in the list.<br /> The selected advertisers must have at least one campaign.<br />

Example

// Import classes:
import com.criteo.marketing.ApiClient;
import com.criteo.marketing.ApiException;
import com.criteo.marketing.Configuration;
import com.criteo.marketing.auth.*;
import com.criteo.marketing.models.*;
import com.criteo.marketing.api.StatisticsApi;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    defaultClient.setBasePath("https://api.criteo.com/marketing");
    
    // Configure API key authorization: Authorization
    ApiKeyAuth Authorization = (ApiKeyAuth) defaultClient.getAuthentication("Authorization");
    Authorization.setApiKey("YOUR API KEY");
    // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
    //Authorization.setApiKeyPrefix("Token");

    StatisticsApi apiInstance = new StatisticsApi(defaultClient);
    String authorization = "\"Bearer VALID_JWT_TOKEN_BASE64\""; // String | JWT Bearer Token
    CampaignReportQueryMessage reportQuery = new CampaignReportQueryMessage(); // CampaignReportQueryMessage | 
    try {
      byte[] result = apiInstance.getCampaignReport(authorization, reportQuery);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling StatisticsApi#getCampaignReport");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
authorization String JWT Bearer Token [default to "Bearer VALID_JWT_TOKEN_BASE64"]
reportQuery CampaignReportQueryMessage

Return type

byte[]

Authorization

Authorization

HTTP request headers

  • 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

HTTP response details

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. -

getStats

byte[] getStats(authorization, statsQuery)

Generates a statistics report

<b>ReportType</b>: The type of report to generate. Possible values: CampaignPerformance, FacebookDPA, TransactionID. <i>(mandatory)</i><br /><b>AdvertiserIds</b>: 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. <i>(optional)</i><br /><b>StartDate, EndDate</b>: 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). <i>(mandatory)</i><br /><b>Dimensions</b>: The dimensions to be used in the report. Between one and three. Possible values: CampaignId, AdvertiserId, Category, Hour, Day, Week, Month, Year. <i>(mandatory)</i><br /><b>Metrics</b>: The metrics to be used in the report. For a list of possible values, please see <a href=&quot;https://support.criteo.com/s/article?article&#x3D;Criteo-Marketing-API-Intro\&quot;&gt;the full documentation</a>. <i>(mandatory)</i><br /><b>Format</b>: The file format of the generated report. Possible values: Csv, Excel, Xml, Json <i>(mandatory)</i><br /><b>Currency</b>: The currency to be used in the report. Three-letter capitals. For a list of possible values, please see <a href=&quot;https://support.criteo.com/s/article?article&#x3D;Criteo-Marketing-API-Intro\&quot;&gt;the full documentation</a>. If not set, the user's preference setting will be used. <i>(optional)</i><br /><b>Timezone</b>: Timezone to be used in the report. Possible values: GMT, PST, JST. If not set, the user's preference setting will be used. <i>(optional)</i><br /><b>IgnoreXDevice</b>: Ignore cross-device data. Also can explicitly set to null for TransactionID ReportType to get all data. Defaults to false. <i>(optional)</i><br /><h4>Functional cases</h4> 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. <h4>Validation rules</h4> StartDate and EndDate are mandatory.<br /> StartDate should come before, or be equal to EndDate.<br /> The requested dimensions must be in a supported combination.<br /> At least one metric must be provided.<br /> All metrics must be supported.<br /> The selected advertisers must have at least one campaign.<br /> Seller dimension is not supported.<br /><h4>Response custom headers</h4> If you are asking for a CampaignPerformance report and sales metrics are late, response will have a custom header <b>latest-available-sales</b>, a datetime with format <b>yyyy-MM-dd HH:mm</b> using the requested timezone.

Example

// Import classes:
import com.criteo.marketing.ApiClient;
import com.criteo.marketing.ApiException;
import com.criteo.marketing.Configuration;
import com.criteo.marketing.auth.*;
import com.criteo.marketing.models.*;
import com.criteo.marketing.api.StatisticsApi;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    defaultClient.setBasePath("https://api.criteo.com/marketing");
    
    // Configure API key authorization: Authorization
    ApiKeyAuth Authorization = (ApiKeyAuth) defaultClient.getAuthentication("Authorization");
    Authorization.setApiKey("YOUR API KEY");
    // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
    //Authorization.setApiKeyPrefix("Token");

    StatisticsApi apiInstance = new StatisticsApi(defaultClient);
    String authorization = "\"Bearer VALID_JWT_TOKEN_BASE64\""; // String | JWT Bearer Token
    StatsQueryMessageEx statsQuery = new StatsQueryMessageEx(); // StatsQueryMessageEx | The report query details
    try {
      byte[] result = apiInstance.getStats(authorization, statsQuery);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling StatisticsApi#getStats");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
authorization String JWT Bearer Token [default to "Bearer VALID_JWT_TOKEN_BASE64"]
statsQuery StatsQueryMessageEx The report query details

Return type

byte[]

Authorization

Authorization

HTTP request headers

  • 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

HTTP response details

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. -