Mengirim satu Paket dari aplikasi pada server cloud ke ApsaraMQ for MQTT.
Deskripsi operasi
The SendMessage operation is called by an application on a cloud server. This operation is complementary to the operation that is called to send a message from an ApsaraMQ for MQTT client. For information about the differences between the scenarios of sending messages from applications on cloud servers and the scenarios of sending messages from ApsaraMQ for MQTT clients, see Developer guide.
Messages that are sent by calling the SendMessage operation cannot be forwarded to ApsaraMQ for RocketMQ. If you want to use an ApsaraMQ for MQTT broker to forward messages to ApsaraMQ for RocketMQ, use an SDK to send the messages. The SendMessage operation supports up to 1,000 queries per second (QPS). For more information, see QPS limits.
Each successful call to the SendMessage operation is calculated as a message transaction per second (TPS). This affects the billing of your instance. For more information, see Billing rules.
Coba sekarang
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
mq:SendMessage |
none |
*All Resource
|
None | None |
Parameter permintaan
|
Parameter |
Type |
Required |
Description |
Example |
| MqttTopic |
string |
Yes |
Topik tempat Anda ingin mengirim Paket pada instans ApsaraMQ for MQTT. |
TopicA |
| InstanceId |
string |
Yes |
ID instans ApsaraMQ for MQTT. ID harus sama dengan ID instans yang digunakan oleh klien ApsaraMQ for MQTT. Anda dapat Tampilan ID instans di bagian Informasi Dasar pada halaman Detail Instans yang sesuai dengan instans di Konsol ApsaraMQ for MQTT. |
post-cn-0pp12gl**** |
| Payload |
string |
Yes |
Konten Paket, yaitu muatan Paket. Enkode konten dalam Base64 untuk mencegah karakter non-cetak ditransmisikan. |
test |
Untuk informasi tentang parameter lainnya, lihat Parameter umum dan Endpoint.
Elemen respons
|
Element |
Type |
Description |
Example |
|
object |
|||
| MsgId |
string |
The unique message ID that is returned by the ApsaraMQ for MQTT broker after the message is sent. |
0B736D997B7F45FF54E61C1C1B58**** |
| RequestId |
string |
The unique ID that the system generates for the request. This parameter is a common parameter. |
020F6A43-19E6-4B6E-B846-44EB31DF**** |
Contoh
Respons sukses
JSONformat
{
"MsgId": "0B736D997B7F45FF54E61C1C1B58****",
"RequestId": "020F6A43-19E6-4B6E-B846-44EB31DF****"
}
Kode kesalahan
|
HTTP status code |
Error code |
Error message |
Description |
|---|---|---|---|
| 400 | CheckAccountInfoFailed | An error occurred while checking the account information by the STS token. | |
| 400 | InstancePermissionCheckFailed | An error occurred while validating the permissions of the instance. Please verify the account that created the instance and its permissions settings. | |
| 400 | ParameterCheckFailed | An error occurred while validating the parameters. The parameters may be missing or invalid. | |
| 400 | PermissionCheckFailed | An error occurred while validating the resource permissions. Please check the account that created the instance, topic, and GroupId, and check their permission settings. | |
| 400 | InvalidParameter.%s | An error occurred while validating the parameter. The parameter may be missing or invalid. | |
| 500 | InternalError | An error occurred while processing your request. Try again later. | |
| 500 | SendMessageFailed | A storage exception occurred while sending the message. Please try again. | |
| 500 | SystemOverFlow | An error occurred while processing your request. Please try again. | |
| 404 | ApiNotSupport | The specified API is not supported. |
Lihat Error Codes untuk daftar lengkap.
Catatan rilis
Lihat Release Notes untuk daftar lengkap.