export
Specification¶
- Description:
-
Exports report data to a file of the xlsx, csv, or tsv format. Data is restricted by query parameters passed in POST arguments. See example.
-
URL:
-
URL arguments:
-
None
-
POST arguments (required unless marked optional):
-
slicer_name
: the name of the report. project_name
: the name of the project.token
: the authorization token (see Authentication).split_by
: an array of the key fields to split data by in the form of ["key_field1",...].include_mappings
(optional):defines whether key field value mappings are returned by the API request. The default value is 1 (mappings are returned) if only 1 key field is used in thesplit_by
POST argument. The default value is 0 (mappings are not returned) if 2 or more key fields are used in the split_by POST argument.include_total
(optional): defines whether to display Total values in the exported file. Possible values: (0 - don't display Total values in the exported file, 1 - display**Total** values in the exported file). The default value is 0.start_date
:the start of the date range to gather data for. Supported formats:
end_date
: the end of the date range to gather data for. Supported formats:
timezone
(optional):time zone UTC offset in hours. Format: N, where N- any integer in the range of -12 \<= N \<= +12.export_format
:target file format:xlsx
,csv
, ortsv
.filters
(optional): an array with the following structure:
data_filters
(optional): an array with the following structure:
filter_template
(optional): a string template defining priorities for filters specified in thefilters
POST argument. Can contain the following elements:
data_filter_template
(optional): a string template defining priorities for filters specified in thedata\_filters
POST argument. Can contain the following elements:
order_by
(optional): defines sorting rules. A single record or an array of records with the following structure:
-
data_fields
(optional): the array of data fields to be returned in the form of [ "data_field1", .... ]. If it is not defined (by default), data fields will not be returned. To receive the details of all data fields available for your particular report use the info method. -
Output:
status
: the status of the request.success
, if the request was processed successfully, or error code, if any error occurred. If the status is notsuccess
, then the response contains thestatus
andreason
fields only. Possible values:success
: the request was processed successfully.bad_request
: invalid request parameters, please see the reason field for more details.timeout
: the request took too long to complete.access_error
: the user doesn't have access to the specified project/slicer, or a wrong token was used.internal_error
: the request failed due to an unknown problem.
reason
: user-friendly description of the occurred error. This field is displayed for failed requests only.-
Depending on the specified value of the
export_format
POST argument: -
xlsx
file with exported report data (column headers and data rows). Maximum 1048570 matching data rows are exported. -
csv
file with exported report data (column headers and data rows). Maximum 1000000 matching data rows are exported. If the total number of data rows to be exported exceeds 1000000, then the Others data row is added: the summary of data rows beyond 1000000. -
tsv
file with exported report data (column headers and data rows). The escape character is "". Maximum 1000000 matching data rows are exported. If the total number of data rows to be exported exceeds 1000000, then the Others data row is added: the summary of data rows beyond 1000000.
Example¶
Purpose: Export to CSVa Report on all Campaigns, containing the "100" string, displayed in California and Texas to users of the Opera internet browser for the period from March 01, 2012 to March 03, 2012.
Path:
https://uslicer.iponweb.com/API/v2/export
POST Arguments:
{
"slicer_name": "Traffic Demo",
"project_name": "demo",
"token": "<token>",
"split_by": "campaign_id",
"start_date": "2012-03-01",
"end_date": "2012-03-03",
"export_format": "csv",
"filters" : [
{
"name": "geo_region",
"value": [
"California", "Texas"
],
"match": "equals",
"case_insensitive":1,
"search_mappings":1
},
{
"name": "campaign_id",
"value": [
"100"
],
"match": "contains"
},
{
"name" : "browser",
"value": [
"Opera"
],
"match" : "equals",
"case_insensitive":1,
"search_mappings":1
}
],
"data_fields" : [
"imps",
"bids",
"clicks",
"ctr",
"custom_column_8565"
]
}
Command:
curl --data '{ "slicer_name": "Traffic Demo", "project_name": "demo", "token": "<token>", "split_by": "campaign_id","start_date": "2012-03-01","end_date": "2012-03-03", "export_format": "csv","filters": [{"name": "geo_region", "value":["California", "Texas"],"match": "equals", "case_insensitive":1,"search_mappings":1}, {"name": "campaign_id","value" :["100"],"match": "contains"}, {"name": "browser", "value":["Opera"], "match": "equals", "case_insensitive":1,"search_mappings":1}], "data_fields":["imps","bids","clicks","ctr","custom_column_8565"]}' -H "Content-Type: application/json" "https://uslicer.iponweb.com/API/v2/export"
Response:
"Campaign ID","Campaign ID Name","Impressions","Bids","Clicks","CTR","country"
"10056","",32,0,0,0,0
"10065","",1018,25280,1,0.098,0
"10072","",951,17125,0,0,0