Line 15: Line 15:
  
 
===Example with CURL===
 
===Example with CURL===
 +
* Request
 
<syntaxhighlight lang="javascript">
 
<syntaxhighlight lang="javascript">
 
curl -X POST -F "email=your@email.com" -F "password=password" \  
 
curl -X POST -F "email=your@email.com" -F "password=password" \  
 
'http://starling.exploreembedded.com/api/authenticate'
 
'http://starling.exploreembedded.com/api/authenticate'
 
</syntaxhighlight>
 
</syntaxhighlight>
 +
*Response
 
<syntaxhighlight lang="javascript">
 
<syntaxhighlight lang="javascript">
 
{"token":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXUyJ9.eyJzdWIiOiIyIiwiaXNzIjoiaHR0c
 
{"token":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXUyJ9.eyJzdWIiOiIyIiwiaXNzIjoiaHR0c

Revision as of 17:34, 31 December 2015

Authentication

Starling API works on javascript web-tokens. The default validity for the tokens is 1 year. It will be changed to shorter duration soon.

Base URL for all requests: http://starling.exploreembedded.com

Obtaining the token

http verb Request Response Description
POST /api/authenticate token Pass email and password as body parameter to obtain a web token

Example with CURL

  • Request
curl -X POST -F "email=your@email.com" -F "password=password" \ 
'http://starling.exploreembedded.com/api/authenticate'
  • Response
{"token":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXUyJ9.eyJzdWIiOiIyIiwiaXNzIjoiaHR0c
DpcL1wvc3RhcmxpbmcuZXhwbG9yZWVtYmVkasdfdsfNvbVwvYXBpXC9hdXRoZW50.
iwiZXhwIjoiMTQsdfeaeSEFEA0NiIsIm5iZiI6IjE0NTE1NjMwNDYiLCJqdGkiOiI4asdfew}
example with postman