UploadIoTDataToBlockchain

Updated at:

This operation uploads data from an Internet of Things (IoT) device to a blockchain. The device generates a unique data identity. The data is then added to a queue and uploaded to the blockchain asynchronously. You can later use the unique identity to query and confirm the data.

Request parameters

Name

Type

Required

Example

Description

Action

String

Yes

UploadIoTDataToBlockchain

A required parameter. Set the value to UploadIoTDataToBlockchain.

IotAuthType

String

Yes

ID2

The IoT authentication method.

ID2: Alibaba Cloud Link ID²

IotDataDID

String

Yes

did:lto:000FFFFFEAEDFDF0B4999600610B599D0000****

The unique identity of the data.

IotDataDigest

String

Yes

7A26A13A37098E36F0CB4DD16F7AE8A593343332A1E8958C265F58B5CD63****

The summary of the IoT data.

IotDataToken

String

Yes

3~2~1756E40A4FAE83E1~1629344539000~yXlx0KC51VZrycr4C0lqaeWA5tQW/944Zb9LQ5X/3qdJcgazu61apcJrdsLq****

The data token of the IoT device.

IotId

String

Yes

000FFFFFEAEDFDF0B499****

The unique identity of the IoT device.

IotIdServiceProvider

String

Yes

a1EmN0Z****

The identity of the IoT device service provider. This is the ProductKey (PK) of the product.

IotIdSource

String

Yes

1

The IoT device service provider.

1: Open Platform.

2: IoT Platform.

PlainData

String

Yes

Plaintext data

The plaintext data value to be uploaded to the blockchain.

PrivacyData

String

Yes

Privacy data

The privacy data value to be uploaded to the blockchain.

Returned data

Name

Type

Example value

Description

Code

String

00000

The response code.

Data

String

-

The response data.

Message

String

-

The detailed information when the request fails.

RequestId

String

0D80ED7B-FE21-15DF-84D6-95BA0583****

The request ID.

Success

Boolean

true

Indicates whether the request was successful.

Examples

Request example

http(s)://[Endpoint]/?Action=UploadIoTDataToBlockchain
&IotAuthType=ID2
&IotDataDID=did:lto:000FFFFFEAEDFDF0B4999600611DD31B0000****
&IotDataDigest=7A26A13A37098E36F0CB4DD16F7AE8A593343332A1E8958C265F58B5CD63****
&IotDataToken=3~2~1756E40A4FAE83E1~1629344539000~yXlx0KC51VZrycr4C0lqaeWA5tQW/944Zb9LQ5X/3qdJcgazu61apcJrdsLq****
&IotId=000FFFFFEAEDFDF0B499****
&IotIdServiceProvider=a1EmN0Z****
&IotIdSource=1
&PlainData=Plaintext data
&PrivacyData=Privacy data
&<Common request parameters>

Response example

XML format

<Message>-</Message>
<RequestId>0D80ED7B-FE21-15DF-84D6-95BA0583****</RequestId>
<Data>-</Data>
<Code>00000</Code>
<Success>true</Success>

JSON format

{
  "Message": "-",
  "RequestId": "0D80ED7B-FE21-15DF-84D6-95BA0583****",
  "Data": "-",
  "Code": "00000",
  "Success": "true"
}

Error codes

For more information, see Error codes.