Creating a Dumping Task
Function
This API is used to create a dumping task.
Debugging
You can use API Explorer to debug this API.
URI
POST /v2/{project_id}/connectors/{connector_id}/sink-tasks
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| project_id | Yes | String | Project ID. |
| connector_id | Yes | String | Instance dump ID. The value can be obtained from response of the API for querying an instance. |
Request Parameters
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| source_type | Yes | String | Source data type. Currently, only BLOB is supported. |
| task_name | Yes | String | Name of the dumping task. |
| destination_type | Yes | String | Storage type. Currently, only OBS is supported. |
| obs_destination_descriptor | Yes | ObsDestinationDescriptor object | Description of the dump. |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| topics | Yes | String | Names of the topics to be dumped. Multiple topics can be separated by commas (,). Regular expressions are supported. Example value: topic1,topic2. |
| topics_regex | No | String | Regular expression of the topics to be dumped. Set either the topics_regex parameter or topics parameter. Do not set both of them or set it to ".*". |
| consumer_strategy | Yes | String | Dump start offset.
The default value is latest. |
| destination_file_type | Yes | String | Dump file format. Currently, only TXT files are supported. |
| access_key | Yes | String | Access key ID (AK). |
| secret_key | Yes | String | Secret access key (SK). |
| obs_bucket_name | Yes | String | Name of the OBS bucket used to store the data. |
| obs_path | No | String | OBS path. This parameter can be left blank by default. The value can contain a maximum of 50 characters, including letters, digits, underscores (_), and slashes (/). This parameter is left empty by default. |
| partition_format | No | String | Directory structure of the object file written into OBS. The directory structure is in the format of yyyy/MM/dd/HH/mm (time at which the dump task was created).
Default value: empty. After the data is dumped successfully, the storage directory structure is obs_bucket_path/file_prefix/partition_format. The default time zone is GMT+08:00. |
| record_delimiter | No | String | Delimiter for the dump file, which is used to separate the user data that is written into the dump file. The value can be:
Default value: newline (\n). |
| deliver_time_interval | Yes | Integer | User-defined interval at which data is imported into OBS. If no data is pushed during the current interval, no dump file package will be generated. Value range: 30 to 900 Unit: second. NOTE: This parameter is mandatory if streaming data is dumped to OBS. |
Response Parameters
Status code: 200
| Parameter | Type | Description |
|---|---|---|
| task_id | String | Task ID. |
Example Requests
POST https://{endpoint}/v2/{project_id}/connectors/{connector_id}/sink-tasks
{
"source_type" : "BLOB",
"task_name" : "obsTransfer-1122976956",
"destination_type" : "OBS",
"obs_destination_descriptor" : {
"consumer_strategy" : "earliest",
"destination_file_type" : "TEXT",
"access_key" : "XXXXXXXXXXXXXXXXXXXX",
"secret_key" : "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
"obs_bucket_name" : "6666",
"obs_path" : "obsTransfer-1122976956",
"partition_format" : "yyyy/MM/dd/HH/mm",
"record_delimiter" : "\n",
"deliver_time_interval" : 300,
"topics" : "topic-test"
}
} Example Responses
Status code: 200
A dumping task is created successfully.
{
"task_id" : "2962882a-386c-4c9d-bb59-3b4f55d82961"
} Status Codes
| Status Code | Description |
|---|---|
| 200 | A dumping task is created successfully. |
Error Codes
See Error Codes.
Last Article: Creating a Dump Connector for an Instance
Next Article: Listing Dumping Tasks
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.