Getting API key

Published on by

Getting API key

Before accessing and making requests using Tallium API, each user must generate API key. API key is used for authorization.

 
  1. Go to /api-doc and click on Public API link that is displayed. This will take you to Public API – Login section.

  2. Click on POST to expand API method for retrieving login information. This will expand the section where are explained formats, parameters and server responses.

  3. Here you can find end point and parameters that can be passed to API. Data can be returned in json, xml or html format.

 

Pre-requisites

 

Parameters

 

Parameter

Required

Type

Description

username

Yes

String

User’s email

password

Yes

String

User’s password

_remember_me

No

String

Saves login

_format

Yes

 

Defines query in XML, JSON or HTML format

 

API key can be retrieved by making request with The Water Network username and password to API end-point /public/api/users/login.{_format}

 

Example request using JSON:

 { "username":example@test.com", "password":"123456" } 
 

Example response:

 { "authorization": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJlbWFCI6ImRqb3JkamUuZ3J1YmFjQHRhbGx5Zm94LmNvbSIsImlkIjoyNjUwNDMsInRpbWUiOjE1MDQxODIxNzR9.dWjJplXqRRR9zPXwGpWfcyvYfaP61RhOFE5JzytqEns", "eid": "6mHqCTbwL1LjLTM9mv3Q" } 
 

Authorization – Authorization is API key which should be included in header requests in the all future request made using API.

eid – user’s unique identifier. It can be used to retrieve information about the user in other APIs.

 

API key can be generated and directly from /api-doc page, by making request in  post--public-api-users-login.{_format}  section, filling in username and password in Sandbox. 

 

Testing API key

After obtaining API key, it can be used for authorizing access to articles. For testing purpose, key can be pasted into api key field on API documentation page:

 

Once when it’s saved, API key will be used in Sandbox. If you are using custom integration, then API key should be included in request headers.

In Sandbox, now you can make request which requires authorization. For example, retrieving logged user’s settings.

You can try making Sandbox request without and with API key to get user’s settings:

/api-doc#get--api-users-settings-global.{_format}

 

Without authorization error 403 forbidden is displayed.

 

With authorization current settings are displayed:

Media