Authentication

 

Using your credentials

When querying the API with an external script, you have to provide your login details using a “Basic authentication”, encoded using base64 in the headers of the calls, using the following format: email@email.com:password

Here’s the encoded version: ZW1haWxAZW1haWwuY29tOnBhc3N3b3Jk

Here’s the information to be passed in the API call header:

"Authorization: Basic ZW1haWxAZW1haWwuY29tOnBhc3N3b3Jk"

 

Using an API account

If you don’t have an AT Internet user account, you can still query the API by requesting an API account to the administrator.

Admins have the capacity to create API feeds with a specific parameter in the URL (&apikey=) to allow the connection.

Here’s an example:

https://apirest.atinternet-solutions.com/data/v2/json/getData?&columns={d_source,m_visits}&sort={-m_visits}&space={s:#YourSiteID#}&period={R:{D:'-1'}}&max-results=50&page-num=1&apikey=6f8277f0-4d62-4fb6-ae85-c2c158399dc6

 

Using an API-key (SSO organisations)

If your organisation is using SSO, API URLs in Data Query and Data Flow will change from  https://apirest.atinternet-solutions.com to https://api.atinternet.io. This new endpoint cannot handle basic authentication described earlier, it requires the use of an API-key you can create in your profile page under the API-Key section. Please note the API-key will only be displayed once in our solutions for security reasons. This API-key can be used as a query string or as a request header.

Here’s a query string example:

https://api.atinternet.io/data/v2/json/getData?columns={m_visits}&sort={-m_visits}&space={s:123456}&period={D:{start:'2018-08-26',end:'2018-08-26'}}&max-results=20&page-num=1&api-key=e8005ef09a17_039a21e785851e51111111111130cf3157*****

Here’s a request header example:

  • https://api.atinternet.io/data/v2/json/getData?columns={m_visits}&sort={-m_visits}&space={s:123456}&period={D:{start:'2018-08-26',end:'2018-08-26'}}&max-results=20&page-num=1
  • x-api-key: e8005ef09a17_039a21e785851e51111111111130cf3157*****
Was this post helpful?
Yes
No
Last update: 14/01/2019