Reviewed-by: Ziuzko, Stanislav <stanislav.ziuzko@t-systems.com> Co-authored-by: Chen, Junjie <chenjunjie@huawei.com> Co-committed-by: Chen, Junjie <chenjunjie@huawei.com>
17 KiB
Listing Topics of a Kafka Instance
Function
This API is used to query details about topics of a Kafka instance.
URI
GET /v2/{project_id}/instances/{instance_id}/topics
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
project_id |
Yes |
String |
Project ID. For details about how to obtain it, see Obtaining a Project ID. |
instance_id |
Yes |
String |
Instance ID. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
offset |
No |
String |
Offset, which is the position where the query starts. The value must be greater than or equal to 0. |
limit |
No |
String |
Maximum number of instances returned in the current query. The default value is 10. The value ranges from 1 to 50. |
Request Parameters
None
Response Parameters
Status code: 200
Parameter |
Type |
Description |
---|---|---|
total |
Integer |
Total number of topics. |
size |
Integer |
Maximum number of records to be displayed on a page. |
remain_partitions |
Integer |
Number of remaining partitions. |
max_partitions |
Integer |
Total number of partitions. |
topic_max_partitions |
Integer |
Maximum number of partitions in a single topic. |
topics |
Array of TopicEntity objects |
Topic list. |
Parameter |
Type |
Description |
---|---|---|
policiesOnly |
Boolean |
Whether this policy is the default policy. |
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 |
Retention period of a message. |
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. |
sync_message_flush |
Boolean |
Whether synchronous flushing is enabled. The default value is false. Synchronous flushing compromises performance. |
external_configs |
Object |
Extended configuration. |
topic_type |
Integer |
Topic type. Options: 0: common topic; 1: system (internal) topic. |
topic_other_configs |
Array of topic_other_configs objects |
Other topic configurations. |
topic_desc |
String |
Topic description. |
created_at |
Long |
Topic creation time. |
Parameter |
Type |
Description |
---|---|---|
name |
String |
Configuration name. |
valid_values |
String |
Valid value. |
default_value |
String |
Default value. |
config_type |
String |
Configuration type. The value can be dynamic or static. |
value |
String |
Configuration value. |
value_type |
String |
Configuration value type. |
Example Requests
Querying the topic list
GET https://{endpoint}/v2/{project_id}/instances/{instance_id}/topics?offset=0&limit=10
Example Responses
Status code: 200
The query is successful.
{ "total" : 1, "size" : 0, "topics" : [ { "policiesOnly" : false, "name" : "Topic-test01", "replication" : 3, "partition" : 3, "retention_time" : 72, "sync_replication" : "false", "sync_message_flush" : "false", "topic_other_configs" : [ { "name" : "max.message.bytes", "valid_values" : "[0...10485760]", "default_value" : "10485760", "config_type" : "dynamic", "value" : "10485760", "value_type" : "int" }, { "name" : "message.timestamp.type", "valid_values" : "[CreateTime, LogAppendTime]", "default_value" : "LogAppendTime", "config_type" : "dynamic", "value" : "LogAppendTime", "value_type" : "string" } ], "external_configs" : { }, "topic_type" : 0, "topic_desc" : "This is a test topic", "created_at" : 1688112779916 } ], "remain_partitions" : 294, "max_partitions" : 300, "topic_max_partitions" : 200 }
Status Codes
Status Code |
Description |
---|---|
200 |
The query is successful. |
Error Codes
See Error Codes.