Modifying Topics of a Kafka Instance
Function
This API is used to modify topics of a Kafka instance.
Calling Method
For details, see Calling APIs.
URI
PUT /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. |
Request Parameters
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
topics |
No |
Array of topics objects |
Definition List of topics to be modified. Constraints N/A |
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
id |
Yes |
String |
Definition Topic name, which cannot be modified. Constraints N/A Range N/A Default Value N/A |
|
retention_time |
No |
Integer |
Definition Aging time in hour. Constraints N/A Range 0–720 Default Value N/A |
|
sync_replication |
No |
Boolean |
Definition Whether synchronous replication is enabled. Constraints N/A Range
Default Value N/A |
|
sync_message_flush |
No |
Boolean |
Definition Whether synchronous flushing is enabled. Constraints N/A Range
Default Value N/A |
|
new_partition_numbers |
No |
Integer |
Definition Number of partitions. Constraints N/A Range N/A Default Value N/A |
|
new_partition_brokers |
No |
Array of integers |
Definition Broker list specified when partitions are added. Constraints N/A Range N/A Default Value N/A |
|
topic_other_configs |
No |
Array of topic_other_configs objects |
Definition Topic configuration. Constraints N/A |
|
topic_desc |
No |
String |
Definition Topic description. Constraints N/A Range N/A Default Value N/A |
Response Parameters
Status code: 204
The modification is successful.
None
Example Requests
Modifying parameters of topic-1284340884. Specifically, change the aging time to 72 hours, the number of partitions to 6, timestamp to LogAppendTime, max. batch size to 10485760, specify new partitions on broker-1 and broker-2, and disable synchronous replication and flushing.
PUT https://{endpoint}/v2/{project_id}/instances/{instance_id}/topics
{
"topics" : [ {
"id" : "test01",
"retention_time" : 72,
"sync_replication" : false,
"sync_message_flush" : false,
"new_partition_numbers" : 6,
"new_partition_brokers" : [ 1, 2 ],
"topic_other_configs" : [ {
"name" : "message.timestamp.type",
"value" : "LogAppendTime"
}, {
"name" : "max.message.bytes",
"value" : 10485760
} ],
"topic_desc" : "This is a test topic"
} ]
}
Example Responses
None
Status Codes
|
Status Code |
Description |
|---|---|
|
204 |
The modification is successful. |
Error Codes
See Error Codes.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.