ThingsIoT Platform API Documentation
1. Login API
- URL
http://things-api.iotddc.com/edge-user/user/apiLogin - Request Method
post - Request Parameters
| Parameter | Type | Required | Submission Method | Default | Description |
|---|---|---|---|---|---|
| username | String | Y | query | None | test |
| password | String | Y | query | None | 123456 |
- Response Parameters
| Parameter | Type | Field | Description |
|---|---|---|---|
| code | Int | Error code | |
| message | String | Error message | |
| data | JSONObject | token | Access token |
| roleId | Account type: 1 = primary account; 2 = sub-account | ||
| projectId | Project ID. When roleId is 2, the ID of the assigned project is returned. When roleId is 1, select a project from the project list. |
- Primary-account login example

- Sub-account login example

2. Get the Project List
- URL
http://things-api.iotddc.com/edge-user/project/list - Request Method
post - Request Parameters
| Parameter | Type | Required | Submission Method | Default | Description |
|---|---|---|---|---|---|
| token | String | Y | header | None | Access token |
| page | Int | Y | query | 1 | Current page |
| size | Int | Y | query | 10 | Number of records per page |
- Response Parameters
| Parameter | Type | Field | Description |
|---|---|---|---|
| code | Int | Error code | |
| message | String | Error message | |
| data | JSONObject | list | Project list |
| totalPage | Total number of pages | ||
| totalRow | Total number of records | ||
| pageNumber | Current page | ||
| pageSize | Number of records per page |
- Primary-account project-list example

3. Get Data Points
Get Data Points as a List
- URL
http://things-api.iotddc.com/edge-data/data/tags - Request Method
post - Request Parameters
| Parameter | Type | Required | Submission Method | Default | Description |
|---|---|---|---|---|---|
| token | String | Y | header | None | Access token |
| projectId | int | Y | query | None | Project ID |
| page | int | Y | query | 1 | Current page |
| size | int | Y | query | 10 | Number of records per page |
| sn | String | N | query | None | Gateway SN |
| real | Boolean | N | query | None | Whether to include real-time data |
- Response Parameters
| Parameter | Type | Field | Description |
|---|---|---|---|
| code | Int | Error code | |
| message | String | Error message | |
| data | JSONObject | list | Data-point list |
| totalPage | Total number of pages | ||
| totalRow | Total number of records | ||
| pageNumber | Current page | ||
| pageSize | Number of records per page |
- Query parameter description:
snandrealare optional filter conditions. - Request example

Get Data Points as a Tree
Query by Project
- URL
http://things-api.iotddc.com/edge-data/data/getTagsTree - Request Method
post - Request Parameters
| Parameter | Type | Required | Submission Method | Default | Description |
|---|---|---|---|---|---|
| token | String | Y | header | None | Access token |
| projectId | raw.json | Y | body | None | Project ID |
- Response Parameters
| Parameter | Type | Field | Description |
|---|---|---|---|
| code | Int | Error code | |
| message | String | Error message | |
| data | JSONObject | Data-node tree | |
| name | Name of the current node. The root node is the gateway. | ||
| children | Child nodes. Second-level nodes are devices, and leaf nodes are data points. |
- Request example

