http(s)://${instance-access-point}/topics/${url-encoded-topic-name}?qos=${qos}&retained=${retained}&client_id=${ClientId}&username=${Username}
Authorization: Basic <credentials><credentials> = username:password is the Base64 encoding.username participates in ACL authorization.Parameter | Semantics | Example Value | Optional |
instance-access-point | Endpoint address of the instance. Go to the Tencent Distributed Message Queue (MQTT) Console, click Resource > Cluster > Instance ID, and enter the basic information page to obtain it. | mqtt-example-sh-public.mqtt.tencenttdmq.com | No |
url-encoded-topic-name | Topic name to be sent, URL encoded. | home | No |
QoS | Select QoS when sending MQTT messages, default value is 1, i.e., at-least-once. | 1 | Yes |
Retained | Whether the sent messages are retained messages. | false | No |
client_id | Using client-id to send MQTT messages, involved in authorization verification. If in the one device one certificate scenario, use the Common Name field of the certificate. In other scenes, the default value is http-${connection-id}. | curl001 | Yes |
username | Username used for connection and sending, involved in authorization verification. If using Basic Authentication Header, extract the username part from the Basic Authentication Header. | SampleUser | Yes |
ResponseTopic | sample/response/topic | Yes | |
CorrelationData | SN0001 | Yes | |
ContentType | application/json | Yes | |
PayloadFormatIndicator | 1 | Yes | |
MessageExpiryInterval | Message Expiry Interval, unit: seconds | 3600 | Yes |
UserProp.N.Key | sampleKey | Yes | |
UserProp.N.Value | sampleValue | Yes |
curl --verbose --request POST -H "Authorization: Basic dXNlcjA6c2VjcmV0MA==" --data "{ \\"message\\": \\"Hello, world\\" }" "http://mqtt.cloud.tencent.com/topics/home?qos=1&client_id=curl-x&retained=true"
curl --verbose -k --request POST -H "Authorization: Basic dXNlcjA6c2VjcmV0MA==" --data "{ \\"message\\": \\"Hello, world\\" }" "https://mqtt.cloud.tencent.com/topics/home?qos=1&client_id=curl-x&retained=true&username=sample-user"
curl --tlsv1.2 \\--cacert CA.crt \\--cert client.chain.crt \\--key client.pkcs8.key \\--verbose \\--request POST \\--data "{ \\"message\\": \\"Hello, world\\" }" \\"https://mqtt.cloud.tencent.com/topics/home?qos=1"
文档反馈