1.接口协议:
POST https://[endpoint].ctapi.ctyun.cn/v2/exchange/create
请求参数 | 是否必填 | 位置 | 参数类型 | 说明 |
prodInstId | 是 | json | String | 实例ID |
vhost | 是 | json | String | vhost名称(vhost需提前创建,否则接口放回成功但不会真正创建交换机) |
name | 是 | json | String | 队列名称 |
type | 是 | json | 单选(direct、topic、fanout、headers) | 交换器类型 |
durable | 否 | json | Boolean | 是否持久化 |
auto_delete | 否 | json | Boolean | 是否自动删除 |
internal | 否 | json | Boolean | 是否为内部Exchange。取值: · false:否 · true:是
|
alternate-exchange | 否 | json | String | 备用交换器 |
响应参数 | 参数类型 | 描述 |
statusCode | String | 接口系统层面状态码。成功:800,失败:900 |
message | String | 描述状态 |
returnObj | String | 返回对象。此参数所包含的参数请见“响应示例"里面的注释 |
2.请求示例:
`POST https://[endpoint].ctapi.ctyun.cn/v2/exchange/create`
{
"prodInstId":"9b9bea76b7ce412ca18f99ccc1ea717b" ,
"vhost": "/",
"name": "exchangetest2",
"durable": true,
"auto_delete": true,
"internal": false,
"type": "direct",
"alternate-exchange": "tesssa1"
}
3.返回示例:
成功响应示例
{
"returnObj": {
"data": null
},
"message": "success",
"statusCode": "800"
}
失败响应示例
{
"returnObj": {
"data": "{\"error\":\"not_found\",\"reason\":\"vhost_not_found\"}"
},
"message": "...",
"statusCode": "900"
}