Creating an Exchange
Function
This API is used to create an exchange.
Calling Method
For details, see Calling APIs.
URI
PUT /v2/rabbitmq/{project_id}/instances/{instance_id}/vhosts/{vhost}/exchanges
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
project_id |
Yes |
String |
Project ID. |
|
instance_id |
Yes |
String |
Instance ID. |
|
vhost |
Yes |
String |
Virtual host name. |
Request Parameters
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
name |
Yes |
String |
Exchange name. |
|
type |
Yes |
String |
Type (direct, fanout, topic, or headers) |
|
durable |
No |
Boolean |
Indicates whether to enable data persistence. |
|
auto_delete |
Yes |
Boolean |
Indicates whether to enable automatic deletion. |
|
internal |
No |
Boolean |
Internal exchange. |
Response Parameters
Status code: 200
|
Parameter |
Type |
Description |
|---|---|---|
|
durable |
Boolean |
Indicates whether data persistence is enabled. |
|
default |
Boolean |
Indicates whether the exchange is default. |
|
internal |
Boolean |
Indicates whether the exchange is internal. |
|
name |
String |
Exchange name. |
|
auto_delete |
Boolean |
Indicates whether automatic deletion is enabled. |
|
type |
String |
Exchange type. |
|
vhost |
String |
Virtual host. |
Example Requests
Creating an exchange
POST /v2/rabbitmq/{project_id}/instances/{instance_id}/vhosts/{vhost}/exchanges
{
"name" : "exchange_name_demo",
"type" : "direct",
"durable" : true,
"auto_delete" : false,
"internal" : false
}
Example Responses
Status code: 200
Successful
{
"name" : "exchange_name_demo",
"type" : "direct",
"durable" : true,
"auto_delete" : false,
"internal" : false,
"vhost" : "default"
}
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.