HTTP Token Create


Required Fields


paths
A JSON Object of Paths to Permissions. This represents the Paths (and hence, Flows) within a namespace that can be accessed by the Token.

The values of this map are "Permissions", which is a JSON Object:

dropRead (boolean): Drops can be read from Flows with this path and all child Flows
dropWrite (boolean): Drops can be written to Flows with this path and all child Flows

Optional Fields


duration
The length of time the share will be active (in milliseconds), after which it will expire. If unspecified, the token will never expire

POST https://api.flowthings.io/v0.1/<account_id>/token/

Creates a new Token object

Request


Headers

NameDescription
Content-Typeapplication/json
X-Auth-TokenAuthentication Token

Example

{
  "paths": {
    "/alice/homesecurity/thermostat": {
      "dropRead": true,
      "dropWrite": true
    },
    "/alice/homesecurity/reports": {
      "dropRead": false,
      "dropWrite": true
    }
   },
   "duration": 60000
}

Response


HTTP Codes

CodeDescription
201Resource Created
400Bad Request
401Unauthorized
503Service Unavailable

Example Response Body

{
  "head": {
    "status": 201,
    "ok": true,
    "messages": [
      "Your request has been processed successfully. A new resource has been created."
    ],
    "errors": []
  },
  "body": {
    "id": "k548b20f2d4c63c0634ad3cc8",
    "creationDate": 1409455732680,
    "tokenString": "SSOjDZ4VMHS2JcwT1sIpE8x91QfG",
    "paths": {
      "/alice/homesecurity/thermostat": {
        "dropRead": true,
        "dropWrite": true
      },
      "/alice/homesecurity/reports": {
        "dropRead": false,
        "dropWrite": true
      }
     },
     "duration": 60000,
     "expiresInMs": 45831
  }
}