tencent cloud

Feedback

CreateKafkaRecharge

Last updated: 2024-07-24 10:56:37

    1. API Description

    Domain name for API request: cls.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 No String Common Params. This parameter is not required for this API.
    TopicId Yes String Target topic ID
    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 CKafka instance ID, which is required when KafkaType is set to 0
    ServerAddr No String Service address, which is required when KafkaType is set to 1
    IsEncryptionAddr No Boolean Whether the service address uses an encrypted connection, which is required when KafkaType is set to 1
    Protocol No KafkaProtocolInfo Encrypted Access ProtocolWhen KafkaType is 1 and IsEncryptionAddr is true, Protocol is required
    ConsumerGroupName No String Kafka consumer group name

    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.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.
    Contact Us

    Contact our sales team or business advisors to help your business.

    Technical Support

    Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

    7x24 Phone Support