ThingsPro Cloud Server RESTful API Reference API Reference

Welcome to the ThingsPro Cloud Server RESTful API reference. This is a live document of how you can use ThingsPro Cloud Server APIs. The ThingsPro Cloud Server API is organized around the REST methodology, and it uses resource-oriented URLs, and common HTTP response codes to indicate API errors. All requests are authenticated using an mx-api-token which can be obtained from ThingsPro Cloud Server web.

API Endpoint
https://localhost/api/v1
Response Content-Types: application/json
Schemes: http, https
Version: 2.5.0

Authentication

mx-api-token

ThingsPro RESTful API token, The token should be created on web console.

type
apiKey
name
mx-api-token
in
header

device

Cloud Gateway management

GET /devices

The Devices endpoint returns information about the ThingsPro gateway information.

offset: number (integer)
in query

offset

limit: number (integer)
in query

max return devices count (default: 20)

uuid: string
in query

get uuid exactly match device

mac: string
in query

get mac exactly match device

serialNumber: string
in query

get serial number exactly match device

query: string
in query

Query and filter device by keyword, please encode query json object by urlencode, and append it on query parameter please refer definition of FilterDevice to get query object json format limit default is 20 and max is 1000 The search key now support 'uuid, mac, displayName, serialNumber, defaultRoute, softwareVersion' Each search value is wildcard, can just input partial value only

200 OK

An array of gateways

type
object
Response Example (200 OK)
{
  "count": 3,
  "data": [
    {
      "connection": {
        "createdAt": "2017-03-22T08:15:01.359380",
        "deviceUUID": "2ad0fbb8-6f53-46ea-a10a-00b7b75145d3",
        "status": "offline"
      },
      "createdAt": "2017-03-21T03:01:10.175584",
      "description": "Device",
      "displayName": "ThingsPro-changed",
      "mac": "223344FF8F51",
      "iccId": "898600MFSSYYGXXXXXXP",
      "serialNumber": "MOXA00000001",
      "properties": {
        "aliasName": "ThingsPro-changed",
        "createdAt": "2017-03-22T06:41:33.195046",
        "deviceUUID": "2ad0fbb8-6f53-46ea-a10a-00b7b75145d3",
        "gps": {
          "lat": 0,
          "lng": 0
        }
      },
      "updatedAt": "2017-03-22T06:19:58.475876",
      "uuid": "2ad0fbb8-6f53-46ea-a10a-00b7b75145d3"
    },
    {
      "connection": {
        "createdAt": "2017-03-10T01:55:41.097736",
        "deviceUUID": "2730e69e-8d5a-4642-a7cf-966365f991fd",
        "status": "offline"
      },
      "createdAt": "2017-01-16T10:36:46.390569",
      "description": "Device",
      "displayName": "ThingsPro",
      "mac": "223344FF8F11",
      "iccId": "898600MFSSYYGXXXXXXA",
      "serialNumber": "MOXA00000002",
      "properties": {
        "aliasName": "ThingsPro",
        "createdAt": "2017-03-09T05:38:58.925514",
        "deviceUUID": "2730e69e-8d5a-4642-a7cf-966365f991fd",
        "gps": {
          "lat": 0,
          "lng": 0
        }
      },
      "updatedAt": "2017-03-20T06:32:35.814447",
      "uuid": "2730e69e-8d5a-4642-a7cf-966365f991fd"
    },
    {
      "connection": {
        "createdAt": "2017-03-08T15:54:59.782570",
        "deviceUUID": "6292ca47-f69b-4399-8bdc-3011dc5142df",
        "status": "created"
      },
      "createdAt": "2017-03-08T15:54:59.782570",
      "description": "Device",
      "displayName": "Dummy device",
      "mac": "223344FF8F54",
      "iccId": "898600MFSSYYGXXXXXXB",
      "serialNumber": "MOXA00000003",
      "properties": {},
      "updatedAt": "2017-03-08T15:54:59.782570",
      "uuid": "6292ca47-f69b-4399-8bdc-3011dc5142df"
    }
  ],
  "limit": 20,
  "offset": 0
}

POST /devices

Create (register) a new device to ThingsPro Cloud Server.

displayName: string

Display name of device.

mac: string

MAC address of device.

serialNumber: string

Serial number of device.

Request Example
{
  "displayName": "string",
  "mac": "string",
  "serialNumber": "string"
}
200 OK

An array of gateways

type
object[]
Response Example (200 OK)
{
  "uuid": "ded6dd9e-49d9-485b-bac1-da0ca0ae9d70",
  "description": "Temperature monitoring",
  "displayName": "Gym tempture sensor #1",
  "mac": "223344FFFF11",
  "iccId": "898600MFSSYYGXXXXXXP",
  "serialNumber": "MOXA00000001"
}

DELETE /devices

Delete (de-register) devices from ThingsPro Cloud Server.

Delete ids

string

UUID of deivce

Request Example
[
  "ded6dd9e-49d9-485b-bac1-da0ca0ae9d70"
]
200 OK

success

GET /devices/{uuid}'

Return Device with given UUID

uuid: string
in path

Device unique identifier

200 OK

An Object of the device

type
object
Response Example (200 OK)
{
  "uuid": "ded6dd9e-49d9-485b-bac1-da0ca0ae9d70",
  "description": "Temperature monitoring",
  "displayName": "Gym tempture sensor #1",
  "mac": "223344FFFF11",
  "iccId": "898600MFSSYYGXXXXXXP",
  "serialNumber": "MOXA00000001"
}

DELETE /devices/{uuid}'

Delete Device with given UUID

uuid: string
in path

Device unique identifier

200 OK

success

deviceJobRelay

Non-Blocking IO Model

POST /deviceJobRelay

Create a device task by non-blocking io model

Parameters of device task

deviceUUID: string

Target device's uuid

payload: object

RESTful Message, for more detail please refer to ThingsPro Gateway RESTful Reference

