プライバシーポリシー
データプライバシーとセキュリティ契約
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 in Base64 encoding.username is used for ACL authorization.Parameter | Semantics | Example Value | Optional |
instance-access-point | Access point address of the instance. Go to the TDMQ for MQTT console, choose 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 | QoS selected when sending MQTT messages, which defaults to 1, that is, at-least-once. | 1 | Yes |
Retained | Indicates whether the messages sent are retained. | false | No |
client_id | Client ID used to send MQTT messages, required for authorization verification. In the one-device-one-certificate scenario, use the Common Name field of the certificate. In other scenarios, the default value is http-${connection-id}. | curl001 | Yes |
username | Username used for connection and message sending, required for authorization verification. If the Basic Authentication header is used, extract its username part. | SampleUser | Yes |
ResponseTopic | sample/response/topic | Yes | |
CorrelationData | SN0001 | Yes | |
ContentType | application/json | Yes | |
PayloadFormatIndicator | 1 | Yes | |
MessageExpiryInterval | Message Expiry Interval, in seconds. | 3600 | Yes |
UserProp.N.Key | sampleKey | Yes | |
UserProp.N.Value | sampleValue | Yes |
Header | Semantics | Example Value |
X-Message-Id | Message identifier from the MQTT server | A9FE1FEF7EE614DAD5DC8EA6C1A60000 |
Status Code | Description |
200 | The request was processed successfully. |
400 | The server cannot process the request, usually due to missing required fields. Possible causes include: Incorrect URL path. Invalid topic name. Invalid QoS. Invalid retained value. |
401 | Authentication and authorization error. |
405 | The server does not support this HTTP method. Please use the POST method for message sending. |
429 | Too many messages sent within a short period, exceeding the quota corresponding to the MQTT instance specification. |
500 | Internal server error. |
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=false"
* Host mqtt.cloud.tencent.com:80 was resolved.* Connected to mqtt.cloud.tencent.com (::1) port 80* using HTTP/1.x> POST /topics/home?qos=1&client_id=curl-x&retained=false HTTP/1.1> Host: mqtt.cloud.tencent.com> User-Agent: curl/8.12.1> Accept: */*> Authorization: Basic dXNlcjA6c2VjcmV0MA==> Content-Length: 29> Content-Type: application/x-www-form-urlencoded>* upload completely sent off: 29 bytes< HTTP/1.1 200 OK< X-Message-Id: A9FE1FEF7EE614DAD5DC8EA6C1A60000< content-length: 0<* Connection #0 to host mqtt.cloud.tencent.com left intact
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"
フィードバック