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

NameTypeRequiredConstraintsDescription
deviceIdintegerYesDevice ID

Request body

Content type: application/json

PropertyTypeRequiredConstraintsDescription
dataarray<object>YesList of record data.
Properties of data
PropertyTypeRequiredConstraintsDescription
bodyarray<object>YesTime-series data. Each entry contains the timestamp of the value in RFC3339 format.
catalogIdstringYesData Source Catalog ID for the measurement data.
metadataobjectNoMetadata let the server pass additional information with an data routing request from the client.
sourceIdstringYesData Source ID for the measurement 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

PropertyTypeRequiredConstraintsDescription
failedDataSourcesarray<array>Noread-only (server-generated)The list of data sources that failed during the data routing process.
resultstringYesread-only (server-generated); one of: success, partialThe 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

PropertyTypeRequiredConstraintsDescription
dataobjectNoread-only (server-generated)Any relevant data related to error.
reasonstringYesread-only (server-generated)Reason of error.

403 Request failed because of invalid data or denied permission.

Content type: application/json

PropertyTypeRequiredConstraintsDescription
dataobjectNoread-only (server-generated)Any relevant data related to error.
reasonstringYesread-only (server-generated)Reason of error.

429 Request failed because of rate limit.

Content type: application/json

PropertyTypeRequiredConstraintsDescription
dataobjectNoread-only (server-generated)Any relevant data related to error.
reasonstringYesread-only (server-generated)Reason of error.

500 An unexpected error has occurred.

Content type: application/json

PropertyTypeRequiredConstraintsDescription
dataobjectNoread-only (server-generated)Any relevant data related to error.
reasonstringYesread-only (server-generated)Reason of error.

503 The service is temporarily unavailable.

Content type: application/json

PropertyTypeRequiredConstraintsDescription
dataobjectNoread-only (server-generated)Any relevant data related to error.
reasonstringYesread-only (server-generated)Reason of error.