Developers » Data API » Rest API » Getting started » How does it work?
How does it work?
The Rest API is based on Rest URLs that are used to retrieve the data of your choice. In order to correctly extract the data you need, certain parameters must be entered. There are two different types of parameters possible, compulsory or optional:
Compulsory parameters
Parameter | Description | Example |
---|---|---|
space | Analysis space (site, level 2, multi-sites) | &space={s:123456} |
period | Analysis period (single, multiple, relative) | &period={D:2016-12-25} |
columns | List of dimensions/metrics to retrieve (separated by a comma in the call) | &columns={d_page,m_visits} |
Optional parameters
Parameter | Value type | Description | Example |
---|---|---|---|
sort | Character string | List of dimensions/metrics according to which the results will be sorted | &sort={-m_visits} |
filter | Character string | Filters to be applied | &filter={d_page:{$eq:’home’}} |
page-num | Numeric | Page number of the result set | &page-num=2 |
max-results | Numeric | Number of results in the results page | &max-results=500 |
sep | « comma » or « dot » | Decimal separator (dot by default) | &sep=comma |
lng | Character string | Language of results | &lng=fr |
code | Character string | Shortcode of the Data Query template | &code=2fHeCJ |
segment | ID | Segment applied to the result set | &segment=10000018 |
segmentdesc | Date (as per the “period“) | To define the cohort period when using a visitor-based segment | &segmentdesc={period:{D:2017-03-02} |
include | Character string | To obtain complementary information (metadata, total, etc.) | &include={context} |
evo | Character string | To obtain the evolution of a group of metrics over a certain time period | &evo={M,p1} |
Example:
https://apirest.atinternet-solutions.com/data/v2/GetData?&period={D:2016-06-31}&space={s:123456}&columns={d_page,m_visits}&filter={d_page:{$eq:'home'}}&sort={m_visits}&page-num=2&max-results=10&sep=comma&lng=fr
This call will retrieve 10 results from page 2 (from the 11th to the 20th result) for the Pages dimension (d_page) with the Visits metric (m_visits) for site 123456 on 31 June 2016.
The results are filtered by page label (must be set to home) and sorted by increasing number of visits. They are presented in French and contain a comma as a decimal separator.
Last update: 27/12/2019