Sending a Message
Function
This API is used to send a message.
URI
POST /v2/{engine}/{project_id}/instances/{instance_id}/messages
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| engine | Yes | String | Definition Engine. Constraints N/A Range Default Value N/A |
| project_id | Yes | String | Definition Project ID. For details about how to obtain it, see Obtaining a Project ID. Constraints N/A Range N/A Default Value N/A |
| instance_id | Yes | String | Definition Instance ID. You can call the API for querying all instances to obtain the instance ID. The instance ID is in the response body. Constraints N/A Range N/A Default Value N/A |
Request Parameters
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| topic | Yes | String | Definition Topic name. Constraints N/A Range N/A Default Value N/A |
| body | Yes | String | Definition Message content. Constraints N/A Range N/A Default Value N/A |
| property_list | No | Array of SendMessagePropertiesReqEntity objects | Definition Feature list. Constraints N/A Range N/A Default Value N/A |
Response Parameters
Status code: 200
| Parameter | Type | Description |
|---|---|---|
| topic | String | Definition Topic name. Range N/A |
| body | String | Definition Message content. Range N/A |
| property_list | Array of SendMessagePropertiesRespEntity objects | Definition Feature list. |
| msg_id | String | Definition Message ID. Range N/A |
| queue_id | Number | Definition Queue ID. Range N/A |
| queue_offset | Number | Definition Queue offset. Range N/A |
| broker_name | String | Definition Broker name. Range N/A |
Example Requests
Sending a message
POST https://{endpoint}/v2/{engine}/{project_id}/instances/{instance_id}/messages
{
"topic" : "aaaaaaaaaaaa",
"body" : "test",
"property_list" : [ ]
} Example Responses
Status code: 200
Message sent.
{
"topic" : "aaaaaaaaaaaa",
"body" : "test",
"property_list" : [ {
"name" : "UNIQ_KEY",
"value" : "644F0069A35A0FC5A0FC5AB7244F4573A03FA"
} ],
"msg_id" : "644F0E2A315323EAB33D8F4733110009",
"queue_id" : 0,
"queue_offset" : 0,
"broker_name" : "broker-0"
} Status Codes
| Status Code | Description |
|---|---|
| 200 | Message sent. |
Error Codes
See Error Codes.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot