Adding a Binding
Function
This API is used to add a binding.
URI
POST /v2/rabbitmq/{project_id}/instances/{instance_id}/vhosts/{vhost}/exchanges/{exchange}/binding
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| project_id | Yes | String | Project ID. For details, see Obtaining a Project ID. |
| instance_id | Yes | String | Instance ID. |
| vhost | Yes | String | Virtual host name. If the name contains a slash (/), replace it with __F_SLASH__. Otherwise, the calling fails. For example, if the virtual host name is /test, the input parameter is __F_SLASH__test. |
| exchange | Yes | String | Exchange name. |
Request Parameters
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| destination | Yes | String | Name of a target exchange or queue. |
| routing_key | Yes | String | Definition Binding key-value. This parameter informs the exchange of which queues or exchanges to deliver messages to. Constraints
Range N/A Default Value N/A |
| destination_type | Yes | String | Definition Type of the binding target. Constraints N/A Range
Default Value N/A |
Response Parameters
Status code: 200
| Parameter | Type | Description |
|---|---|---|
| source | String | Binding source. |
| destination_type | String | Definition Type of the binding target. Range
|
| destination | String | Name of a target exchange or queue. |
| routing_key | String | Binding key-value. This parameter informs the exchange of which queues to deliver messages to. |
Example Requests
Binding test-exchange to a Queue target named mirror-queue with routing key routing_key_1
POST /v2/rabbitmq/{project_id}/instances/{instance_id}/vhosts/default/exchanges/test-exchange/binding
{
"destination_type" : "Queue",
"destination" : "mirror-queue",
"routing_key" : "routing_key_1"
} Example Responses
Status code: 200
Successful
{
"source" : "exchange_name",
"destination_type" : "Queue",
"destination" : "queue_name",
"routing_key" : "binding_key_demo"
} Status Codes
| Status Code | Description |
|---|---|
| 200 | Successful |
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