All Products
Search
Document Center

IoT Platform:WriteDevicesHotStorageData

更新時間:Oct 20, 2023

Writes the data of a custom topic to time series data storage.

Usage notes

The WriteDevicesHotStorageData operation is available only for Standard and Exclusive Enterprise Edition instances.

Limits

The volume of data that you can write per second to the time series data storage of an Enterprise Edition instance by calling this operation varies based on the value that you specified for the Time-series Data Storage IOPS parameter when you purchased the instance. For more information, see Purchase Enterprise Edition instances.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter

Type

Required

Example

Description

Action

String

Yes

WriteDevicesHotStorageData

The operation that you want to perform. Set the value to WriteDevicesHotStorageData.

IotInstanceId

String

Yes

iot-2w****

The instance ID. You can view the instance ID on the Overview page in the IoT Platform console.

Items

String

Yes

{ "Power": { "value": "on", "time": 1524448722000 }, "WF": { "value": 23.6, "time": 1524448722000 } }

The data that you want to write. Specify the value in a JSON object.

{
    "key1": {
        "value":xxx1
        "time":yyy1
    },
    "key2": {
        "value":xxx2
        "time":yyy2
    }
}
  • key1 and key2: the field identifiers. The value of Items can contain multiple fields.

  • value: the field value. The following data types are supported: INT32, FLOAT, DOUBLE, TEXT, DATE, BOOLEAN, ENUM, STRUCT, and ARRAY. For more information, see Supported data types.

  • time: the timestamp of the field value. Specify a UNIX timestamp representing the number of milliseconds that have elapsed since January 1, 1970, 00:00:00 UTC.

UserTopic

String

Yes

user/a***/b***

The name of the custom topic. Specify other levels that are required by the custom topic after the user level.

For more information, see Use custom topics.

ProductKey

String

No

a1BwAGV****

The ProductKey of the product to which the device belongs.

Important

If you specify this parameter, you must also specify DeviceName.

DeviceName

String

No

device1

The DeviceName of the device.

Important

If you specify this parameter, you must also specify ProductKey.

IotId

String

No

y4u2weAI********HMle1234

The device ID.

Important

IotId specifies a GUID for the device. The value of IotId is equivalent to the combination of the values of ProductKey and DeviceName. If you specify this parameter, you do not need to specify ProductKey or DeviceName. If you specify IotId, ProductKey, and DeviceName, the value of IotId takes precedence.

In addition to the preceding operation-specific request parameters, you must specify common request parameters when you call this operation. For more information, see Common parameters.

Response parameters

Parameter

Type

Example

Description

Code

String

iot.system.SystemException

The error code returned if the request failed. For more information, see the Error codes section of this topic.

ErrorMessage

String

A system exception occurred.

The error message returned if the request failed.

RequestId

String

E55E50B7-40EE-4B6B-8BBE-D3ED55CCF565

The request ID.

Success

Boolean

true

Indicates whether the request was successful. Valid values:

  • true

  • false

Examples

Sample requests

http(s)://iot.cn-shanghai.aliyuncs.com/?Action=WriteDevicesHotStorageData
&IotInstanceId=iot-2w****
&Items={ "Power": { "value": "on", "time": 1524448722000 }, "WF": { "value": 23.6, "time": 1524448722000 } }
&UserTopic=user/a***/b***
$ProductKey=a1BwAGV****
$DeviceName=device1
&<Common request parameters>

Sample success responses

XML format

<WriteDevicesHotStorageDataResponse>
  <RequestId>E55E50B7-40EE-4B6B-8BBE-D3ED55CCF565</RequestId>
  <Success>true</Success>
</WriteDevicesHotStorageDataResponse>

JSON format

{
    "RequestId": "E55E50B7-40EE-4B6B-8BBE-D3ED55CCF565",
    "Success": true
}

Error codes

HTTP status code

Error code

Error message

Description

400

iot.device.InvalidFormattedDeviceName

The DeviceName format is invalid.

The format of DeviceName is invalid.

400

iot.device.NullDeviceName

The DeviceName parameter cannot be empty.

DeviceName is not specified.

400

iot.device.SetDevicePropertyFailed

An error occurred while setting the device properties.

The system failed to configure the device properties.

400

iot.prod.InvalidFormattedProductkey

The ProductKey format is invalid.

The format of ProductKey is invalid.

400

iot.prod.NotExistedProduct

The specified product does not exist.

The product that you specify does not exist.

400

iot.prod.NullProductKey

The ProductKey parameter cannot be empty.

ProductKey is not specified.

400

iot.check.InvalidFormattedParameter

The parameter format is invalid.

The formats of one or more parameters are invalid.

400

iot.messagebroker.HALFCONN

The specified operation has failed. The device is in an inactive status.

The heartbeat failed to be detected when the device is inactive.

400

iot.messagebroker.OFFLINE

The specified operation has failed. The device is offline.

The system failed to connect the device to IoT Platform when the device is offline.

400

iot.prod.QueryProductAbilitiesFailed

An error occurred while querying the product features.

The system failed to obtain the features of the product.

400

iot.system.IllegalRequest

The request parameter is invalid.

One or more request parameters are invalid.

400

iot.dataalgo.ScriptMethodNotFound

Method is not found in script.

The method does not exist in the script.

400

iot.dataalgo.ScriptExecutionTimeout

Script execution timeout.

A timeout error occurred when the script was being run.

400

iot.dataalgo.ScriptExecutionOomException

Script execution is out of memory.

The memory usage limit is exceeded when the script was being run.

400

Iot.Device.NotExistedDevice

The device does not exist.

The device does not exist or is not activated.

400

iot.device.InvalidIoTId

The specified device ID is invalid.

The device ID is invalid.

400

iot.dataalgo.ScriptExecutionException

Script execution exception.

An exception occurred when the script was being run.

400

iot.prod.QueryPropertyNotFound

Query property not found.

The properties that you queried do not exist.

400

iot.dataalgo.ScriptDataFormatException

Script function result format is incorrect.

The script format is invalid.

400

iot.dataalgo.ScriptRelationNotExist

Script relation not exist.

The script relationship does not exist.

400

iot.tsl.TslParseError

TSLlParseError: %s.

The %s Thing Specification Language (TSL) parsing error occurred.

400

iot.tsl.InvalidFormattedTslError

The TSL format is invalid.

The format of the TSL data is invalid.

400

iot.tsl.InvalidHistoryTimestampError

The history timestamp is invalid.

The timestamp that you specify is invalid.

400

iot.storage.HotStorageCapacityNotEnough

The timeline storage capacity not enough.

The capacity of time series data storage is insufficient.

400

iot.storage.HotStorageIopsWriteNotEnough

The timeline storage write IOPS is not enough.

The write IOPS of time series data storage is insufficient.

For a list of error codes, see Service error codes.