Line 18: Line 18:
  
 
====Curl Request====
 
====Curl Request====
<syntaxhighlight>
+
<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>
 +
 
====Curl Response====
 
====Curl Response====
 
<syntaxhighlight lang="javascript">
 
<syntaxhighlight lang="javascript">

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

Curl Request

curl -X POST -F "email=your@email.com" -F "password=password" \ 
'http://starling.exploreembedded.com/api/authenticate'

Curl Response

{"token":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXUyJ9.eyJzdWIiOiIyIiwiaXNzIjoiaHR0cDpcL1wvc3RhcmxpbmcuZXhwbG9yZWVtYmVkasdfdsfNvbVwvYXBpXC9hdXRoZW50aWNhdGUiLCJpYXQiOiIxNDUxNTYzMDQ2IiwiZXhwIjoiMTQsdfeaeSEFEA0NiIsIm5iZiI6IjE0NTE1NjMwNDYiLCJqdGkiOiI4NjVkYTc3N2JlMjMxOWY1YmU2NzAyYzdiYTgzZmVmNSJ9.Zjg3MDhjZjU5YjI1ZDE3MTE0ZWZiZjY0ZmM2MzM1OGYzMmFmNmZhYWFhZjc1ZjA5NDNjYTQyODRmOWFjOGRhYw"}

Curl Response

example with postman
[
  {
    "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"
  }
]