Queries the topics on a Message Queue for Apache Kafka instance.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter Type Required Example Description
Action String Yes GetTopicList

The operation that you want to perform. Set the value to GetTopicList.

InstanceId String Yes alikafka_pre-cn-0pp1954n****

The ID of the instance whose topics you want to query.

CurrentPage String No 1

The page number of the page to return.

PageSize String No 10

The number of entries to return on each page.

RegionId String No cn-hangzhou

The region ID of the instance whose topics you want to query.

Topic String No topic_name

The name of the topic that you want to query.

Response parameters

Parameter Type Example Description
CurrentPage Integer 1

The page number of the returned page.

RequestId String C0D3DC5B-5C37-47AD-9F22-1F5598809***

The ID of the request.

Success Boolean true

Indicates whether the request is successful.

Code Integer 200

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

Message String operation success.

The returned message.

PageSize Integer 10

The number of entries returned per page.

Total Integer 1

The total number of topics.

TopicList Array of TopicVO

The information about the topics.

TopicVO
Status Integer 0

The status of the topic. Valid value:

0: indicates that the topic is running.

If this topic has been deleted, this parameter is not returned.

PartitionNum Integer 6

The number of partitions in the topic.

Remark String test

The description of the topic. The description must meet the following requirements:

  • The description can only contain letters, digits, hyphens (-), and underscores (_).
  • The description must be 3 to 64 characters in length.
CreateTime Long 1576563109000

The time when the topic was created.

Topic String topic_name

The name of the topic. The topic name must meet the following requirements:

  • The name can only contain letters, digits, hyphens (-), and underscores (_).
  • The name must be 3 to 64 characters in length. Names that contain more than 64 characters are automatically truncated.
StatusName String Running

The name of the status of the topic. Valid value:

Running

If this topic has been deleted, this parameter is not returned.

CompactTopic Boolean false

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

  • false: uses the default log cleanup policy.
  • true: uses the Apache Kafka log compaction policy.
InstanceId String alikafka_pre-cn-0pp1954n****

The ID of the instance on which the topic resides.

LocalTopic Boolean false

The storage engine of the topic. Valid values:

  • false: the Cloud Storage mode.
  • true: the Local Storage mode.
RegionId String cn-hangzhou

The region ID of the instance on which the topic resides.

Tags Array of TagVO

The tags attached to the topic.

TagVO
Key String Test

The key of the tag.

Value String Test

The value of the tag.

Examples

Sample requests

http(s)://alikafka.cn-hangzhou.aliyuncs.com/?Action=GetTopicList
&InstanceId=alikafka_pre-cn-0pp1954n****
&CurrentPage=1
&PageSize=10
&RegionId=cn-hangzhou
&Topic=topic_name
&<Common request parameters>

Sample success responses

XML format

HTTP/1.1 200 OK
Content-Type:application/xml

<GetTopicListResponse>
    <CurrentPage>1</CurrentPage>
    <RequestId>C0D3DC5B-5C37-47AD-9F22-1F5598809***</RequestId>
    <Success>true</Success>
    <Code>200</Code>
    <Message>operation success.</Message>
    <PageSize>10</PageSize>
    <Total>1</Total>
    <TopicList>
        <Status>0</Status>
        <PartitionNum>6</PartitionNum>
        <Remark>test</Remark>
        <CreateTime>1576563109000</CreateTime>
        <Topic>topic_name</Topic>
        <StatusName>Running</StatusName>
        <CompactTopic>false</CompactTopic>
        <InstanceId>alikafka_pre-cn-0pp1954n****</InstanceId>
        <LocalTopic>false</LocalTopic>
        <RegionId>cn-hangzhou</RegionId>
        <Tags>
            <Key>Test</Key>
            <Value>Test</Value>
        </Tags>
    </TopicList>
</GetTopicListResponse>

JSON format

HTTP/1.1 200 OK
Content-Type:application/json

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

Error codes

For a list of error codes, visit the API Error Center.