Authentification

 

Foreword

An API Key gives the same permissions than the user who created it. If the user loses rights on a site, then he won 't be able to use his API key to get data on this site anymore. If the user gets rights on a new site, then he will be able to use his API key to get data on this site.

The API Key aims at being used with API URLs retrieved from Data Query. If you are an SSO user, you must use an API Key to query AT Internet REST API.

You can create a new API key on your profile page.

An API Key can only be created by an authenticated user who can manipulate data. This user must have at least one of the following roles:

  • Administrators
  • Delegates
  • Advanced Analysts
  • Analysts or Custom Roles with the “Handle data” tool

The API Key is created, enabled, disabled and deleted by each user independently.

API key has to be included in all API requests to the server in a header that looks like the following: x-api-key: YOURAPIKEY

 

Examples

You can authenficate to our API by passing your API Key in the header, here are a few possibilities.

xhr.setRequestHeader("x-api-key", "YOURAPIKEY"); 

curl "https://api.atinternet.io/v3/data/getData"
-H "x-api-key: YOURAPIKEY"

headers = {
    'x-api-key': "YOURAPIKEY",
}

request["x-api-key"] = 'YOURAPIKEY'
request.body = "{\n \"columns\": [\n   \"visit_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