Line 2: Line 2:
 
Starling API works on javascript web-tokens. The default validity for the tokens is 1 year. It will be changed to shorter duration soon.  
 
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 ==
 
==Obtaining the token ==
===Request===
 
<syntaxhighlight>
 
POST /api/authenticate HTTP/1.1
 
Host: starling.exploreembedded.com
 
description: If email and password are sent in the post body,
 
the API returns a token as below
 
</syntaxhighlight>
 
 
{| class="wikitable"
 
{| class="wikitable"
 
|-
 
|-
Line 18: Line 12:
 
|| token
 
|| token
 
||Pass email and password as body parameter to obtain a web token
 
||Pass email and password as body parameter to obtain a web token
|-
 
 
 
|}
 
|}
  
===Response===
+
===Example===
 
+
[[File:Obtain token.PNG|x400px]]
  
 
<syntaxhighlight lang="javascript">
 
<syntaxhighlight lang="javascript">

Revision as of 17:15, 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

Obtain token.PNG

[
  {
    "id": "4",
    "user_id": "2",
    "name": "EE unit 4",
    "product_id": "STAR0004",
    "location": "",
    "configuration":{
      "lines":"2" ,
      "brightness":"100",
      "current_message":"hello world",
      "scroll_speed":"6",
      "font":"arial"
    },
    "created_at": "2015-12-28 14:27:07",
    "updated_at": "2015-12-28 14:27:07"
  }
]