Token Request
Ationet API have a two step token request.
Request:
Type:
POST
URL:
https://api.ationet.com/Token
Body:
grant_type=passwor&username=USER@MAIL&password=PASSWORD
Response:
Content:
JSON
access_token : "HQD_Yzu2Z9FSnWDHApwxmOl2JaPVTFvmNyaOAwk1G-xpBI3JvaMX6ehz0ny2bMVTSBOB..."
token_type : "bearer"
userName : "USER@MAIL"
entities : "[{"Id":"xxxxxxxx-xxxx...","Name":"NAME","Type":"Network"},{"Id":"xxxxxxxx-xxxx...","Name":"NAME","Type":"Company"}]"
.issued : "Thu, 04 Sep 2014 14:27:56 GMT"
.expires : "Thu, 04 Sep 2014 14:27:56 GMT"
The response will contain the list of entities related to the user. To complete the token request you must send the desired entity to log to.
Request:
Type:
POST
URL:
https://api.ationet.com/Token
Body:
grant_type=password&username=USER@MAIL&password=PASSWORD&entity={"Id":"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx","Name":"NAME","Type":"Network"}
Response:
Content:
JSON
access_token : "0uwYUw1fOl2aWI7vr4684dfsdHG687FSdf674SDs2HNUyFJDfq71_cu8eTY-r7EfcVEHmV..."
token_type : "bearer"
expires_in : 1209599
userName : "USER@MAIL"
.issued : "Thu, 04 Sep 2014 14:28:41 GMT"
.expires : "Thu, 18 Sep 2014 14:28:41 GMT"
The response will now contain a valid token.
Note: You can skip the first step if you already know the entity.
Using the token
In order to use Ationet API you must send a valid token in each request as a header.
Authorization: Bearer 0uwYUw1fOl2aWI7vr4684dfsdHG687FSdf674SDs2HNUyFJDfq71_cu8eTY-r7EfcVEHmV...