Query by Gateway
- URL
http://things-api.iotddc.com/edge-data/data/getTagsTreeByGateway - Request Method
post - Request Parameters
| Parameter | Type | Required | Submission Method | Default | Description |
|---|---|---|---|---|---|
| token | String | Y | header | None | Access token |
| gatewayId | raw.json | Y | body | None | Gateway SN or gateway ID |
- Response Parameters
| Parameter | Type | Field | Description |
|---|---|---|---|
| code | Int | Error code | |
| message | String | Error message | |
| data | JSONObject | Data-node tree | |
| name | Name of the current node. The root node is the gateway. | ||
| children | Child nodes. Second-level nodes are devices, and leaf nodes are data points. |
4. Subscribe to Real-Time Data
- Real-time data is subscribed to and pushed through WebSocket.
WebSocket Connection
- URL:
ws://things-api.iotddc.com/edge-data/ws/scada/sub - Example
const url = "ws://things-api.iotddc.com/edge-data/ws/real/sub"
let socket = new WebSocket(url)
socket.onopen = function() {
console.log("ws open")
}
Send the Data Points to Subscribe To
- After the WebSocket connection is established:
socket.onopen = function () {
console.log("ws open")
// TODO: Send the subscription request in the following format.
// Multiple data points can be specified, or all data points can be subscribed to.
data = {
"type": "read",
"projectId": "44", // Project ID
"ids": [
"240117502.Device2.tag0001", // Data-point ID. ".*" subscribes to all points in the project.
// You can also subscribe by prefix, such as "240117502."
// or "240117502.Device2."
"240117502.Device2.tag0002"
]
}
}
Receive Real-Time Data
- Code example
socket.onmessage = function (evnet) {
console.log(evnet.data)
}
- Response example
{
"code": 200,
"data": [
{
"val": 37,
"id": "240117502.Device2.tag0001",
"timestamp": 1714286290,
"status": "Good"
},
{
"val": 71,
"id": "240117502.Device2.tag0002",
"timestamp": 1714286290,
"status": "Good"
}
],
"message": "success"
}
5. Query Historical Data
Raw Data Query
- URL
http://things-api.iotddc.com/edge-data/data/history - Request Method
post - Request Parameters
| Parameter | Type | Required | Submission Method | Default | Description |
|---|---|---|---|---|---|
| token | String | Y | header | None | Access token |
| projectId | Int | Y | body(raw.json) | None | Project ID |
| id | String | Y | body(raw.json) | None | Data-point ID |
| startTime | String | Y | body(raw.json) | None | Start time in yyyy-MM-dd HH:mm:ss format |
| endTime | String | Y | body(raw.json) | None | End time in yyyy-MM-dd HH:mm:ss format |
| page | Int | Y | body(raw.json) | 1 | Current page |
| size | Int | Y | body(raw.json) | 10 | Number of records per page |
- Response Parameters
| Parameter | Type | Field | Description |
|---|---|---|---|
| code | Int | Error code | |
| message | String | Error message | |
| data | JSONObject | list | Data list |
| totalPage | Total number of pages | ||
| totalRow | Total number of records | ||
| pageNumber | Current page | ||
| pageSize | Number of records per page |
- Raw data query example

Aggregated Data Query
- URL
http://things-api.iotddc.com/edge-data/data/aggQueryHistory - Request Method
post - Request Parameters
| Parameter | Type | Required | Submission Method | Default | Description |
|---|---|---|---|---|---|
| token | String | Y | header | None | Access token |
| projectId | Int | Y | body(raw.json) | None | Project ID |
| ids | List | Y | body(raw.json) | None | List of data-point IDs |
| startTime | String | Y | body(raw.json) | None | Start time in yyyy-MM-dd HH:mm:ss format |
| endTime | String | Y | body(raw.json) | None | End time in yyyy-MM-dd HH:mm:ss format |
| count | Int | Y | body(raw.json) | 1 | Aggregation interval |
| aggType | String | Y | body(raw.json) | 10 | Aggregation method |
-
Aggregation Description
Used to reduce the number of samples.
The minimum time window is1m.
Supported aggregation methods within each time window arefirst,last,min,max,sum,mean(average), andmedian. -
Response Parameters
| Parameter | Type | Field | Description |
|---|---|---|---|
| code | Int | Error code | |
| message | String | Error message | |
| data | JSONObject | list | Data list |
| totalPage | Total number of pages | ||
| totalRow | Total number of records | ||
| pageNumber | Current page | ||
| pageSize | Number of records per page |
- Aggregated data query example

6. Query Home-Page Data
- URL
http://things-api.iotddc.com/edge-data/data/ - Request Method
post - Request Parameters
| Parameter | Type | Required | Submission Method | Default | Description |
|---|---|---|---|---|---|
| token | String | Y | header | None | Access token |
| projectId | Int | Y | body | None | Project ID |
| day | Int | Y | body | 7 | Query time range |
-
Query Time-Range Description
This parameter is used only to limit the time range of daily statistical messages. -
Response Parameters
| Parameter | Type | Field | Description |
|---|---|---|---|
| code | Int | Error code | |
| message | String | Error message | |
| data | JSONObject | gateway | Number of gateways |
| device | Number of devices | ||
| tag | Number of data points | ||
| alarm | Number of alarms | ||
| writeLog | Number of write commands issued | ||
| message | Daily message-volume statistics | ||
| alertCount | Daily alarm-count statistics | ||
| log | Daily write-command-volume statistics |
- Home-page data query example

7. Issue a Control Command
- URL
http://things-api.iotddc.com/edge-data/data/writeTag - Request Method
post - Request Parameters
| Parameter | Type | Required | Submission Method | Default | Description |
|---|---|---|---|---|---|
| token | String | Y | header | None | Access token |
| tagId | Int | Y | body | None | Writable data-point ID |
| value | Int | Y | body | Value to write |
- Parameter Description
Commands can be issued only to writable points through tagId. value must be a decimal value.
- Response Parameters
| Parameter | Type | Field | Description |
|---|---|---|---|
| code | Int | Error code | |
| message | String | Error message |