Commands

Sending commands to devices and stored commands management.

The Commands Model

A command is represented by the following schema:

Scheme

  • Name
    id
    Type
    integer
    Description
  • Name
    deviceId
    Type
    integer
    Description
  • Name
    description
    Type
    string
    Description
  • Name
    type
    Type
    string
    Description
  • Name
    attributes
    Type
    object
    Description

Command type is represented by the following schema:

Scheme

  • Name
    type
    Type
    string
    Description

GET/commands

Retrieve a list of saved commands

Without any params, returns a list of saved commands the user has access to

Authorizations

BasicAuth or ApiKey

  • Name
    BasicAuth
    Type
    scheme
    Description
    HTTP Authorization Scheme: basic
  • Name
    ApiKey
    Type
    scheme
    Description
    HTTP Authorization Scheme: bearer

Query Parameters

  • Name
    all
    Type
    boolean
    Description
    Can only be used by administrators or managers to retrieve all objects.
  • Name
    userId
    Type
    integer
    Description
    Standard users can use this only with their own userId
  • Name
    deviceId
    Type
    integer
    Description
    Standard users can use this only with deviceIds they have access to
  • Name
    groupId
    Type
    integer
    Description
    Standard users can use this only with groupIds they have access to
  • Name
    refresh
    Type
    boolean
    Description
  • Name
    limit
    Type
    integer
    Description
    Limit the number of returned results
  • Name
    offset
    Type
    integer
    Description
    Offset for pagination
  • Name
    keyword
    Type
    string
    Description
    Search keyword filter

Responses

  • Name
    200
    Type
    success
    Description
  • Name
    application/json
    Type
    response schema
    Description
  • Array of Command

Request

GET
/commands
curl --location 'https://gw.onemap8.com/api/commands?all=%3Cboolean%3E&userId=%3Cinteger%3E&deviceId=%3Cinteger%3E&groupId=%3Cinteger%3E&refresh=%3Cboolean%3E' \
--header 'Accept: application/json' \
--header 'Authorization: Basic {your_access_token}'

Response

[
{
  "id": 0,
  "deviceId": 0,
  "description": "string",
  "type": "string",
  "attributes": {}
},
{
  ...
}
]

POST/commands

Create a saved command

Authorizations

BasicAuth or ApiKey

  • Name
    BasicAuth
    Type
    scheme
    Description
    HTTP Authorization Scheme: basic
  • Name
    ApiKey
    Type
    scheme
    Description
    HTTP Authorization Scheme: bearer

Request body schema

  • Name
    application/json
    Type
    schema required
    Description

Body schema

  • Name
    id
    Type
    integer
    Description
  • Name
    deviceId
    Type
    integer
    Description
  • Name
    description
    Type
    string
    Description
  • Name
    type
    Type
    string
    Description
  • Name
    attributes
    Type
    object
    Description

Responses

  • Name
    200
    Type
    success
    Description
  • Name
    application/json
    Type
    response schema
    Description
  • Command

Request

POST
/commands
curl --location 'https://gw.onemap8.com/api/commands' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'Authorization: Basic {your_access_token}' \
--data '{
"id": "<integer>",
"deviceId": "<integer>",
"description": "<string>",
"type": "<string>",
"attributes": {}
}'

Response

{
"id": 0,
"deviceId": 0,
"description": "string",
"type": "string",
"attributes": {}
}

PUT/commands/{id}

Update a saved command

Authorizations

BasicAuth or ApiKey

  • Name
    BasicAuth
    Type
    scheme
    Description
    HTTP Authorization Scheme: basic
  • Name
    ApiKey
    Type
    scheme
    Description
    HTTP Authorization Scheme: bearer

Path parameters

  • Name
    id
    Type
    integer required
    Description

Request body schema

  • Name
    application/json
    Type
    schema required
    Description

Body schema

  • Name
    id
    Type
    integer
    Description
  • Name
    deviceId
    Type
    integer
    Description
  • Name
    description
    Type
    string
    Description
  • Name
    type
    Type
    string
    Description
  • Name
    attributes
    Type
    object
    Description

Responses

  • Name
    application/json
    Type
    response schema
    Description
  • Name
    200
    Type
    success
    Description
    Command

Request

PUT
/commands/{id}
curl --location --request PUT 'https://gw.onemap8.com/api/commands/<integer>' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'Authorization: Basic {your_access_token}' \
--data '{
"id": "<integer>",
"deviceId": "<integer>",
"description": "<string>",
"type": "<string>",
"attributes": {}
}'

Response

{
"id": 0,
"deviceId": 0,
"description": "string",
"type": "string",
"attributes": {}
}

DELETE/commands/{id}

Delete a saved command

Authorizations

BasicAuth or ApiKey

  • Name
    BasicAuth
    Type
    scheme
    Description
    HTTP Authorization Scheme: basic
  • Name
    ApiKey
    Type
    scheme
    Description
    HTTP Authorization Scheme: bearer

Path parameters

  • Name
    id
    Type
    integer required
    Description

