Creating a Topic or Deleting Topics in Batches
Function
This API is used to create a topic or delete topics in batches.
URI
POST /v2/{project_id}/instances/{instance_id}/topics
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
project_id |
Yes |
String |
Project ID. For details, see Obtaining a Project ID. |
|
instance_id |
Yes |
String |
Instance ID. |
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
action |
No |
String |
This parameter is used to delete topics in batches. If it is not set, a topic will be created. delete: Delete consumer groups in batches. |
Request Parameters
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
name |
No |
String |
Topic name. Enter 3 to 64 characters. Use only letters, digits, percent (%), vertical bars (|), hyphens (-), and underscores (_). |
|
brokers |
No |
Array of strings |
Associated broker. This parameter is mandatory only for RocketMQ 4.8.0 instances. |
|
queue_num |
No |
Number |
Number of queues. The value ranges from 1 to 50. |
|
queues |
No |
Array of queues objects |
Queue. This parameter is mandatory only for RocketMQ 4.8.0 instances. |
|
permission |
No |
String |
Permission. This parameter is mandatory only for RocketMQ 4.8.0 instances. Options:
|
|
topics |
No |
Array of strings |
Topic list. This parameter is used when topics are deleted in batches. |
Response Parameters
Status code: 200
|
Parameter |
Type |
Description |
|---|---|---|
|
id |
String |
Topic name. |
|
job_id |
String |
Job ID for deleting topics. |
Example Requests
For RocketMQ 4.8.0 instances: Creating a topic associated with broker-0 with 3 queues
POST https://{endpoint}/v2/{project_id}/instances/{instance_id}/topics
{
"name" : "topic-test",
"brokers" : [ "broker-0" ],
"permission" : "all",
"queues" : [ {
"broker" : "broker-0",
"queue_num" : 3
} ]
}
Example Responses
Status code: 200
A topic is created or multiple topics are deleted in batches.
{
"id" : "topic-test"
}
Status Codes
|
Status Code |
Description |
|---|---|
|
200 |
A topic is created or multiple topics are deleted in batches. |
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.