All Products
Search
Document Center

ApsaraMQ for Kafka:GetTopicList

Last Updated:Mar 15, 2024

Queries the information about a topic.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer.

Authorization information

The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:

  • Operation: the value that you can use in the Action element to specify the operation on a resource.
  • Access level: the access level of each operation. The levels are read, write, and list.
  • Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
    • The required resource types are displayed in bold characters.
    • If the permissions cannot be granted at the resource level, All Resources is used in the Resource type column of the operation.
  • Condition Key: the condition key that is defined by the cloud service.
  • Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
OperationAccess levelResource typeCondition keyAssociated operation
alikafka:ListTopicRead
  • All Resources
    *
    none
none

Request parameters

ParameterTypeRequiredDescriptionExample
InstanceIdstringYes

The ID of the instance.

alikafka_pre-cn-0pp1954n****
CurrentPagestringNo

The page number of the page to return. Default value: 1.

1
PageSizestringNo

The number of entries to return on each page. Default value: 10

10
RegionIdstringNo

The region ID of the instance to which the topics that you want to query belong.

cn-hangzhou
TopicstringNo

The name of the topic that you want to query.

topic_name

Response parameters

ParameterTypeDescriptionExample
object
CurrentPageinteger

The page number of the returned page.

1
RequestIdstring

The ID of the request.

C0D3DC5B-5C37-47AD-9F22-1F559880****
Successboolean

Indicates whether the request was successful.

true
Codeinteger

The HTTP status code returned. The HTTP status code 200 indicates that the request is successful.

200
Messagestring

The message returned.

operation success.
PageSizeinteger

The number of entries returned on each page.

10
Totalinteger

The number of topics.

1
TopicListobject []

The information about the topic.

Statusinteger

The status of the topic. Valid values:

0: indicates that the topic is running.

If the topic is deleted, this parameter is not returned.

0
PartitionNuminteger

The number of partitions in the topic.

6
Remarkstring

The description of the topic. Valid values:

  • The description contains only letters, digits, hyphens (-), and underscores (_).
  • The description is 3 to 64 characters in length.
test
CreateTimelong

The timestamp that indicates when the topic was created. Unit: milliseconds.

1576563109000
Topicstring

The name of the topic. Valid values:

  • The name contains only letters, digits, hyphens (-), and underscores (_).
  • The name is 3 to 64 characters in length. If the name that you specified contains more than 64 characters, the returned name is automatically truncated.
topic_name
StatusNamestring

The status of the topic. Valid values:

Running

If the topic is deleted, this parameter is not returned.

Running
CompactTopicboolean

The log cleanup policy that is used for the topic. This parameter is returned when the LocalTopic parameter is set to true. Valid values:

  • false: The topic uses the default log cleanup policy.
  • true: The topic uses the log compaction policy.
false
InstanceIdstring

The ID of the instance

alikafka_pre-cn-0pp1954n****
LocalTopicboolean

The type of storage used by the topic. Valid values:

  • false: The topic uses cloud storage.
  • true: The topic uses local storage.
false
RegionIdstring

The region ID of the instance to which the topics that you want to query belong.

cn-hangzhou
Tagsobject []

The tags.

Keystring

The tag key.

Test
Valuestring

The tag value.

Test

Examples

Sample success responses

JSONformat

{
  "CurrentPage": 1,
  "RequestId": "C0D3DC5B-5C37-47AD-9F22-1F559880****",
  "Success": true,
  "Code": 200,
  "Message": "operation success.",
  "PageSize": 10,
  "Total": 1,
  "TopicList": {
    "TopicVO": [
      {
        "Status": 0,
        "PartitionNum": 6,
        "Remark": "test",
        "CreateTime": 1576563109000,
        "Topic": "topic_name",
        "StatusName": "Running\n",
        "CompactTopic": false,
        "InstanceId": "alikafka_pre-cn-0pp1954n****",
        "LocalTopic": false,
        "RegionId": "cn-hangzhou",
        "Tags": {
          "TagVO": [
            {
              "Key": "Test",
              "Value": "Test"
            }
          ]
        },
        "AutoCreate": false
      }
    ]
  }
}

Error codes

For a list of error codes, visit the Service error codes.

Change history

Change timeSummary of changesOperation
2021-11-22The request parameters of the API has changedsee changesets
Change itemChange content
Input ParametersThe request parameters of the API has changed.
    Added Input Parameters: Topic