tencent cloud

Feedback

CreateTask

Last updated: 2023-09-19 11:26:20

1. API Description

Domain name for API request: dlc.tencentcloudapi.com.

This API is used to create and execute a SQL task. (CreateTasks is recommended.)

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: CreateTask.
Version Yes String Common Params. The value used for this API: 2021-01-25.
Region Yes String Common Params. For more information, please see the list of regions supported by the product.
Task Yes Task Computing task. This parameter contains the task type and related configuration information.
DatabaseName No String Database name. If there is a database name in the SQL statement, the database in the SQL statement will be used first; otherwise, the database specified by this parameter will be used (note: when submitting the database creation SQL statement, passed in an empty string for this field).
DatasourceConnectionName No String Name of the default data source
DataEngineName No String Data engine name. If this parameter is not specified, the task will be submitted to the default engine.

3. Output Parameters

Parameter Name Type Description
TaskId String Task ID
Note: This field may return null, indicating that no valid values can be obtained.
RequestId String The unique request ID, which is returned for each request. RequestId is required for locating a problem.

4. Example

Example1 Creating and executing a Spark task

u200cThis example shows you how to create and execute a SQL task.

Input Example

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

{
    "Task": {
        "SQLTask": {
            "SQL": "U0VMRUNUICogRlJPTSBgdGVzdGh5d2AuYHRlc3QxMDBtYCBMSU1JVCAxMDs=",
            "Config": [
                {
                    "Key": "",
                    "Value": ""
                }
            ]
        },
        "SparkSQLTask": {
            "SQL": "",
            "Config": [
                {
                    "Key": "",
                    "Value": ""
                }
            ]
        }
    },
    "DatabaseName": "testdb"
}

Output Example

{
    "Response": {
        "RequestId": "13bfd2b2-b92e-4c49-9c7e-3662b5f32165",
        "TaskId": "4ad30ca9-8b0e-499f-b4e1-d6e43ba0e564"
    }
}

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
InternalError An internal error occurred.
InternalError.DBError A database error occurred.
InvalidParameter The parameter is incorrect.
InvalidParameter.InvalidDataEngineName The data engine name is invalid.
InvalidParameter.InvalidSQL SQL parsing failed.
InvalidParameter.InvalidSQLNum The number of SQL statements does not meet the specification.
InvalidParameter.InvalidStoreLocation The storage location is incorrect.
ResourceNotFound The resource does not exist.
ResourceNotFound.ResultOutputPathNotFound The result path was not found.
ResourceUnavailable.BalanceInsufficient The account balance is insufficient to run the SQL task.
UnauthorizedOperation.UseComputingEngine The sub-user does not have permission to use the compute engine.