Authentication

Provides a mechanism of authentication to this API using JSON Web Tokens.

Methods

Method

Authorization

Uri

Description

login

None

POST /token

Creates and returns access and refresh tokens for the given user.

create

Access JSON Web Token (ManageToken)

POST /token/create

Creates and returns access and refresh tokens for the given user and access rights.

refresh

None

POST /token/refresh

Creates and returns a new access token for the given refresh token.

plugin/create

Access JSON Web Token (ManagePlugin)

POST /token/plugin/create

Creates JWT access and refresh tokens for plugin

plugin/authenticate

None

GET /token/plugin/authenticate

Authenticates a plugin and JWT Plugin payload.

Resource Representation

{
    "userId": {integer},
    "expiration": {datetime},
    "actions": {array},
    "networkIds": {array},
    "deviceIds": {array}
}

Property Name

Type

Description

userId

integer

User identifier.

expiration

datetime

Expiration date (UTC).

actions

array

A collection of allowed actions. Available values:
GetNetwork: get information about network
GetDevice: get information about device and device class
GetDeviceState: get information about current device equipment state
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

networkIds

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.

deviceIds

array

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

Available actions:

JWT tokens contain user-related information and permissions list which could be represented with ids or action names.

Action

String

Id

Any

0

None

null

1

Get Network

GetNetwork

2

Get Device

GetDevice

3

Get Device Notification

GetDeviceNotification

4

Get Device Command

GetDeviceCommand

5

Register Device

RegisterDevice

6

Create Device Command

CreateDeviceCommand

7

Update Device Command

UpdateDeviceCommand

8

Create Device Notification

CreateDeviceNotification

9

Get Current User

GetCurrentUser

10

Update Current User

UpdateCurrentUser

11

Manage User (admin)

ManageUser

12

Manage Configuration (admin)

ManageConfiguration

13

Manage Network (admin)

ManageNetwork

14

Manage Token

ManageToken

15

Manage Plugin

ManagePlugin

16

Get Device Type

GetDeviceType

17

Manage Device Type (admin)

ManageDeviceType

18