A topic is the smallest unit for subscription and publishing in DataHub. You can use a topic to represent a type or category of streaming data.
Operation description
Creates a topic resource.
Try it now
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
dhs:CreateTopic |
create |
*Topic
|
None | None |
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| ProjectName |
string |
Yes |
The name of the project. |
xiaowutest |
| TopicName |
string |
Yes |
The name of the topic. |
adsb_cat021 |
| ShardCount |
integer |
Yes |
The number of shards. |
10 |
| Lifecycle |
integer |
Yes |
The lifecycle of the topic. Unit: days. |
1 |
| RecordType |
string |
Yes |
The type of the topic. Valid values:
|
TUPLE |
| RecordSchema |
string |
No |
The schema table structure. |
"{\"fields\":[{\"name\":\"field_init\",\"type\":\"STRING\",\"notnull\":\"false\"}]}" |
| Comment |
string |
Yes |
The description of the topic. |
Test |
| ExpandMode |
boolean |
No |
The expansion mode of the topic. After the expansion mode is enabled, shards support horizontal scaling and no longer support merge or split operations. The number of shards can only increase and cannot decrease. After this mode is enabled, you can use the Kafka method to consume the current topic. |
true |
| EnableSchemaRegistry |
boolean |
No |
Specifies whether to enable multi-version schema. After this feature is enabled, a topic can have multiple schemas simultaneously. You can select one schema for writing. The consumer automatically parses each record based on the version marked on the data. If the schema of the corresponding version is deleted, parsing fails. Note
Enabling multi-version schema has the following impacts:
|
false |
Response elements
|
Element |
Type |
Description |
Example |
|
object |
|||
| RequestId |
string |
The request ID. |
2026020210000022c53d0b06900170 |
| Success |
boolean |
Indicates whether the request was successful. |
True |
| TopicName |
string |
The name of the topic. |
test01 |
Examples
Success response
JSON format
{
"RequestId": "2026020210000022c53d0b06900170",
"Success": true,
"TopicName": "test01"
}
Error codes
|
HTTP status code |
Error code |
Error message |
Description |
|---|---|---|---|
| 400 | InvalidParameter | Error:%s. | The parameter entered is illegal |
| 400 | MissingParameter | Error:%s. | Missing required parameters |
| 400 | ResourceAlreadyExist | Error:%s. | Resource already exists |
| 500 | InternalServerError | Error:%s. | Server error, server unavailable or unexpected error occurred |
| 403 | NoPermission | Error:%s. | You are not authorized to perform this operation. |
| 403 | OperationDenied | Error:%s. | Operation denied |
| 404 | ResourceNotFound | Error:%s. | Resource does not exist |
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.