Responses

  • Name
    204
    Type
    success
    Description
    No content

Request

DELETE
/commands/{id}
curl --location --request DELETE 'https://gw.onemap8.com/api/commands/<integer>' \
--header 'Authorization: Basic {your_access_token}'

Response

No content

GET/commands/send

Retrieve a list of saved commands supported by selected device

Authorizations

BasicAuth or ApiKey

  • Name
    BasicAuth
    Type
    scheme
    Description
    HTTP Authorization Scheme: basic
  • Name
    ApiKey
    Type
    scheme
    Description
    HTTP Authorization Scheme: bearer

Query parameters

  • Name
    deviceId
    Type
    integer
    Description
    Standard users can use this only with deviceIds they have access to.

Responses

  • Name
    200
    Type
    success
    Description
  • Name
    application/json
    Type
    response schema
    Description
  • Array of Command

  • Name
    400
    Type
    error
    Description
    No permission

Request

GET
/commands/send
curl --location 'https://gw.onemap8.com/api/commands/send?deviceId=%3Cinteger%3E' \
--header 'Accept: application/json' \
--header 'Authorization: Basic {your_access_token}'

Response

[
{
  "id": 0,
  "deviceId": 0,
  "description": "string",
  "type": "string",
  "attributes": {}
},
{
  ...
}
]

POST/commands/send

Dispatch command to device

Authorizations

BasicAuth or ApiKey

  • Name
    BasicAuth
    Type
    scheme
    Description
    HTTP Authorization Scheme: basic
  • Name
    ApiKey
    Type
    scheme
    Description
    HTTP Authorization Scheme: bearer

Request body schema

  • Name
    application/json
    Type
    schema required
    Description

Body schema

  • Name
    id
    Type
    integer
    Description
  • Name
    deviceId
    Type
    integer
    Description
  • Name
    description
    Type
    string
    Description
  • Name
    type
    Type
    string
    Description
  • Name
    attributes
    Type
    object
    Description

Responses

  • Name
    200
    Type
    success - sent
    Description
  • Name
    application/json
    Type
    response schema
    Description
  • Command

  • Name
    204
    Type
    success - queued
    Description
  • Name
    application/json
    Type
    response schema
    Description
  • Command

  • Name
    400
    Type
    error
    Description
    No permission / malformed request

Request

POST
/commands/send
curl --location 'https://gw.onemap8.com/api/commands/send' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'Authorization: Basic {your_access_token}' \
--data '{
"id": "<integer>",
"deviceId": "<integer>",
"description": "<string>",
"type": "<string>",
"attributes": {}
}'

Response

{
"id": 0,
"deviceId": 0,
"description": "string",
"type": "string",
"attributes": {}
}

GET/commands/types

Retrieve a list of available command Types for the Devices or all possible Command types if Devices ommited

Authorizations

BasicAuth or ApiKey

  • Name
    BasicAuth
    Type
    scheme
    Description
    HTTP Authorization Scheme: basic
  • Name
    ApiKey
    Type
    scheme
    Description
    HTTP Authorization Scheme: bearer

Query parameters

  • Name
    deviceId
    Type
    integer
    Description
    Internal device identifier. Only works if device has already reported some locations
  • Name
    protocol
    Type
    string
    Description
    Protocol name. Can be used instead of device id
  • Name
    textChannel
    Type
    boolean
    Description
    When true return SMS commands. If not specified or false return data commands

Responses

  • Name
    200
    Type
    success
    Description
  • Name
    application/json
    Type
    response schema
    Description
  • Array of Command type

  • Name
    400
    Type
    error
    Description
    No permission

Request

GET
/commands/types
curl --location 'https://gw.onemap8.com/api/commands/types?deviceId=%3Cinteger%3E&protocol=%3Cstring%3E&textChannel=%3Cboolean%3E' \
--header 'Accept: application/json' \
--header 'Authorization: Basic {your_access_token}'

Response

[
{
  "type": "string",
},
{
  ...
}
]
GET/commands/{id}

Fetch a Saved Command

Authorizations

BasicAuth or ApiKey

  • Name
    BasicAuth
    Type
    scheme
    Description
    HTTP Authorization Scheme: basic
  • Name
    ApiKey
    Type
    scheme
    Description
    HTTP Authorization Scheme: bearer

Path parameters

  • Name
    id
    Type
    integer required
    Description

Response schema

  • Name
    application/json
    Type
    schema
    Description

Responses

  • Name
    200
    Type
    success
    Description
    Command
  • Name
    401
    Type
    error
    Description
    Unauthorized
  • Name
    404
    Type
    error
    Description
    Not found

Request

GET
/commands/{id}
curl --location 'https://gw.onemap8.com/api/commands/<integer>' \
--header 'Accept: application/json' \
--header 'Authorization: Basic {your_access_token}'

Response

{
"id": 0,
"deviceId": 0,
"description": "<string>",
"type": "<string>",
"textChannel": true,
"attributes": {}
}