method: string get, post, put, delete

method of this request message

resource: string

resource of this request message

data:

Body

Request Content-Types: application/json
Request Example
{
  "deviceUUID": "2730e69e-8d5a-4642-a7cf-966365f991fd",
  "payload": {
    "method": "get",
    "resource": "/system/serial"
  }
}
201 Created

Response of device task

type
object
Response Example (201 Created)
{
  "deviceUUID": "2730e69e-8d5a-4642-a7cf-966365f991fd",
  "taskId": 1
}

GET /deviceJobRelay/{id}'

Return Device task data with given id

id: string
in path

Device task unique identifier

200 OK

An Object of the device task

type
object
Response Example (200 OK)
{
  "taskId": 4,
  "status": "Success from CG",
  "createdAt": "2018-10-02T10:02:33.000Z",
  "updatedAt": "2018-10-02T10:02:36.000Z",
  "code": 200,
  "result": {
    "id": 190760,
    "taskId": 4,
    "deviceUUID": "19c487dc-27c1-405b-bfce-000000000001",
    "code": 200,
    "method": "get",
    "resource": "/system/serial",
    "sign": [
      "serial"
    ],
    "data": [
      {
        "id": 1,
        "devDisplayName": "PORT 1",
        "dev": "/dev/ttyM0",
        "mode": "rs232"
      }
    ]
  }
}

deviceTasks

Remote Task

POST /deviceTasks

Create a remote task to target device

Remote task

deviceUUID: string

Target device's uuid

payload: object

RESTful Message, for more detail please refer to ThingsPro Gateway RESTful Reference

method: string get, post, put, delete

method of this request message

resource: string

resource of this request message

data:

Body

Request Content-Types: application/json
Request Example
{
  "deviceUUID": "2730e69e-8d5a-4642-a7cf-966365f991fd",
  "payload": {
    "method": "get",
    "resource": "/system/services"
  }
}
200 OK

Response of remote task

type
object
Response Example (200 OK)
{
  "taskID": "b6723b17-9497-4436-aaa6-fbba5a5d1fd0",
  "code": 200,
  "data": [
    {
      "enable": true,
      "id": 1,
      "name": "ssh",
      "status": true
    },
    {
      "enable": true,
      "id": 2,
      "name": "rsyslog",
      "status": true
    },
    {
      "enable": true,
      "id": 3,
      "name": "mxssdpd",
      "status": true
    }
  ],
  "id": 638000,
  "method": "get",
  "resource": "/system/services",
  "sign": [
    "service"
  ]
}

PUT /deviceTasks

Create a remote task (with files) to target device Note: This is a pseudo method because OpenAPI 2.0's limitation, please use method POST instead of PUT.

files: file
in formData

Upload files with fieldname (files is only for example)

jsonData: string
in formData

JSON string of payload

200 OK

Response of remote task

type
object
Response Example (200 OK)
{
  "taskID": "b6723b17-9497-4436-aaa6-fbba5a5d1fd0",
  "code": 200,
  "data": [
    {
      "enable": true,
      "id": 1,
      "name": "ssh",
      "status": true
    },
    {
      "enable": true,
      "id": 2,
      "name": "rsyslog",
      "status": true
    },
    {
      "enable": true,
      "id": 3,
      "name": "mxssdpd",
      "status": true
    }
  ],
  "id": 638000,
  "method": "get",
  "resource": "/system/services",
  "sign": [
    "service"
  ]
}

group

GET /groups

The Group endpoint returns information about the device groups.

offset: number (integer)
in query

offset

limit: number (integer)
in query

max return group count (default: 20)

200 OK

An array of groups

type
object
Response Example (200 OK)
{
  "count": 1,
  "data": [
    {
      "createdAt": "2017-03-22T06:14:32.656242",
      "description": "",
      "deviceStatus": {
        "created": 1,
        "offline": 1,
        "online": 0
      },
      "devices": [
        {
          "connection": {
            "createdAt": "2017-03-22T08:15:01.359380",
            "deviceUUID": "2ad0fbb8-6f53-46ea-a10a-00b7b75145d3",
            "status": "offline"
          },
          "createdAt": "2017-03-21T03:01:10.175584",
          "description": "Device",
          "displayName": "ThingsPro-changed",
          "mac": "223344FF8F51",
          "serialNumber": "TAFLB1003683",
          "properties": {
            "aliasName": "ThingsPro-changed",
            "createdAt": "2017-03-22T06:41:33.195046",
            "deviceUUID": "2ad0fbb8-6f53-46ea-a10a-00b7b75145d3",
            "gps": {
              "lat": 0,
              "lng": 0
            }
          },
          "updatedAt": "2017-03-22T06:19:58.475876",
          "uuid": "2ad0fbb8-6f53-46ea-a10a-00b7b75145d3"
        },
        {
          "connection": {
            "createdAt": "2017-03-08T15:54:59.782570",
            "deviceUUID": "6292ca47-f69b-4399-8bdc-3011dc5142df",
            "status": "created"
          },
          "createdAt": "2017-03-08T15:54:59.782570",
          "description": "Device",
          "displayName": "Dummy device",
          "mac": "223344FF8F54",
          "serialNumber": "TAFLB1003684",
          "properties": {},
          "updatedAt": "2017-03-08T15:54:59.782570",
          "uuid": "6292ca47-f69b-4399-8bdc-3011dc5142df"
        }
      ],
      "id": 121,
      "name": "test",
      "taskStatus": {
        "activeCount": 0,
        "completedCount": 1,
        "revokedCount": 0,
        "totalCount": 1
      },
      "taskUUID": "72fe59aa-b06a-4ba9-b2cc-373a0dc39b5b",
      "tasks": [
        {
          "applyPolicy": "none",
          "createdAt": "2017-03-22T06:19:58.475876",
          "deviceUUID": "2ad0fbb8-6f53-46ea-a10a-00b7b75145d3",
          "groupTaskUUID": "72fe59aa-b06a-4ba9-b2cc-373a0dc39b5b",
          "retryTimes": 0,
          "revoked": false,
          "scheduledDateTime": "",
          "state": "SUCCESS",
          "success": true,
          "updatedAt": "2017-03-22T06:20:58.689765",
          "uuid": "ea2ef1b9-6c6d-428c-8eb6-c4140fc8a21a"
        }
      ],
      "updatedAt": "2017-03-22T06:14:32.656242"
    }
  ],
  "limit": 20,
  "offset": 0
}

