Querying Topics
Function
This API is used to query a list of topics.
URI
GET /v2/{project_id}/mqs/instances/{instance_id}/topics
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| project_id | Yes | String | Tenant's project ID. |
| instance_id | Yes | String | Instance ID. |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| app_name | No | String | Application name. |
| name | No | String | Topic name. |
| access_policy | No | String | Permission type.
|
| limit | No | String | Maximum number of records to be displayed on a page. By default, all topics are queried. |
| offset | No | String | Offset of the pagination query. The default value is 0. |
Request Parameters
None
Response Parameters
Status code: 200
| Parameter | Type | Description |
|---|---|---|
| total | Integer | Total number of topics. |
| size | Integer | Number of topics to query. |
| permissions | Array of strings | Operation permissions. |
| topics | Array of topics objects | Topic list. |
| policies | Array of policies objects | Permission list. |
| remain_partitions | Integer | Number of remaining partitions. |
| max_partitions | Integer | Total number of partitions. |
| Parameter | Type | Description |
|---|---|---|
| policiesOnly | Boolean | Whether only the policies are updated. |
| name | String | Topic name. |
| replication | Integer | Number of replicas, which is configured to ensure data reliability. |
| partition | Integer | Number of topic partitions, which is used to set the number of concurrently consumed messages. |
| retention_time | Integer | Message retention period. |
| sync_message_flush | Boolean | Whether synchronous flushing is enabled. The default value is false. Synchronous flushing compromises performance. |
| sync_replication | Boolean | Whether synchronous replication is enabled. After this function is enabled, the acks parameter on the producer client must be set to –1. Otherwise, this parameter does not take effect. |
| app_id | String | Application ID. |
| app_name | String | Application name. |
| permissions | Array of strings | Operation permissions. |
| external_configs | Object | Other configurations. |
| description | String | Description. |
| sensitive_word | String | Sensitive word. |
| topic_type | Integer | Topic type. |
| Parameter | Type | Description |
|---|---|---|
| owner | Boolean | Whether the application is the one selected during topic creation. |
| user_name | String | Key of the integration application. |
| app_name | String | Application name. |
| access_policy | String | Permission type.
|
| tag | String | Tag corresponding to the permission type. When the permission type is all, the publish and subscribe tags are separated by ampersands (&). If there are multiple tags, use double vertical bars (||) to separate them. |
Example Requests
GET https://{endpoint}/v2/{project_id}/mqs/instances/{instance_id}/topics Example Responses
Status code: 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
} ],
"policies" : {
"owner" : false,
"user_name" : "user-test",
"app_name" : "app-test",
"access_policy" : "pub",
"tag" : "pub_tag"
},
"remain_partitions" : 37,
"max_partitions" : 300
} Status Codes
| Status Code | Description |
|---|---|
| 200 | OK |
| 400 | Bad Request |
| 403 | Forbidden |
Error Codes
See Error Codes.
Last Article: Topic Management
Next Article: Creating a Topic
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.