Skip to content
This repository was archived by the owner on May 5, 2026. It is now read-only.

Make your first API call

Benjamin Diolez edited this page May 5, 2026 · 1 revision

Data API / Reporting API v3 / Getting started / Make your first API call

Basic example

You can find in this table the explanation of the main parameters. If you want more information, you can find them in the corresponding articles in the documentation in the category Parameters.

PARAMETER REQUIRED DESCRIPTION
space true Analysis scope (single site or multi-sites).
columns true List of properties & metrics to query (separated by a comma).
period true Analysis period (single, multiple, relative).
filter false Filters to be applied on properties/metrics.
evo false To obtain the evolution of a group of metrics over a certain time period.
sort true List of properties / metrics according to which the results will be sorted.
max-results true Number of results in the results page.
page-num true Page number of the data set.
options false Additionnal parameters ignored_null_properties : Possible value “true” to configure if a line with all properties values to null should not appear in the result eco_mode : Possible value “true” to activate the eco mode

Parameter syntax

PARAMETER SYNTAX
space “space”: { “s”:[547656] }
columns “columns”: [ “visit_device_type”, “m_visits” ]
period “period”: { “p1”: [ { “type”: “D”, “start”: “2019-10-20”, “end”: “2019-10-24” } ] }
filter “filter”: { “metric”: { “m_visits”: { “$eq”: 19 } }, }
evo “evo”: { “granularity”: “D”, “top”: { “max-results”: 5, “page-num”: 1, “sort”: [“-m_visits”] } }
sort-by “sort”: [ “m_visits” ]
max-results “max-results”: 50
page-num “page-num”: 1
options “options”: {“ignore_null_properties”: true, “eco_mode”: true}

You can find below few complete examples to see how it could work.

var data = JSON.stringify({
"columns": [
"device_type",
"m_visits",
"m_users"
],
"sort": [
"-m_visits"
],
"space": {
"s": [429023]
},
"period": {
"p1": [
{
"type": "D",
"start": "2019-10-24",
"end": "2019-10-24"
}
]
},
"max-results": 50,
"page-num": 1
});
var xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener("readystatechange", function () {
if (this.readyState === 4) {
console.log(this.responseText);
}
});
xhr.open("POST", "https://api.atinternet.io/v3/data/getData");
xhr.setRequestHeader("x-api-key", "YOURAPIKEY");
xhr.send(data);
curl -X POST \
https://api.atinternet.io/v3/data/getData \
-H 'x-api-key: YOURAPIKEY' \
-H 'Content-Type: application/json' \
-d '{
"columns": [
"device_type",
"m_visits",
"m_users"
],
"sort": [
"-m_visits"
],
"space": {
"s": [429023]
},
"period": {
"p1": [
{
"type": "D",
"start": "2019-10-24",
"end": "2019-10-24"
}
]
},
"max-results": 50,
"page-num": 1
}'
import http.client
conn = http.client.HTTPSConnection("api.atinternet.io")
payload = '''{
"columns": [
"device_type",
"m_visits",
"m_users"
],
"sort": [
"-m_visits"
],
"space": {
"s": [547656]
},
"period": {
"p1": [
{
"type": "D",
"start": "2019-10-24",
"end": "2019-10-24"
}
]
},
"max-results": 50,
"page-num": 1
}
'''
headers = {
'x-api-key': "YOURAPIKEY",
'Content-type': "application/json"
}
conn.request("POST", "/v3/data/getData", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
request["x-api-key"] = 'YOURAPIKEY'
request.body = "{\n \"columns\": [\n \"device_type\",\n \"m_visits\",\n \"m_users\"\n ],\n \"sort\": [\n \"-m_visits\"\n ],\n\"space\": {\n \"s\": [\n 429023\n ]\n },\n \"period\": {\n \"p1\": [\n {\n \"type\": \"D\",\n \"start\": \"2019-10-24\",\n \"end\": \"2019-10-24\"\n }\n ]\n },\n \"max-results\": 50,\n \"page-num\": 1\n}"
response = http.request(request)
puts response.read_body

Wiki contents

Clone this wiki locally