POST /groups

Create a new group.

New Group object. A device can only be attached to one group.

id: number

Unique identifier representing a specific group.

name: string

Name of group.

description: string

Description of group.

devices: Device

Array of device objects belong to this group.

Device
deviceStatus: object

Device status

onlineCount: number

Number of online devices of this group.

offlineCount: number

Number of offline devices of this group.

createdCount: number

Number of created devices of this group.

totalCount: number

Number of devices of this group.

tasks: GroupTask

Array of GroupTask objects belong to this group.

GroupTask
taskStatus: object

Task status

activeCount: number

Number of active tasks of this group.

completedCount: number

Number of completed tasks of this group.

revokedCount: number

Number of revoked tasks of this group.

totalCount: number

Number of tasks of this group.

createdAt: string (date-time)

created time.

updatedAt: string (date-time)

updated time.

Request Example
{
  "id": 1,
  "name": "Group Name Here",
  "description": "Group Description",
  "deviceStatus": {
    "created": 1,
    "offline": 0,
    "online": 0
  },
  "devices": [
    {
      "connection": {
        "createdAt": "2016-12-22T10:07:56",
        "deviceUUID": "17dbee9c-696c-4598-b1d9-547e740d94fa",
        "status": "created"
      },
      "createdAt": "2016-12-22T10:07:56",
      "description": "Device",
      "displayName": "MOXA HQ Sensor 4",
      "mac": "223344FF8F12",
      "serialNumber": "TAFLB1003683",
      "properties": {},
      "updatedAt": "2016-12-22T10:07:56",
      "uuid": "17dbee9c-696c-4598-b1d9-547e740d94fa"
    }
  ],
  "taskStatus": {
    "completedCount": 1,
    "activeCount": 0,
    "revokedCount": 1,
    "totalCount": 1
  },
  "tasks": [
    {
      "applyPolicy": "none",
      "createdAt": "2017-02-23T08:05:22.003420",
      "deviceUUID": "17dbee9c-696c-4598-b1d9-547e740d94fa",
      "groupTaskUUID": "b801b523-2900-493e-927e-70724c6ed162",
      "meta": {
        "description": "GROUPLIST_TABLE_ACTION_UPGRADE",
        "icon": "system_update_alt"
      },
      "retryTimes": 0,
      "revoked": false,
      "scheduledDateTime": "",
      "state": "SUCCESS",
      "success": true,
      "updatedAt": "2017-02-23T08:05:22.003420",
      "uuid": "c3d4e60e-3519-4819-9051-8efbc1d700f1"
    }
  ],
  "createdAt": "2016-12-22T10:08:18",
  "updatedAt": "2016-12-22T10:08:18"
}
200 OK

An array of groups

type
object[]
Response Example (200 OK)
{
  "id": 1,
  "name": "Group Name Here",
  "description": "Group Description",
  "deviceStatus": {
    "created": 1,
    "offline": 0,
    "online": 0
  },
  "devices": [
    {
      "connection": {
        "createdAt": "2016-12-22T10:07:56",
        "deviceUUID": "17dbee9c-696c-4598-b1d9-547e740d94fa",
        "status": "created"
      },
      "createdAt": "2016-12-22T10:07:56",
      "description": "Device",
      "displayName": "MOXA HQ Sensor 4",
      "mac": "223344FF8F12",
      "serialNumber": "TAFLB1003683",
      "properties": {},
      "updatedAt": "2016-12-22T10:07:56",
      "uuid": "17dbee9c-696c-4598-b1d9-547e740d94fa"
    }
  ],
  "taskStatus": {
    "completedCount": 1,
    "activeCount": 0,
    "revokedCount": 1,
    "totalCount": 1
  },
  "tasks": [
    {
      "applyPolicy": "none",
      "createdAt": "2017-02-23T08:05:22.003420",
      "deviceUUID": "17dbee9c-696c-4598-b1d9-547e740d94fa",
      "groupTaskUUID": "b801b523-2900-493e-927e-70724c6ed162",
      "meta": {
        "description": "GROUPLIST_TABLE_ACTION_UPGRADE",
        "icon": "system_update_alt"
      },
      "retryTimes": 0,
      "revoked": false,
      "scheduledDateTime": "",
      "state": "SUCCESS",
      "success": true,
      "updatedAt": "2017-02-23T08:05:22.003420",
      "uuid": "c3d4e60e-3519-4819-9051-8efbc1d700f1"
    }
  ],
  "createdAt": "2016-12-22T10:08:18",
  "updatedAt": "2016-12-22T10:08:18"
}

DELETE /groups

Delete groups.

