tencent cloud

APIs

CreateKafkaRecharge

下载
聚焦模式
字号
最后更新时间: 2026-06-10 15:01:50

1. API Description

Domain name for API request: cls.intl.tencentcloudapi.com.

This API is used to create a Kafka data subscription task.

A maximum of 20 requests can be initiated per second for this API.

We recommend you to use API Explorer
Try it
API Explorer provides a range of capabilities, including online call, signature authentication, SDK code generation, and API quick search. It enables you to view the request, response, and auto-generated examples.

2. Input Parameters

The following request parameter list only provides API request parameters and some common parameters. For the complete common parameter list, see Common Request Parameters.

Parameter Name Required Type Description
Action Yes String Common Params. The value used for this API: CreateKafkaRecharge.
Version Yes String Common Params. The value used for this API: 2020-10-16.
Region Yes String Common Params. For more information, please see the list of regions supported by the product.
TopicId Yes String Import the target topic ID of CLS.
-Obtain the log topic Id through Get Log Topic List.
- Obtain the log topic Id through Create Log Topic.
Name Yes String Kafka data import configuration name
KafkaType Yes Integer Kafka type. Valid values: 0 (Tencent Cloud CKafka) and 1 (customer's Kafka).
UserKafkaTopics Yes String List of Kafka topics to import data from. Separate multiple topics with commas (,).
Offset Yes Integer Position for data import. Valid values: -2 (earliest, default) and -1 (latest).
LogRechargeRule Yes LogRechargeRuleInfo Log Import Rules.
KafkaInstance No String Tencent Cloud CKafka instance ID. Required when KafkaType is 0.
-Obtain the instance id through Get Instance List Information.
ServerAddr No String Service address, which is required when KafkaType is 1.
IsEncryptionAddr No Boolean Whether ServerAddr is an encrypted connection. Required when KafkaType is 1.
Protocol No KafkaProtocolInfo Encrypted Access Protocol.
When KafkaType is 1 and IsEncryptionAddr is true, Protocol is required.
ConsumerGroupName No String User Kafka consumer group name.
-A consumption group is a scalable and fault-tolerant consumer mechanism provided by Kafka. Multiple consumers exist in a consumption group, and all consumers in the group consume subscribed messages of the Topic. A consumer can consume multiple partitions simultaneously, but one Partition can only be consumed by one consumer in the group.
UserKafkaMeta No UserKafkaMeta User kafka extended information

3. Output Parameters

Parameter Name Type Description
Id String Kafka data import configuration ID
RequestId String The unique request ID, generated by the server, will be returned for every request (if the request fails to reach the server for other reasons, the request will not obtain a RequestId). RequestId is required for locating a problem.

4. Example

Example1 Creating a Kafka Data Import Rule

This example shows you how to create a Kafka data import rule.

Input Example

POST / HTTP/1.1
Host: cls.intl.tencentcloudapi.com
Content-Type: application/json
X-TC-Action: CreateKafkaRecharge
<Common request parameters>

{
    "TopicId": "b53fe5be-7ee3-4031-8043-5a73bad4f572",
    "Name": "testname",
    "KafkaType": 1,
    "ServerAddr": "192.168.0.1:9095",
    "IsEncryptionAddr": true,
    "UserKafkaTopics": "topic-1212123123,topic-sadf5r32f3ww",
    "ConsumerGroupName": "consumer-group-name",
    "Offset": -1,
    "LogRechargeRule": {
        "DefaultTimeSrc": 0,
        "DefaultTimeSwitch": true,
        "EncodingFormat": 0,
        "RechargeType": "minimalist_log",
        "UnMatchLogKey": "LogParseFailure",
        "UnMatchLogSwitch": true,
        "UnMatchLogTimeSrc": 0
    },
    "Protocol": {
        "Protocol": "plaintext"
    }
}

Output Example

{
    "Response": {
        "RequestId": "abc",
        "Id": "xxx-xx-xx"
    }
}

5. Developer Resources

SDK

TencentCloud API 3.0 integrates SDKs that support various programming languages to make it easier for you to call APIs.

Command Line Interface

6. Error Code

The following only lists the error codes related to the API business logic. For other error codes, see Common Error Codes.

Error Code Description
FailedOperation Operation failed.
FailedOperation.Timeout Operation timed out
InternalError Internal error.
InvalidParameter Incorrect parameter.
InvalidParameter.DbDuplication The unique key of database conflicts.
InvalidParameterValue Incorrect parameter value.
MissingParameter Missing parameter.
OperationDenied.AccountDestroy The account has been terminated.
OperationDenied.AccountIsolate The account has overdue payments.
OperationDenied.AccountNotExists The account does not exist.
ResourceNotFound.TopicNotExist The log topic does not exist.

帮助和支持

本页内容是否解决了您的问题?

填写满意度调查问卷,共创更好文档体验。

文档反馈