Post data
POST/devices/{deviceId}/data
Base URL: https://api.tinkermode.com
Post data into backend services like time-series database, GeoTSDB, and custom log data store.
Data is routed based on pre-configured data sources specified within the request body. The endpoint
accepts a single request containing an array of data. Each data must be associated with a valid
data source catalogID and data source ID. The request will be entirely rejected if any data source
or associated data route is not found. This includes cases where a data source ID is missing or the
corresponding route is not registered. If a data source is identified but currently disabled, the
associated data will be excluded from ingestion. The remaining valid data within the request will
be processed. The response object will include a status field indicating either success or
partial. In the case of the partial result, an additional field named failedDataSources will
be present. This field contains an array listing the IDs of disabled data sources found during
ingestion.
Authentication
Send an Authorization header of the form ModeCloud <AUTH_CODE>.
Must contain a device API key of the matching device.
Path parameters
| Name | Type | Required | Constraints | Description |
|---|---|---|---|---|
deviceId | integer | Yes | Device ID |
Request body
Content type: application/json
| Property | Type | Required | Constraints | Description | |||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
data | array<object> | Yes | List of record data. | ||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||
Request example
{
"data": [
{
"body": [
{
"tags": [
"5DEF12AA3B",
"100"
],
"timestamp": "2021-04-10T01:12:22Z",
"values": [
89.8,
77,
9
]
},
{
"tags": [
"5DEF12AA3B",
"102"
],
"timestamp": "2021-04-10T01:12:32Z",
"values": [
87.2,
77,
8.33
]
},
{
"tags": [
"5DEF12AA3B",
"102"
],
"timestamp": "2021-04-10T01:12:43Z",
"values": [
87.5,
75,
7.92
]
},
{
"tags": [
"5DEF12AA3B",
"100"
],
"timestamp": "2021-04-10T01:12:52Z",
"values": [
90.3,
75,
6.01
]
}
],
"catalogId": "BU01",
"metadata": {
"tagNames": [
"pid",
"diag"
],
"valueNames": [
"loi",
"tem",
"bri"
]
},
"sourceId": "a3b2ac399abc"
},
{
"body": [
{
"areas": [
{
"areaId": "tyo_office",
"distance": 0
}
],
"attributes": {
"vendor": "mode-inc"
},
"floorId": 1234,
"geometry": {
"coordinates": [
138.7309,
35.3628,
0
],
"type": "Point"
},
"timestamp": "2021-04-10T01:12:22Z"
}
],
"catalogId": "GNSS",
"sourceId": "1085c30b"
}
]
}Responses
200 Successful submission of data.
Content type: application/json
| Property | Type | Required | Constraints | Description |
|---|---|---|---|---|
failedDataSources | array<array> | No | read-only (server-generated) | The list of data sources that failed during the data routing process. |
result | string | Yes | read-only (server-generated); one of: success, partial | The result of the data route ingestion. |
Response example
{
"failedDataSources": [
[
"bu01",
"a3b2ac399abc"
]
],
"result": "partial"
}401 Authorization is required to access this resource.
Content type: application/json
| Property | Type | Required | Constraints | Description |
|---|---|---|---|---|
data | object | No | read-only (server-generated) | Any relevant data related to error. |
reason | string | Yes | read-only (server-generated) | Reason of error. |
403 Request failed because of invalid data or denied permission.
Content type: application/json
| Property | Type | Required | Constraints | Description |
|---|---|---|---|---|
data | object | No | read-only (server-generated) | Any relevant data related to error. |
reason | string | Yes | read-only (server-generated) | Reason of error. |
429 Request failed because of rate limit.
Content type: application/json
| Property | Type | Required | Constraints | Description |
|---|---|---|---|---|
data | object | No | read-only (server-generated) | Any relevant data related to error. |
reason | string | Yes | read-only (server-generated) | Reason of error. |
500 An unexpected error has occurred.
Content type: application/json
| Property | Type | Required | Constraints | Description |
|---|---|---|---|---|
data | object | No | read-only (server-generated) | Any relevant data related to error. |
reason | string | Yes | read-only (server-generated) | Reason of error. |
503 The service is temporarily unavailable.
Content type: application/json
| Property | Type | Required | Constraints | Description |
|---|---|---|---|---|
data | object | No | read-only (server-generated) | Any relevant data related to error. |
reason | string | Yes | read-only (server-generated) | Reason of error. |