You can call this operation to create a topic.
This operation is usually called when you need to create new topics to publish new applications or implement service logic.
By default, only Alibaba Cloud accounts can call this operation. Resource Access Management (RAM) users can call this operation only after being authorized.
Debugging
Request parameters
Parameter | Type | Required | Example | Description |
---|---|---|---|---|
Action | String | Yes | OnsTopicCreate |
The operation that you want to perform. Set the value to OnsTopicCreate. |
InstanceId | String | Yes | MQ_INST_111111111111_DOxxxxxx |
The ID of the Message Queue for Apache RocketMQ instance corresponding to the topic that you want to create. |
MessageType | Integer | Yes | 0 |
The type of messages in the topic. Valid values:
|
Topic | String | Yes | test |
The name of the topic that you want to create.
|
Remark | String | No | test |
The description of the topic. |
Response parameters
Parameter | Type | Example | Description |
---|---|---|---|
RequestId | String | B6949B58-223E-4B75-B4FE-7797C15E2D1F |
The ID of the request. This is a common parameter that facilitates troubleshooting and fault locating. |
Examples
Sample requests
http(s)://[Endpoint]/? Action=OnsTopicCreate
&InstanceId=MQ_INST_111111111111_DOxxxxxx
&MessageType=0
&Topic=test
&<Common request parameters>
Sample success responses
XML
format
<OnsTopicCreateResponse>
<RequestId>B6949B58-223E-4B75-B4FE-7797C15E2D1F</RequestId>
</OnsTopicCreateResponse>
JSON
format
{
"RequestId": "B6949B58-223E-4B75-B4FE-7797C15E2D1F"
}
Error codes
For a list of error codes, visit the API Error Center.