从服务端应用向云消息队列 MQTT 版发送单条消息。
接口说明
调试
您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。
调试
授权信息
|
操作 |
访问级别 |
资源类型 |
条件关键字 |
关联操作 |
|
mq:SendMessage |
none |
*全部资源
|
无 | 无 |
请求参数
|
名称 |
类型 |
必填 |
描述 |
示例值 |
| MqttTopic |
string |
是 |
云消息队列 MQTT 版的 Topic,即消息发送的目标 Topic。 |
TopicA |
| InstanceId |
string |
是 |
云消息队列 MQTT 版实例的 ID,一定要和客户端实际使用的实例 ID 匹配。您可以在控制台实例详情页面的基础信息区域查看。 |
post-cn-0pp12gl**** |
| Payload |
string |
是 |
消息内容,即消息负载。建议自行做 Base64 编码,避免传输不可见字符。 |
test |
返回参数
|
名称 |
类型 |
描述 |
示例值 |
|
object |
|||
| MsgId |
string |
消息的唯一标识,消息发送成功后服务端会返回消息 ID。 |
0B736D997B7F45FF54E61C1C1B58**** |
| RequestId |
string |
公共参数,每个请求的 ID 都是唯一的。 |
020F6A43-19E6-4B6E-B846-44EB31DF**** |
示例
正常返回示例
JSON格式
{
"MsgId": "0B736D997B7F45FF54E61C1C1B58****",
"RequestId": "020F6A43-19E6-4B6E-B846-44EB31DF****"
}
错误码
|
HTTP status code |
错误码 |
错误信息 |
描述 |
|---|---|---|---|
| 400 | CheckAccountInfoFailed | An error occurred while checking the account information by the STS token. | 解析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. | 实例权限校验失败,请确认MQTT实例的所属关系以及授权策略。 |
| 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. | 资源权限校验失败,请检查实例、Topic和Group ID的所属权限和授权策略。 |
| 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. | MQTT后端服务异常,请重试。 |
| 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. | 当前接口不支持,请检查。 |
访问错误中心查看更多错误码。
变更历史
更多信息,参考变更详情。