token/create

Creates access and refresh tokens by payload.

Authorization

Access JSON Web Token (ManageToken)

Available actions are listed here.

Request Topic and Payload

Topic

dh/request

Payload Representation

{
    "action": {string},
    "requestId": {object},
    "payload": {
        "userId": {object},
        "actions": {array},
        "networkIds": {array},
        "deviceTypeIds": {array},
        "expiration": {datetime}
    }
}

Payload Parameters

Property Name

Required

Type

Description

action

Yes

string

Action name: token/create

requestId

No

object

Request unique identifier, will be passed back in the response message.

payload

Yes

object

User payload with specific permissions

payload.userId

Yes

integer

User identifier.

payload.actions

No

array

A collection of allowed actions. Available values:

  • GetNetwork: get information about network
  • GetDevice: get information about device and device class
  • GetDeviceNotification: get or subscribe to device notifications
  • GetDeviceCommand: get or subscribe to commands sent to device
  • RegisterDevice: register a device
  • CreateDeviceNotification: post notifications on behalf of device
  • CreateDeviceCommand: post commands to device
  • UpdateDeviceCommand: update status of commands on behalf of device
  • GetCurrentUser: get current user info
  • UpdateCurrentUser: update current user
  • ManageUser: admin permission for managing all users
  • ManageConfiguration: admin permission for managing server configuration
  • ManageNetwork: admin permission for managing all networks and its devices
  • ManageToken: admin permission for creating tokens

payload.networkIds

No

array

A collection of identifiers of allowed networks. Only API requests for devices within the allowed networks will be authorized with this permission. Set to null to allow callees to access all networks permitted for the owner user.

payload.deviceTypeIds

No

array

A collection of unique identifiers of allowed device types. Only API requests for allowed device types will be authorized with this permission. Set to null to allow callees to access all devices permitted for the owner user.

payload.expiration

No

datetime

Expiration date (UTC).

Response Topic and Payload

Topic

dh/response/[email protected]{clientId}

Payload Representation

{
    "action": {string},
    "status": {string},
    "requestId": {object},
    "accessToken": {string},
    "refreshToken": {string}
}

Payload Parameters

Property Name

Type

Description

action

string

Action name: token

status

string

Operation execution status (success or error).

requestId

object

Request unique identifier as specified in the request message.

accessToken

string

JSON Web Token for authorization.

refreshToken

string

JSON Web Token for refreshing access token.