Export API

Export API allows you to access results of your analyses programatically.

Client libraries

Authentification

Authentification is done via project secret that can be found at your project overview page. Add header X-Infinario-Secret with the value of the secret for your project to the request.

X-Infinario-Secret: 1234abcd-abcd-1234-1234-abcde12345

HTTP access

POST /analytics/ HTTPS/1.1
Host: api.exponea.com
Content-Type: application/json
{
    "analysis_id": "541840bcf551f445c580bf73",
    "timezone": "UTC",
    "execution_time": 1412770233,
    "format": "native-json"
}
  • analysis_idrequired – unique identifier of analysis that you want to fetch.
  • timezoneoptional (default: UTC) – your local timezone that will be taken into consideration while calculating the analysis.
  • execution_timeoptional (default: actual unix timestamp) – unix timestamp of time at which you would like to evaluate the analysis.
  • formatoptional (default: “native-json”) – format of output. Supported values: “native-json”, “table-json”, “csv”.

Example

POST /analytics/funnel?company=2f86608f-24f5-11e3-9950-c48508494cf5 HTTPS/1.1

Exporting funnels

POST /analytics/funnel HTTPS/1.1

Example result

{
    "success": true,
    "name": "Conversion funnel",
    "steps": ["First visit", "Registration", "First log in", "Purchase", "Payment"],
    "total": {
        "counts": [48632, 24120, 20398, 1256, 1250],
        "times": [-1, 680, 4502, 45, 540, 300],
        "metric": 1987562
    },
    "drill_down": {
        "type": "none",
        "series": []
    },
    "metric": {
        "step": 4,
        "property": "price"
    }
}
  • success – wether everything went alright
  • name – name of analysis
  • steps – array that consist of funnel’s step’s names
  • total – basic serie of funnel data with following format:
    • counts – array that contains number of customers that reached the given step. Indices of the array matches indices of steps array
    • times – array that contains average number of seconds that took customer to reach given step from previous step. In case that the duration is unknown the value is -1. E.g. first value is always -1 since there is no previous step.
    • metricoptional – in case that you have saved your funnel with summarized metric this field will contain the metric result.
  • drill_down
    • type – type of used drill down. Possible values: none – no drill down at all, customer – by customer property, step – by step of funnel
    • propertyoptional – present if drill down type is not none. Tells by which property was drill down performed.
    • stepoptional – present if drill down type is step. Tells by which step index (indexed from 0) was drill down performed.
    • series – calculated drill down data. Array of series. The structure of serie is the same as in total serie. Additionally it contains drilled down value under key with name key.

Exporting reports

POST /analytics/report HTTPS/1.1

Example result

{
    "success": true,
    "valid": true, 
    "name": "Sales per department",
    "header": ["timestamp", "department=Sport", "department=Indoor", "department=Outdoor"],
    "rows": [{
        "timestamp": 1356998400,
        "department=Sport": 402863,
        "department=Indoor": 102654,
        "department=Outdoor": 569321
    }, {
        "timestamp": 1388534400,
        "department=Sport": 202598,
        "department=Indoor": 84126,
        "department=Outdoor": 653987
    }]
}
  • success – wether everything went alright
  • valid – wether result of report is valid. Report is invalid when there are too many values for columns or rows.
  • name – name of analysis
  • header – array of column names
  • rows – array of rows where row is a dictionary with key equal to column name and value equal to calculated value

Exporting retentions

POST /analytics/retention HTTPS/1.1

Example result

{
    "success": true,
    "name": "Payment retention",
    "rows": [{
        "date": 1410220800, 
        "initial_step": 0, 
        "cells": [0, 0, 0, 0, 0, 0, 0, 0]
    }, {
        "date": 1410307200, 
        "initial_step": 0, 
        "cells": [0, 0, 0, 0, 0, 0, 0, 0]
    }]
}
  • success – wether everything went alright
  • name – name of analysis
  • rows – array of rows from retention chart. Each row has following structure:
    • date – unix timestamp of the day on which row begins
    • initial_step – number of customers that have made the initial step on time period
    • cells – array of number of customers that have returned on Nth period after date where N is index of array starting from 0.

Exporting segmentations

POST /analytics/segmentation HTTPS/1.1

Example result

{
    "success": true,
    "name": "Types of customers",
    "segments": [{
        "name": "Payers",
        "count": 450,
        "profile": {
            "Customer count": 450
        }
    }, {
        "name": "Non payers",
        "count": 1560,
        "profile": {
            "Customer count": 1560
        }
    }]
}
  • success – wether everything went alright
  • name – name of analysis
  • segments – array of segments with following format:
    • name – name of segment
    • count – number of customers that belongs to segment
    • profile – dictionary of profile metrics where key is name of metric and value is calculated value. It additionally contains key with name Customer count that is the same value as count

 

  • FAQ:¬†
    • If error 403/401 occurs, there is a problem with authentication and therefore you should make sure you have set the authentication header
    • If not using app.exponea.com instance, you should use hostname of instance you are using

 

Updated on October 3, 2017

Was this article helpful?

Related Articles