查询Topic列表 - ListMqsInstanceTopics
功能介绍
查询Topic列表。
调试
您可以在API Explorer中调试该接口,支持自动认证鉴权。API Explorer可以自动生成SDK代码示例,并提供SDK代码示例调试功能。
授权信息
账号具备所有API的调用权限,如果使用账号下的IAM用户调用当前API,该IAM用户需具备调用API所需的权限,具体权限要求请参见权限和授权项。
URI
GET /v2/{project_id}/mqs/instances/{instance_id}/topics
| 参数 | 是否必选 | 参数类型 | 描述 |
|---|---|---|---|
| project_id | 是 | String | 项目ID,获取方式请参见API参考的“附录 > 获取项目ID”章节。 |
| instance_id | 是 | String | 实例ID。 |
请求参数
| 参数 | 是否必选 | 参数类型 | 描述 |
|---|---|---|---|
| X-Auth-Token | 是 | String | 用户Token。通过调用IAM服务获取用户Token接口获取(响应消息头中X-Subject-Token的值)。 |
响应参数
状态码:200
| 参数 | 参数类型 | 描述 |
|---|---|---|
| total | Integer | Topic的总数。 |
| size | Integer | 当前查询的Topic数量。 |
| permissions | Array of strings | 允许操作的权限。 |
| topics | Array of topics objects | Topic列表。 |
| remain_partitions | Integer | 剩余分区数。 |
| max_partitions | Integer | 分区总数。 |
| 参数 | 参数类型 | 描述 |
|---|---|---|
| policiesOnly | Boolean | 是否只更新策略。 |
| name | String | Topic名称。 |
| replication | Integer | 副本数,配置数据的可靠性。 |
| partition | Integer | Topic分区数,设置消费的并发数。 |
| retention_time | Integer | 消息老化时间。 |
| sync_message_flush | Boolean | 是否使用同步落盘。默认值为false。同步落盘会导致性能降低。 |
| sync_replication | Boolean | 是否开启同步复制,开启后,客户端生产消息时相应的也要设置acks=-1,否则不生效,默认关闭。 |
| app_id | String | 集成应用Key。 |
| app_key | String | 集成应用Key。 |
| app_name | String | 应用名称。 |
| permissions | Array of strings | 允许操作的权限。 |
| external_configs | Object | 其他配置。 |
| description | String | 描述。 |
| sensitive_word | String | 敏感字段。 |
| topic_type | Integer | Topic类型。 |
状态码:400
| 参数 | 参数类型 | 描述 |
|---|---|---|
| error_code | String | 错误码。 |
| error_msg | String | 错误信息。 |
状态码:403
| 参数 | 参数类型 | 描述 |
|---|---|---|
| error_code | String | 错误码。 |
| error_msg | String | 错误信息。 |
请求示例
GET https://{endpoint}/v2/{project_id}/mqs/instances/{instance_id}/topics 响应示例
状态码:200
OK
{
"total" : 91,
"size" : 1,
"permissions" : [ "modify" ],
"topics" : [ {
"policiesOnly" : false,
"name" : "topic-test",
"replication" : 3,
"partition" : 3,
"retention_time" : 72,
"sync_replication" : false,
"sync_message_flush" : false,
"app_id" : "ba1408c8-xxxx-xxxx-xxxx-21a218f4xxxx",
"app_name" : "app-test",
"permissions" : [ "read", "access", "delete", "modify" ],
"external_configs" : { },
"description" : "",
"sensitive_word" : "",
"topic_type" : 0
} ],
"remain_partitions" : 37,
"max_partitions" : 300
} 状态码:400
Bad Request
{
"error_code" : 400,
"error_msg" : "Bad Request"
} 状态码:403
Forbidden
{
"error_code" : 403,
"error_msg" : "Forbidden"
} 状态码
| 状态码 | 描述 |
|---|---|
| 200 | OK |
| 400 | Bad Request |
| 403 | Forbidden |
错误码
请参见错误码。