Updated on 2023-12-28 GMT+08:00

Reporting a Device Message

Function

This API is used for a device to report custom data to IoTDA, which then forwards reported messages to an application or other Huawei Cloud services for storage and processing.

URI

Request Method

POST

URI

/v5/devices/{device_id}/sys/messages/up

Transport Protocol

HTTPS

Request Parameters

Parameter

Mandatory

Type

Location

Description

access_token

Yes

String

Header

Access token returned after the device authentication API is called.

Value length: 1–256 characters

device_id

Yes

String

Path

Device ID, which uniquely identifies a device. The value of this parameter is specified during device registration or allocated by IoTDA. If the value is allocated by the platform, the value is in the format of [product_id]_[node_id].

The value is a string of no more than 128 characters. Only letters, digits, underscores (_), and hyphens (-) are allowed.

Value length: 1–128 characters

This API allows a device to use a request body to report custom data to IoTDA, which then forwards the body content to an application or other Huawei Cloud services for storage and processing. IoTDA has no specific format requirements on the body content. This API can carry data whose size is smaller than 1 MB.

Example Request

POST https://{endpoint}/v5/devices/{device_id}/sys/messages/up
Content-Type: application/json
access_token: ******
{
  "name" : "name",
  "id" : "id",
  "content" : "messageUp"
}

Example Response

Status Code: 200 ok

Error Code

HTTP Status Code

HTTP Status Code Description

Error Code

Error Message

Error Description

400

Bad Request

IOTDA.000006

Invalid input data.

Invalid request parameters.

403

Forbidden

IOTDA.000004

Invalid access token.

Invalid token.

IOTDA.021101

Request reached the maximum rate limit.

The request frequency has reached the upper limit.

IOTDA.021102

The request rate has reached the upper limit of the tenant, limit %s.

The request frequency has reached the upper limit of the tenant.