The IOTile Cloud API uses JWT tokens to authenticate, so you have to get the JWT token before any API calls can be called. The following API call can be use to authenticate and get the token.
POST: https://iotile.cloud/api/v1/auth/api-jwt-auth/ BODY: { "username": "email", "password": "string" }
This API call will respond with a token, which you will need to use for all subsequent API calls described in this document. You will add the following to your API
header: 'Authorization': 'JWT ' + _token_you_just_got 'Content-Type': 'application/json'
Example: Curl command to login
$ curl https://iotile.cloud/api/v1/auth/api-jwt-auth/ \ -d username=joe@acme.com -d password=secret { "token":"big.token" } $ curl -X GET https://iotile.cloud/api/v1/account/ -H 'Authorization: JWT big.token' { "count": 1, "next": null, "previous": null, "results": [ { "id": 1, "email": "joe@company.com", "username": "joe", "name": "", "avatar": { "tiny": "...", "thumbnail": "...", "medium": "..." }, "slug": "joe", "is_staff": false } ] }
The API documentation can be found at https://iotile.cloud/api/docs/
Comments
0 comments
Please sign in to leave a comment.