export
POST /API/v2/export
Request body¶
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 thesplit_by
POST argument.include_total
(optional): defines whether to displayTotal
values in the exported file. Possible values: (0 - don't displayTotal
values in the exported file, 1 - displayTotal
values in the exported file). The default value is 0.-
start_date
,end_date
: the start/end of the date range to gather data for. Supported formats:- Absolute dates: YYYY-MM-DD.
-
Relative dates:
- today, yesterday
- - N d and - N days for the number of days since the current date, where N - any positive integer or zero.
- - N m and - N months for the number of months since the current date, where N - any positive integer or zero.
- - N m_first, - N months_first, - N m_last, and - N months_last for the first and the last day of the specified month correspondingly, where N - any positive integer or zero.
- -N d_m_first, where N - any positive integer. The first day of the month matches the following date:
current date
+ N days. Examples for the current date of 2021-10-12:
Template Resulting start_date -15d_m_first
2021-09-01 0d_m_first
2021-10-01 15d_m_first
2021-10-01 -100d_m_first
2021-07-01 30d_m_first
2021-11-01
-
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:- "
name
": "key_field
", - "
case_insensitive
": (optional), defines whether search should becase-insensitive
. Possible values: (1 -case-insensitive
, 0 -case-sensitive
). The default value is 0. - "
search_mappings
": (optional), defines whether the search should be performed inmappings
. Possible values: (1 - search should be performed in bothkey field values
and theirmappings
, 0 - search should be performed inkey field values
only). The default value is 0. - "
value
": ["value1
", ... ], - "
match
": "equals|not equals|contains|not contains|beginswith|endswith|not beginswith|not endswith"
where the value of the "
value
" field should be an array.If "
search_mappings
" is set to 1, the search will be performed for both specified key field values and their mappings (descriptions). For example, if you have thecreative_id
key field with some value of "1
" and its mapping of "First Creative
", you can search for it as follows:{"name": "creative_id", "value": ["First Creative"],"match":"equals", "search_mappings": 1}
OR
{"name": "creative_id", "value": [1],"match": "equals"}
Search results will be fully identical.
You can even use a partial matching, like {"name":"creative_id","value": ["Creative"],"match":" contains", "search_mappings": 1}, but please note that if you use a too short search string (1 - 2 characters long), it may take significant time to look up all matching records.
- "
-
data_filters
(optional): an array with the following structure:- "
name
": "data_field", - "
value
": "value1", - "
match
": "<|>|<=|>=”
where the "
value
" field is just one value. The "match" can be "<" for less than value, ">" for greater than value, "<=" for less than or equal to value, or ">=" for greater than or equal to value.If a
data_field
is in percent format, itsvalue
should also be divided by one hundred (30% becomes 0.3). Note, that this behavior is different in API and UI. - "
-
filter_template
(optional): a string template defining priorities for filters specified in thefilters
POST argument. Can contain the following elements:- opening/closing parentheses
- OR/AND operators
- "x" character as a placeholder for filters
Example: "x OR (x AND x)".
Filters from the
filters
POST argument in the specified order are substituted instead of x. -
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:- "
name
": "field", the name of the key or data field to sort the results by. Note that this field can be any key field, specified in thesplit_by
POST argument, or one of the data fields specified by thedata_fields
POST argument (or any of the data fields if thedata_fields
POST argument is not specified). The default value is the first column with enabled percent. - "
mapping
": defines whether to sort bykey field ID
or bykey field mapping
. Possible values: (0 - sort bykey field ID
, 1 - sort bykey field mapping
). The default value is 0. - "
direction
": sort in the ascending or descending order, eitherASC
orDESC
. The default value isDESC
.
- "
-
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.
Response¶
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 thereason
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¶
Export to CSV a 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
Request
{
"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"
]
}
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