Skip to content

google_export

Specification

  • Description:
  • Exports report data to Google Drive. Data is restricted by query parameters passed in POST arguments. See example.

  • URL:

  • https://uslicer.iponweb.com/API/v2/google_drive_export

  • 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 the split_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.
  • add_keys : the array of key fields to add. Format: ["key_field1", ... ].
  • email: an array of 1 - 20 email addresses in the form of ["email_address1",...].
  • 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.
  • 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 the filters POST argument. Can contain the following elements:

  • data_filter_template(optional): a string template defining priorities for filters specified in the data_ 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.
  • drive_folder (optional): Any folder in your Google Drive. Could be a shared folder as well. You can also use subfolders, e.g: Folder/SubFolder/SubSubFolder. Might be left empty.
  • drive_file_name: Any filename supported by Google Drive. It is expected that filename ends with .xlsx.
  • can_write : Gives edit rights for users that you share the file with. Possible values: true and false. The default value is true.

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 not success, then the response contains the status and reason fields. 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.
  • Google Sheets file: a file with exported report data (column headers and data rows). Maximum 300000 data rows.

Example

Purpose: Export to Google Sheetsa 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/google_export

POST Arguments:

{
 "slicer_name": "Traffic Demo",
 "project_name": "demo",
 "token": "<token>",
 "split_by": "campaign_id",
 "start_date": "2011-02-16",
 "end_date": "2011-02-18",
 "email": [
    "jsmith@gmail.com"
    ]
 "filters" : [
       {
          "name": "geo_region",
          "value": [
          "California", "Texas"
          ],
          "match": "equals"
       },
       {
          "name": "campaign_id",
          "value": [
             "100"
          ],
          "match": "contains"
       },
       {
          "name" : "browser",
          "value": [
             "Opera"
          ],
          "match" : "equals"
       }
    ]
}

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", "email": ["jsmith@gmail.com"],"filters": [{"name": "geo_region", "value":["California", "Texas"],"match": "equals"}, {"name": "campaign_id","value" :["100"],"match": "contains"}, {"name": "browser", "value":["Opera"], "match": "equals"} ]}' -H "Content-Type: application/json" "https://uslicer.iponweb.com/API/v2/google_drive_export"

Response:

{
"status":"success"
}