IDs of groups. (You can't delete group which has incomplete tasks.)

number

ID of Group

Request Example
[
  1
]
200 OK

success

GET /groups/{id}

Return Group with given ID

id: string
in path

Group unique identifier

200 OK

An Object of the group

type
object
Response Example (200 OK)
{
  "id": 1,
  "name": "Group Name Here",
  "description": "Group Description",
  "deviceStatus": {
    "created": 1,
    "offline": 0,
    "online": 0
  },
  "devices": [
    {
      "connection": {
        "createdAt": "2016-12-22T10:07:56",
        "deviceUUID": "17dbee9c-696c-4598-b1d9-547e740d94fa",
        "status": "created"
      },
      "createdAt": "2016-12-22T10:07:56",
      "description": "Device",
      "displayName": "MOXA HQ Sensor 4",
      "mac": "223344FF8F12",
      "serialNumber": "TAFLB1003683",
      "properties": {},
      "updatedAt": "2016-12-22T10:07:56",
      "uuid": "17dbee9c-696c-4598-b1d9-547e740d94fa"
    }
  ],
  "taskStatus": {
    "completedCount": 1,
    "activeCount": 0,
    "revokedCount": 1,
    "totalCount": 1
  },
  "tasks": [
    {
      "applyPolicy": "none",
      "createdAt": "2017-02-23T08:05:22.003420",
      "deviceUUID": "17dbee9c-696c-4598-b1d9-547e740d94fa",
      "groupTaskUUID": "b801b523-2900-493e-927e-70724c6ed162",
      "meta": {
        "description": "GROUPLIST_TABLE_ACTION_UPGRADE",
        "icon": "system_update_alt"
      },
      "retryTimes": 0,
      "revoked": false,
      "scheduledDateTime": "",
      "state": "SUCCESS",
      "success": true,
      "updatedAt": "2017-02-23T08:05:22.003420",
      "uuid": "c3d4e60e-3519-4819-9051-8efbc1d700f1"
    }
  ],
  "createdAt": "2016-12-22T10:08:18",
  "updatedAt": "2016-12-22T10:08:18"
}

PUT /groups/{id}

Update Group with given ID

Updated information of group.

id: number

Unique identifier representing a specific group.

name: string

Name of group.

description: string

Description of group.

devices: Device

Array of device objects belong to this group.

Device
deviceStatus: object

Device status

onlineCount: number

Number of online devices of this group.

offlineCount: number

Number of offline devices of this group.

createdCount: number

Number of created devices of this group.

totalCount: number

Number of devices of this group.

tasks: GroupTask

Array of GroupTask objects belong to this group.

GroupTask
taskStatus: object

Task status

activeCount: number

Number of active tasks of this group.

completedCount: number

Number of completed tasks of this group.

revokedCount: number

Number of revoked tasks of this group.

totalCount: number

Number of tasks of this group.

createdAt: string (date-time)

created time.

updatedAt: string (date-time)

updated time.

id: string
in path

Group unique identifier

Request Example
{
  "id": 1,
  "name": "Group Name Here",
  "description": "Group Description",
  "deviceStatus": {
    "created": 1,
    "offline": 0,
    "online": 0
  },
  "devices": [
    {
      "connection": {
        "createdAt": "2016-12-22T10:07:56",
        "deviceUUID": "17dbee9c-696c-4598-b1d9-547e740d94fa",
        "status": "created"
      },
      "createdAt": "2016-12-22T10:07:56",
      "description": "Device",
      "displayName": "MOXA HQ Sensor 4",
      "mac": "223344FF8F12",
      "serialNumber": "TAFLB1003683",
      "properties": {},
      "updatedAt": "2016-12-22T10:07:56",
      "uuid": "17dbee9c-696c-4598-b1d9-547e740d94fa"
    }
  ],
  "taskStatus": {
    "completedCount": 1,
    "activeCount": 0,
    "revokedCount": 1,
    "totalCount": 1
  },
  "tasks": [
    {
      "applyPolicy": "none",
      "createdAt": "2017-02-23T08:05:22.003420",
      "deviceUUID": "17dbee9c-696c-4598-b1d9-547e740d94fa",
      "groupTaskUUID": "b801b523-2900-493e-927e-70724c6ed162",
      "meta": {
        "description": "GROUPLIST_TABLE_ACTION_UPGRADE",
        "icon": "system_update_alt"
      },
      "retryTimes": 0,
      "revoked": false,
      "scheduledDateTime": "",
      "state": "SUCCESS",
      "success": true,
      "updatedAt": "2017-02-23T08:05:22.003420",
      "uuid": "c3d4e60e-3519-4819-9051-8efbc1d700f1"
    }
  ],
  "createdAt": "2016-12-22T10:08:18",
  "updatedAt": "2016-12-22T10:08:18"
}
200 OK

An Object of the group

type
object
Response Example (200 OK)
{
  "id": 1,
  "name": "Group Name Here",
  "description": "Group Description",
  "deviceStatus": {
    "created": 1,
    "offline": 0,
    "online": 0
  },
  "devices": [
    {
      "connection": {
        "createdAt": "2016-12-22T10:07:56",
        "deviceUUID": "17dbee9c-696c-4598-b1d9-547e740d94fa",
        "status": "created"
      },
      "createdAt": "2016-12-22T10:07:56",
      "description": "Device",
      "displayName": "MOXA HQ Sensor 4",
      "mac": "223344FF8F12",
      "serialNumber": "TAFLB1003683",
      "properties": {},
      "updatedAt": "2016-12-22T10:07:56",
      "uuid": "17dbee9c-696c-4598-b1d9-547e740d94fa"
    }
  ],
  "taskStatus": {
    "completedCount": 1,
    "activeCount": 0,
    "revokedCount": 1,
    "totalCount": 1
  },
  "tasks": [
    {
      "applyPolicy": "none",
      "createdAt": "2017-02-23T08:05:22.003420",
      "deviceUUID": "17dbee9c-696c-4598-b1d9-547e740d94fa",
      "groupTaskUUID": "b801b523-2900-493e-927e-70724c6ed162",
      "meta": {
        "description": "GROUPLIST_TABLE_ACTION_UPGRADE",
        "icon": "system_update_alt"
      },
      "retryTimes": 0,
      "revoked": false,
      "scheduledDateTime": "",
      "state": "SUCCESS",
      "success": true,
      "updatedAt": "2017-02-23T08:05:22.003420",
      "uuid": "c3d4e60e-3519-4819-9051-8efbc1d700f1"
    }
  ],
  "createdAt": "2016-12-22T10:08:18",
  "updatedAt": "2016-12-22T10:08:18"
}

DELETE /groups/{id}

Delete Group with given ID

id: string
in path

Group unique identifier

200 OK

success

GET /groups/{id}/devices

Return device uuid in this group

id: string
in path

Group unique identifier

200 OK

An array of the device uuid

type
string[]
Response Example (200 OK)
[
  "6292ca47-f69b-4399-8bdc-3011dc5142df",
  "2730e69e-8d5a-4642-a7cf-966365f991fd"
]

POST /groups/{id}/devices

Add devices to group

Array of device uuids

string

UUID of deivce

id: string
in path

Group unique identifier

Request Example
[
  [
    "ded6dd9e-49d9-485b-bac1-da0ca0ae9d70"
  ]
]
200 OK

An array of the device uuid in this group

type
string[]
Response Example (200 OK)
[
  "6292ca47-f69b-4399-8bdc-3011dc5142df",
  "2730e69e-8d5a-4642-a7cf-966365f991fd"
]

DELETE /groups/{id}/devices

Remove devices from group

Array of device uuids

string

UUID of deivce

id: string
in path

Group unique identifier

Request Example
[
  [
    "ded6dd9e-49d9-485b-bac1-da0ca0ae9d70"
  ]
]
200 OK

An array of the device uuid in this group

type
string[]
Response Example (200 OK)
[
  "6292ca47-f69b-4399-8bdc-3011dc5142df",
  "2730e69e-8d5a-4642-a7cf-966365f991fd"
]

groupTasks

Remote Task

POST /groupTasks

Create a new group task.

Request Example
{
  "groupId": 1,
  "payload": {
    "resource": "/system/reboot",
    "method": "post",
    "data": {}
  },
  "applyPolicy": "none",
  "retryTimes": 0,
  "scheduledDateTime": "2017-01-09T06:46:01.181Z"
}

Group Task object

Response Example (200 OK)
{
  "id": 1,
  "name": "Group Name Here",
  "description": "Group Description",
  "deviceStatus": {
    "created": 1,
    "offline": 0,
    "online": 0
  },
  "devices": [
    {
      "connection": {
        "createdAt": "2016-12-22T10:07:56",
        "deviceUUID": "17dbee9c-696c-4598-b1d9-547e740d94fa",
        "status": "created"
      },
      "createdAt": "2016-12-22T10:07:56",
      "description": "Device",
      "displayName": "MOXA HQ Sensor 4",
      "mac": "223344FF8F12",
      "serialNumber": "TAFLB1003683",
      "properties": {},
      "updatedAt": "2016-12-22T10:07:56",
      "uuid": "17dbee9c-696c-4598-b1d9-547e740d94fa"
    }
  ],
  "taskStatus": {
    "completedCount": 1,
    "activeCount": 0,
    "revokedCount": 1,
    "totalCount": 1
  },
  "tasks": [
    {
      "applyPolicy": "none",
      "createdAt": "2017-02-23T08:05:22.003420",
      "deviceUUID": "17dbee9c-696c-4598-b1d9-547e740d94fa",
      "groupTaskUUID": "b801b523-2900-493e-927e-70724c6ed162",
      "retryTimes": 0,
      "revoked": false,
      "scheduledDateTime": "",
      "state": "SUCCESS",
      "success": true,
      "updatedAt": "2017-02-23T08:05:22.003420",
      "uuid": "c3d4e60e-3519-4819-9051-8efbc1d700f1"
    }
  ],
  "createdAt": "2016-12-22T10:08:18",
  "updatedAt": "2016-12-22T10:08:18"
}

notification

Cloud Gateway management

GET /notifications

return all subscribe notifications

200 OK

An array of all subscribe notifications

type
object[]
Response Example (200 OK)
[
  {
    "endpoint": "http://8.8.8.8/receive",
    "eventType": "device_online",
    "protocol": "http",
    "status": "Ready",
    "uuid": "3d444fc4-6c80-48b7-a129-79ead8c2cdab"
  },
  {
    "endpoint": "https://123.abc.com/aa.jsp",
    "eventType": "device_offline",
    "protocol": "https",
    "status": "Pending Confirmation",
    "uuid": "0"
  }
]

POST /notifications

Create (register) a new notification to ThingsPro Cloud Server, be notice, you must setup endpoint before you call this api, becasue Cloud server will trigger endpoint when you register immediately. If everything is ready, the subscriptions status will be ready or you will receive Pending Confirmation, once you got Pending Confirmation, you need call this api and try to send the same data again

eventType: string device_online, device_offline, job_update, property_update

Description of event type.

protocol: string http, https

Description of supported protocol.

endpoint: string

Description of notification recevier, for protocol is http or https, this should be api endpoint, http://api/v1/notification, https://api/v1/notification

Request Example
{
  "endpoint": "http://8.8.8.8/receive",
  "eventType": "device_online",
  "protocol": "http"
}
200 OK

reutrn created notification object

type
object[]
Response Example (200 OK)
{
  "endpoint": "https://8.8.8.8/receive",
  "eventType": "device_online",
  "protocol": "https",
  "status": "Ready",
  "uuid": "3d444fc4-6c80-48b7-a129-79ead8c2cdab"
}

DELETE /notifications

Delete notifications from ThingsPro Cloud Server.

Delete uuids

string

UUID of notification

Request Example
[
  [
    "ded6dd9e-49d9-485b-bac1-da0ca0ae9d70",
    "3d444fc4-6c80-48b7-a129-79ead8c2cdab"
  ]
]
200 OK

success

DELETE /notifications/{uuid}'

Delete notification with given UUID

uuid: string
in path

Notification unique identifier

204 No Content

success

GET /notifications/support'

Return supported notification protocol and event type

200 OK

An Object of the device

type
object
Response Example (200 OK)
{
  "event": [
    {
      "displayName": "Device online",
      "eventType": "device_online"
    },
    {
      "displayName": "Device offline",
      "eventType": "device_offline"
    },
    {
      "displayName": "Job update",
      "eventType": "job_update"
    },
    {
      "displayName": "Property update",
      "eventType": "property_update"
    }
  ],
  "protocol": [
    {
      "displayName": "HTTP",
      "id": "http"
    },
    {
      "displayName": "HTTPS",
      "id": "https"
    }
  ]
}

Schema Definitions

DeviceCreate: object

displayName: string

Display name of device.

mac: string

MAC address of device.

serialNumber: string

Serial number of device.

Example
{
  "displayName": "string",
  "mac": "string",
  "serialNumber": "string"
}

Device: object

uuid: string

Unique identifier representing a specific device.

description: string

Description of device.

displayName: string

Display name of device.

mac: string

MAC address of device.

iccId: string

Cellular ICCID

serialNumber: string

Serial number of device.

connection: object

Device's latest connection status

properties: object

Device's latest system properties

aliasName: string

Display name of device

iccId: string

Iccid of device

modelName: string

Model name of device

softwareVersion: string

Firmware(software) version of device

defaultRoute: string wwan0, wlan0, eth0

Default route of device, wwan0 represents cellular, wlan0 represents wifi, eth0 represents ethernet

gps: object
lat: number

gps lat value

lng: number

gps lng value

wifi: string connected, disconnected, auth_failed

Default route of device, wwan0 represents cellular, wlan0 represents wifi, eth0 represents ethernet

customProperties: object

User custom defined properties

Example
{
  "uuid": "ded6dd9e-49d9-485b-bac1-da0ca0ae9d70",
  "description": "Temperature monitoring",
  "displayName": "Gym tempture sensor #1",
  "mac": "223344FFFF11",
  "iccId": "898600MFSSYYGXXXXXXP",
  "serialNumber": "MOXA00000001"
}

DeviceList: object

count: number

Total count of devices

limit: number

query limit number

offset: number

query offset number

data: object[]
object
uuid: string

Unique identifier representing a specific device.

description: string

Description of device.

displayName: string

Display name of device.

mac: string

MAC address of device.

iccId: string

Cellular ICCID

serialNumber: string

Serial number of device.

connection: object

Device's latest connection status

properties: object

Device's latest system properties

aliasName: string

Display name of device

iccId: string

Iccid of device

modelName: string

Model name of device

softwareVersion: string

Firmware(software) version of device

defaultRoute: string wwan0, wlan0, eth0

Default route of device, wwan0 represents cellular, wlan0 represents wifi, eth0 represents ethernet

gps: object
lat: number

gps lat value

lng: number

gps lng value

wifi: string connected, disconnected, auth_failed

Default route of device, wwan0 represents cellular, wlan0 represents wifi, eth0 represents ethernet

customProperties: object

User custom defined properties

Example
{
  "count": 3,
  "data": [
    {
      "connection": {
        "createdAt": "2017-03-22T08:15:01.359380",
        "deviceUUID": "2ad0fbb8-6f53-46ea-a10a-00b7b75145d3",
        "status": "offline"
      },
      "createdAt": "2017-03-21T03:01:10.175584",
      "description": "Device",
      "displayName": "ThingsPro-changed",
      "mac": "223344FF8F51",
      "iccId": "898600MFSSYYGXXXXXXP",
      "serialNumber": "MOXA00000001",
      "properties": {
        "aliasName": "ThingsPro-changed",
        "createdAt": "2017-03-22T06:41:33.195046",
        "deviceUUID": "2ad0fbb8-6f53-46ea-a10a-00b7b75145d3",
        "gps": {
          "lat": 0,
          "lng": 0
        }
      },
      "updatedAt": "2017-03-22T06:19:58.475876",
      "uuid": "2ad0fbb8-6f53-46ea-a10a-00b7b75145d3"
    },
    {
      "connection": {
        "createdAt": "2017-03-10T01:55:41.097736",
        "deviceUUID": "2730e69e-8d5a-4642-a7cf-966365f991fd",
        "status": "offline"
      },
      "createdAt": "2017-01-16T10:36:46.390569",
      "description": "Device",
      "displayName": "ThingsPro",
      "mac": "223344FF8F11",
      "iccId": "898600MFSSYYGXXXXXXA",
      "serialNumber": "MOXA00000002",
      "properties": {
        "aliasName": "ThingsPro",
        "createdAt": "2017-03-09T05:38:58.925514",
        "deviceUUID": "2730e69e-8d5a-4642-a7cf-966365f991fd",
        "gps": {
          "lat": 0,
          "lng": 0
        }
      },
      "updatedAt": "2017-03-20T06:32:35.814447",
      "uuid": "2730e69e-8d5a-4642-a7cf-966365f991fd"
    },
    {
      "connection": {
        "createdAt": "2017-03-08T15:54:59.782570",
        "deviceUUID": "6292ca47-f69b-4399-8bdc-3011dc5142df",
        "status": "created"
      },
      "createdAt": "2017-03-08T15:54:59.782570",
      "description": "Device",
      "displayName": "Dummy device",
      "mac": "223344FF8F54",
      "iccId": "898600MFSSYYGXXXXXXB",
      "serialNumber": "MOXA00000003",
      "properties": {},
      "updatedAt": "2017-03-08T15:54:59.782570",
      "uuid": "6292ca47-f69b-4399-8bdc-3011dc5142df"
    }
  ],
  "limit": 20,
  "offset": 0
}

DeviceUUIDs: array

string

UUID of deivce

Example
[
  [
    "ded6dd9e-49d9-485b-bac1-da0ca0ae9d70"
  ]
]

FilterDevice: object

limit: number

query limit number

offset: number

query offset number

keys: object

query keyword

Example
{
  "offset": 0,
  "limit": 100,
  "keys": {
    "serialNumber": {
      "filter": "MOXA00000003"
    },
    "uuid": {
      "filter": "6292ca47-f69b-4399-8bdc-3011dc5142df"
    },
    "mac": {
      "filter": "223344FF8F54"
    },
    "displayName": {
      "filter": "DEVICE_NAME"
    },
    "defaultRoute": {
      "filter": "eth0"
    },
    "softwareVersion": {
      "filter": "2.1"
    }
  }
}

DeviceJobRelayCreate: object

deviceUUID: string

Target device's uuid

payload: object

RESTful Message, for more detail please refer to ThingsPro Gateway RESTful Reference

method: string get, post, put, delete

method of this request message

resource: string

resource of this request message

data:

Body

Example
{
  "deviceUUID": "2730e69e-8d5a-4642-a7cf-966365f991fd",
  "payload": {
    "method": "get",
    "resource": "/system/serial"
  }
}

DeviceJobRelayResponse: object

deviceUUID: string

Target device's uuid

taskId: number

Task ID

Example
{
  "deviceUUID": "2730e69e-8d5a-4642-a7cf-966365f991fd",
  "taskId": 1
}

DeviceJobRelay: object

taskId: number

Task ID

status: string

response status

createdAt: string

created time

updatedAt: string

updated time

code: number

http status code

result: object

result

Example
{
  "taskId": 4,
  "status": "Success from CG",
  "createdAt": "2018-10-02T10:02:33.000Z",
  "updatedAt": "2018-10-02T10:02:36.000Z",
  "code": 200,
  "result": {
    "id": 190760,
    "taskId": 4,
    "deviceUUID": "19c487dc-27c1-405b-bfce-000000000001",
    "code": 200,
    "method": "get",
    "resource": "/system/serial",
    "sign": [
      "serial"
    ],
    "data": [
      {
        "id": 1,
        "devDisplayName": "PORT 1",
        "dev": "/dev/ttyM0",
        "mode": "rs232"
      }
    ]
  }
}

DeviceTaskCreate: object

deviceUUID: string

Target device's uuid

payload: object

RESTful Message, for more detail please refer to ThingsPro Gateway RESTful Reference

method: string get, post, put, delete

method of this request message

resource: string

resource of this request message

data:

Body

Example
{
  "deviceUUID": "2730e69e-8d5a-4642-a7cf-966365f991fd",
  "payload": {
    "method": "get",
    "resource": "/system/services"
  }
}

DeviceTaskResp: object

taskID: string

Task ID of this request

code: number

status code for this request (like HTTP Status code)

method: string get, post, put, delete

method of this request (like HTTP Method)

resource: string

resource of this request (like HTTP URI)

sign: string[]

Who signed (processed) this message

string
data: object

response data of this request (like HTTP Body)

Example
{
  "taskID": "b6723b17-9497-4436-aaa6-fbba5a5d1fd0",
  "code": 200,
  "data": [
    {
      "enable": true,
      "id": 1,
      "name": "ssh",
      "status": true
    },
    {
      "enable": true,
      "id": 2,
      "name": "rsyslog",
      "status": true
    },
    {
      "enable": true,
      "id": 3,
      "name": "mxssdpd",
      "status": true
    }
  ],
  "id": 638000,
  "method": "get",
  "resource": "/system/services",
  "sign": [
    "service"
  ]
}

Group: object

id: number

Unique identifier representing a specific group.

name: string

Name of group.

description: string

Description of group.

devices: Device

Array of device objects belong to this group.

Device
deviceStatus: object

Device status

onlineCount: number

Number of online devices of this group.

offlineCount: number

Number of offline devices of this group.

createdCount: number

Number of created devices of this group.

totalCount: number

Number of devices of this group.

tasks: GroupTask

Array of GroupTask objects belong to this group.

GroupTask
taskStatus: object

Task status

activeCount: number

Number of active tasks of this group.

completedCount: number

Number of completed tasks of this group.

revokedCount: number

Number of revoked tasks of this group.

totalCount: number

Number of tasks of this group.

createdAt: string (date-time)

created time.

updatedAt: string (date-time)

updated time.

Example
{
  "id": 1,
  "name": "Group Name Here",
  "description": "Group Description",
  "deviceStatus": {
    "created": 1,
    "offline": 0,
    "online": 0
  },
  "devices": [
    {
      "connection": {
        "createdAt": "2016-12-22T10:07:56",
        "deviceUUID": "17dbee9c-696c-4598-b1d9-547e740d94fa",
        "status": "created"
      },
      "createdAt": "2016-12-22T10:07:56",
      "description": "Device",
      "displayName": "MOXA HQ Sensor 4",
      "mac": "223344FF8F12",
      "serialNumber": "TAFLB1003683",
      "properties": {},
      "updatedAt": "2016-12-22T10:07:56",
      "uuid": "17dbee9c-696c-4598-b1d9-547e740d94fa"
    }
  ],
  "taskStatus": {
    "completedCount": 1,
    "activeCount": 0,
    "revokedCount": 1,
    "totalCount": 1
  },
  "tasks": [
    {
      "applyPolicy": "none",
      "createdAt": "2017-02-23T08:05:22.003420",
      "deviceUUID": "17dbee9c-696c-4598-b1d9-547e740d94fa",
      "groupTaskUUID": "b801b523-2900-493e-927e-70724c6ed162",
      "meta": {
        "description": "GROUPLIST_TABLE_ACTION_UPGRADE",
        "icon": "system_update_alt"
      },
      "retryTimes": 0,
      "revoked": false,
      "scheduledDateTime": "",
      "state": "SUCCESS",
      "success": true,
      "updatedAt": "2017-02-23T08:05:22.003420",
      "uuid": "c3d4e60e-3519-4819-9051-8efbc1d700f1"
    }
  ],
  "createdAt": "2016-12-22T10:08:18",
  "updatedAt": "2016-12-22T10:08:18"
}

GroupList: object

count: number

Total count of groups

limit: number

query limit number

offset: number

query offset number

data: object[]
object
Example
{
  "count": 1,
  "data": [
    {
      "createdAt": "2017-03-22T06:14:32.656242",
      "description": "",
      "deviceStatus": {
        "created": 1,
        "offline": 1,
        "online": 0
      },
      "devices": [
        {
          "connection": {
            "createdAt": "2017-03-22T08:15:01.359380",
            "deviceUUID": "2ad0fbb8-6f53-46ea-a10a-00b7b75145d3",
            "status": "offline"
          },
          "createdAt": "2017-03-21T03:01:10.175584",
          "description": "Device",
          "displayName": "ThingsPro-changed",
          "mac": "223344FF8F51",
          "serialNumber": "TAFLB1003683",
          "properties": {
            "aliasName": "ThingsPro-changed",
            "createdAt": "2017-03-22T06:41:33.195046",
            "deviceUUID": "2ad0fbb8-6f53-46ea-a10a-00b7b75145d3",
            "gps": {
              "lat": 0,
              "lng": 0
            }
          },
          "updatedAt": "2017-03-22T06:19:58.475876",
          "uuid": "2ad0fbb8-6f53-46ea-a10a-00b7b75145d3"
        },
        {
          "connection": {
            "createdAt": "2017-03-08T15:54:59.782570",
            "deviceUUID": "6292ca47-f69b-4399-8bdc-3011dc5142df",
            "status": "created"
          },
          "createdAt": "2017-03-08T15:54:59.782570",
          "description": "Device",
          "displayName": "Dummy device",
          "mac": "223344FF8F54",
          "serialNumber": "TAFLB1003684",
          "properties": {},
          "updatedAt": "2017-03-08T15:54:59.782570",
          "uuid": "6292ca47-f69b-4399-8bdc-3011dc5142df"
        }
      ],
      "id": 121,
      "name": "test",
      "taskStatus": {
        "activeCount": 0,
        "completedCount": 1,
        "revokedCount": 0,
        "totalCount": 1
      },
      "taskUUID": "72fe59aa-b06a-4ba9-b2cc-373a0dc39b5b",
      "tasks": [
        {
          "applyPolicy": "none",
          "createdAt": "2017-03-22T06:19:58.475876",
          "deviceUUID": "2ad0fbb8-6f53-46ea-a10a-00b7b75145d3",
          "groupTaskUUID": "72fe59aa-b06a-4ba9-b2cc-373a0dc39b5b",
          "retryTimes": 0,
          "revoked": false,
          "scheduledDateTime": "",
          "state": "SUCCESS",
          "success": true,
          "updatedAt": "2017-03-22T06:20:58.689765",
          "uuid": "ea2ef1b9-6c6d-428c-8eb6-c4140fc8a21a"
        }
      ],
      "updatedAt": "2017-03-22T06:14:32.656242"
    }
  ],
  "limit": 20,
  "offset": 0
}

GroupIDs: array

number

ID of Group

Example
[
  1
]

GroupTask: array

Array of DeviceTask objects belong to this group.

DeviceTaskCreate
Example
[
  {
    "deviceUUID": "2730e69e-8d5a-4642-a7cf-966365f991fd",
    "payload": {
      "method": "get",
      "resource": "/system/services"
    }
  }
]

GroupTaskCreate:

Create group task

groupId: number

ID of group

Example
{
  "groupId": 1,
  "payload": {
    "resource": "/system/reboot",
    "method": "post",
    "data": {}
  },
  "applyPolicy": "none",
  "retryTimes": 0,
  "scheduledDateTime": "2017-01-09T06:46:01.181Z"
}

Notification: object

uuid: string

Unique identifier representing a specific notification.

eventType: string device_online, device_offline, job_update, property_update

Description of event type.

status: string Ready, Pending Confirmation

Description of status.

protocol: string http, https

Description of supported protocol.

endpoint: string

Description of notification recevier, for protocol is http or https, this should be api endpoint, http://api/v1/notification, https://api/v1/notification

Example
{
  "endpoint": "https://8.8.8.8/receive",
  "eventType": "device_online",
  "protocol": "https",
  "status": "Ready",
  "uuid": "3d444fc4-6c80-48b7-a129-79ead8c2cdab"
}

NotificationCreate: object

eventType: string device_online, device_offline, job_update, property_update

Description of event type.

protocol: string http, https

Description of supported protocol.

endpoint: string

Description of notification recevier, for protocol is http or https, this should be api endpoint, http://api/v1/notification, https://api/v1/notification

Example
{
  "endpoint": "http://8.8.8.8/receive",
  "eventType": "device_online",
  "protocol": "http"
}

Event: object

eventType: string device_online, device_offline, job_update, property_update

Describe support event type,

displayName: string

Describe event display name

Example
{
  "eventType": "string",
  "displayName": "string"
}

Protocol: object

id: string http, https

Describe the unique id of protocol

displayName: string

Describe protocol display name

Example
{
  "id": "string",
  "displayName": "string"
}

SupportList: object

event: object[]
object
eventType: string device_online, device_offline, job_update, property_update

Describe support event type,

displayName: string

Describe event display name

protocol: object[]
object
id: string http, https

Describe the unique id of protocol

displayName: string

Describe protocol display name

Example
{
  "event": [
    {
      "displayName": "Device online",
      "eventType": "device_online"
    },
    {
      "displayName": "Device offline",
      "eventType": "device_offline"
    },
    {
      "displayName": "Job update",
      "eventType": "job_update"
    },
    {
      "displayName": "Property update",
      "eventType": "property_update"
    }
  ],
  "protocol": [
    {
      "displayName": "HTTP",
      "id": "http"
    },
    {
      "displayName": "HTTPS",
      "id": "https"
    }
  ]
}

NotificationUUIDs: array

string

UUID of notification

Example
[
  [
    "ded6dd9e-49d9-485b-bac1-da0ca0ae9d70",
    "3d444fc4-6c80-48b7-a129-79ead8c2cdab"
  ]
]