We’ve migrated our documentation to a new site, which means some URLs have changed.
Audience

Data Extract REST API

This API allows management of Data Extracts in Cxense Advertising. Extracts can be generated, downloaded and deleted via this API.

Retrieving the list of Extracts

GET

Retrieves a list of details of available Extract. Details returned include the type, date range, locale, currency code and status of the extract. Use the Extract File API to download the actual Data Extract.

https://{cxadbaseurl}/api/secure/extracts?extractType={extractType}&startDate={YYYYmmDDHHMM}&endDate={YYYYmmDDHHMM}

Parameters:

  • cxadbaseurl - the base URL of the Cxense Advertising system

  • extractType - optional filter for type - return extracts that match the type (ACCOUNT_BALANCES, ACCOUNT_LOW_BUDGET, ACCOUNT_TOTALS, ACCOUNT_TRANSACTIONS, ADVERTISER_CREATIVE_PERFORMANCE, ADVERTISER_CAMPAIGN_PERFORMANCE, INVENTORY_DISTRIBUTION or OPERATIONAL_FINANCE)

  • startDate - option filter for start date - returns extracts that have a start date after this startDate

  • endDate - option filter for end date - returns extracts that have a end date before this endDate

Example command:

curl -s -H "Content-type: text/xml" -u jsmith:password1 -X GET "https://cxad.cxense.com/api/secure/extracts"

The following XML example shows the contents returned from a typical GET call:

<?xml version="1.0" encoding="UTF-8"?>
<cx:extracts xmlns:cx="http://cxense.com/cxad/api/cxad">
  <cx:extract>
    <cx:extractId>310f7a427ac84dab98ed0e3c298a0121</cx:extractId>
    <cx:extractType>INVENTORY_DISTRIBUTION</cx:extractType>
    <cx:startDate>2012-10-01T00:00:00.000+10:00</cx:startDate>
    <cx:endDate>2012-10-31T23:59:59.999+11:00</cx:endDate>
    <cx:timeZoneId>Australia/Melbourne</cx:timeZoneId>
    <cx:currencyCode>AUD</cx:currencyCode>
    <cx:locale>en_AU</cx:locale>
    <cx:status>COMPLETE</cx:status>
  </cx:extract>
  <cx:extract>
    <cx:extractId>310f7a427ac84dab98ed0e3c298a0121</cx:extractId>
    <cx:extractType>ACCOUNT_TRANSACTIONS</cx:extractType>
    <cx:startDate>2012-10-01T00:00:00.000+10:00</cx:startDate>
    <cx:endDate>2012-10-31T23:59:59.999+11:00</cx:endDate>
    <cx:timeZoneId>Australia/Melbourne</cx:timeZoneId>
    <cx:currencyCode>AUD</cx:currencyCode>
    <cx:locale>en_AU</cx:locale>
    <cx:status>COMPLETE</cx:status>
    <cx:userId>0000000000003ab0</cx:userId>
    <cx:baseUrl>http://example.com/</cx:baseUrl>
  </cx:extract>
</cx:extracts>

Individual Extracts

GET

Retrieves details of a specific Extract. Details returned include the type, date range, locale, currency code and status of the extract. Use the Extract File API to download the actual Data Extract.

https://{cxadbaseurl}/api/secure/extract/{extractId}

Parameters:

  • cxadbaseurl - the base URL of the Cxense Advertising system

  • extractId - the unique id for the extract to be retrieved.

Example command:

curl -s -H "Content-type: text/xml" -u jsmith:password1 -X GET "https://cxad.cxense.com/api/secure/extract/310f7a427ac84dab98ed0e3c298a0121"

The following XML example shows the contents returned from a typical GET call:

<?xml version="1.0"?>
<cx:extract xmlns:cx="http://cxense.com/cxad/api/cxad">
  <cx:extractId>310f7a427ac84dab98ed0e3c298a0121</cx:extractId>
  <cx:extractType>INVENTORY_DISTRIBUTION</cx:extractType>
  <cx:startDate>2012-10-01T00:00:00.000+10:00</cx:startDate>
  <cx:endDate>2012-10-31T23:59:59.999+11:00</cx:endDate>
  <cx:timeZoneId>Australia/Melbourne</cx:timeZoneId>
  <cx:currencyCode>AUD</cx:currencyCode>
  <cx:locale>en_AU</cx:locale>
  <cx:status>COMPLETE</cx:status>
  <cx:userId>0000000000003ab0</cx:userId>
  <cx:baseUrl>http://example.com/</cx:baseUrl>
</cx:extract>

POST

Requests a new extract to be generated based on the parameters provided.

https://{cxadbaseurl}/api/secure/extract

Parameters:

  • cxadbaseurl - the base URL of the Cxense Advertising system

This XML example shows the contents required to be supplied for a POST call:

<?xml version="1.0"?>
<cx:extract xmlns:cx="http://cxense.com/cxad/api/cxad">
  <cx:extractType>ACCOUNT_TOTALS</cx:extractType>
  <cx:startDate>2012-10-02T00:00:00.000+10:00</cx:startDate>
  <cx:endDate>2012-10-31T23:59:59.999+11:00</cx:endDate>
  <cx:timeZoneId>Australia/Melbourne</cx:timeZoneId>
  <cx:currencyCode>AUD</cx:currencyCode>
  <cx:locale>en_AU</cx:locale>
  <cx:userId>0000000000003ab0</cx:userId>
  <cx:baseUrl>http://example.com/</cx:baseUrl>
</cx:extract>

Example command:

curl -s -H "Content-type: text/xml" -u jsmith:password1 -X POST "https://cxad.cxense.com/api/secure/extract" -d @input.xml

Fields

Required

startDate

endDate

timeZoneId

currencyCode

locale

Optional

userId

baseUrl

DELETE

Remove an existing extract.

https://{cxadbaseurl}/api/secure/extract/{extractId}

Parameters:

  • cxadbaseurl - the base URL of the Cxense Advertising system

  • extractId - the unique id for the extract to be deleted.

Requested extracts in progress cannot be removed. The DELETE will return successfully; however, the extract will not be removed if the extract status is:

<cx:status>REQUESTED</cx:status>

For removal an extract status must be:

<cx:status>COMPLETE</cx:status>


Example command:

curl -s -H "Content-type: text/xml" -u jsmith:password1 -X DELETE "https://cxad.cxense.com/api/secure/extract/310f7a427ac84dab98ed0e3c298a0121"

Individual Extract Files

GET

Retrieves the actual extract data file. This file is streamed as a zip compressed csv text file. Only extracts with a status of COMPLETED have files available for download.

https://{cxadbaseurl}/api/secure/extractFile/{extractId}

Parameters:

  • cxadbaseurl - the base URL of the Cxense Advertising system

  • extractId - the unique id for the extract to be retrieved.

Example command:

curl -s -H "Content-type: text/xml" -u jsmith:password1 -X GET "https://cxad.cxense.com/api/secure/extractFile/310f7a427ac84dab98ed0e3c298a0121" > extract.zip

This API method does not return any XML as only the streamed file is returned.

Email Notifications

The following fields are used for email notifications:

  • userId - the user id of the user to email when the extract is complete.

  • baseUrl - the url to use for the download link in the email. This is appended with the path to the extract download page in Cxense Advertising - manage/finance/extract/{extractId}

Both these fields are optional. If userId is not present then no email will be sent. If baseUrl is not present then an email without a download link will be sent.

Last updated: