tencent cloud

All product documents
IoT Hub
HTTP-Based Device Connection
Last updated: 2024-12-27 15:44:26
HTTP-Based Device Connection
Last updated: 2024-12-27 15:44:26

Parameter Description

When a device reports a message, it needs to carry ProductId, DeviceName, and TopicName to initiate an http/https request to the platform. The request API and parameters are as detailed below:
Requested URL:
https://ap-guangzhou.gateway.tencentdevices.com/device/publish
http://ap-guangzhou.gateway.tencentdevices.com/device/publish
Request method: POST

Request parameters

Parameter
Required
Type
Description
ProductId
Yes
String
Product ID
DeviceName
Yes
String
Device name
TopicName
Yes
String
Name of the topic for publishing the message
Payload
Yes
String
Content of the published message
PayloadEncoding
No
String
Encoding for the published message. Currently, only Base64-encoding is supported. If this parameter is left empty, the original message content will be sent.
Qos
Yes
Integer
Message QoS level
Note:
The API only supports the application/json format.

Signature generation

There are two types of signatures for request messages. Key authentication uses the HMACSHA256 algorithm, and certificate authentication uses the RSA_SHA256 algorithm. For more information, please see Signature Algorithm.

Platform response parameters

Parameter
Type
Description
RequestId
String
Request ID

Sample Code

Request packet

POST https://ap-guangzhou.gateway.tencentdevices.com/device/publish
Content-Type: application/json
Host: ap-guangzhou.gateway.tencentdevices.com
X-TC-Algorithm: HmacSha256
X-TC-Timestamp: 155****065
X-TC-Nonce: 5456
X-TC-Signature: 2230eefd229f582d8b1b891af7107b915972407****78ab3738f756258d7652c
{"DeviceName":"AAAAAA","Payload":"123","ProductId":"G8N****AHB","Qos":1,"TopicName":"G8N****AHB/AAAAAA/data"}

Response packet

{
"Response": {
"RequestId": "f4da4f1f-d72e-40f1-****-349fc0072ba0"
}
}


Was this page helpful?
You can also Contact Sales or Submit a Ticket for help.
Yes
No

Feedback

Contact Us

Contact our sales team or business advisors to help your business.

Technical Support

Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

7x24 Phone Support
Hong Kong, China
+852 800 906 020 (Toll Free)
United States
+1 844 606 0804 (Toll Free)
United Kingdom
+44 808 196 4551 (Toll Free)
Canada
+1 888 605 7930 (Toll Free)
Australia
+61 1300 986 386 (Toll Free)
EdgeOne hotline
+852 300 80699
More local hotlines coming soon