Help Center/ CodeArts Check/ API Reference/ APIs/ Task Management/ Cloning Tasks Asynchronously in Batches
Updated on 2026-02-03 GMT+08:00

Cloning Tasks Asynchronously in Batches

Function

This API is used to asynchronously clone tasks in batches based on the task ID or template task ID. You can reconfigure parameters such as the project ID, task name, code repository address, and branch name for the tasks to be cloned. The ID and progress of each asynchronous task are returned.

Calling Method

For details, see Calling APIs.

Authorization Information

Each account root user has all the permissions required to call all APIs, but IAM users must be assigned the following required identity policy-based permissions. For details about the required permissions, see Permissions Policies and Supported Actions.

Action

Access Level

Resource Type (*: required)

Condition Key

Alias

Dependencies

codeartscheck:task:create

Write

task *

-

-

-

-

codeartscheck:ProjectId

URI

POST /v4/tasks/{task_id}/batch/async-copy

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

task_id

Yes

String

Definition :

Task ID or template task ID.

  • Task ID, returned by the API for creating a check task. Each code check task, branch task, or incremental task generated through an API has a unique ID. Obtain the ID by calling the API used to . id indicates the task ID.
    • Template task ID: Obtain the ID by calling the API used to

    . data.id indicates the task ID.

Constraints:

N/A

Value range:

N/A

Default value:

N/A

Request Parameters

Table 2 Request body parameters

Parameter

Mandatory

Type

Description

[items]

Yes

Array of CopyAsyncTaskInfo objects

Definition:

Parameters required for creating tasks in batches based on a task template.

Constraints:

N/A

Table 3 CopyAsyncTaskInfo

Parameter

Mandatory

Type

Description

name

No

String

Definition:

Task name.

Constraints:

1 to 128 characters. The value can contain any letters, digits, periods (.), hyphens (-), and underscores (_).

Range:

N/A

Default value:

N/A

taskClassificationId

No

String

Definition:

Task group ID. When a task group is created, the system returns a task group ID.

Constraints:

N/A

Value range:

N/A

Default value:

N/A

repoUrl

No

String

Definition:

Code repository address.

Constraints:

N/A

Value range:

  • Repo repository: an address starting with git.

  • Non-repo repository: an address starting with http.

Default value:

N/A

projectId

No

String

Definition :

You can obtain the 32-character UUID by calling the API used to query the project list.

Constraints:

N/A

Value range:

32-character project ID.

Default value:

N/A

branchName

No

String

Definition:

Name of the code repository branch.

Constraints:

N/A

Range:

N/A

Default value:

N/A

configTemplate

No

configTemplate object

Definition:

Configuration template.

Constraints:

N/A

Table 4 configTemplate

Parameter

Mandatory

Type

Description

authId

No

String

Definition:

The ID of an existing code source endpoint for storing repository information in a project.

Constraints:

N/A

Range:

N/A

Default value:

N/A

authType

No

String

Definition:

Authorization type.

Constraints:

N/A

Value range:

  • DevCloud: CodeArts Repo repository.

  • Gitee: Gitee repository.

  • GitHub: GitHub repository.

  • GitPub: Git repository.

  • gitcode: GitCode repository.

  • gitlab: GitLab repository.

  • self_gitlab: self-built GitLab repository.

  • tfs_git: TFS repository.

  • bitbucket: Bitbucket repository.

Default value:

N/A

repoType

No

String

Definition:

Code repository type.

Constraints:

N/A

Value range:

  • DevCloud: CodeArts Repo repository.

  • Gitee: Gitee repository.

  • GitHub: GitHub repository.

  • GitPub: Git repository.

  • gitcode: GitCode repository.

  • gitlab: GitLab repository.

  • self_gitlab: self-built GitLab repository.

  • tfs_git: TFS repository.

  • bitbucket: Bitbucket repository.

Default value:

N/A

Response Parameters

Status code: 200

Table 5 Response body parameters

Parameter

Type

Description

[items]

Array of AsyncCopyTaskInfo objects

Definition:

Asynchronous task list.

Table 6 AsyncCopyTaskInfo

Parameter

Type

Description

id

String

Definition:

Asynchronous job ID. The asynchronous task ID of each task is returned when tasks are created in batches based on the template.

Value range:

N/A

create_time

String

Definition:

Task creation time.

Value range:

N/A

type

String

Definition:

Asynchronous task type. When tasks are created in batches based on the template, the value is CopyTask.

Value range:

CopyTask.

status

String

Definition:

Asynchronous task status.

Value range:

  • RUNNING: The asynchronous task is running.

  • SUCCESS: The asynchronous task is complete.

user

AsyncCopyTaskUser object

Definition:

User information of an asynchronous task.

result

AsyncCopyTaskResult object

Definition:

Result of creating an asynchronous task.

Table 7 AsyncCopyTaskUser

Parameter

Type

Description

user_id

String

Definition:

User ID, which is the same as the IAM user ID.

Value range:

N/A

domain_id

String

Definition:

Tenant ID, which is the same as the IAM tenant ID.

Value range:

N/A

region

String

Definition:

Huawei Cloud region.

Value range:

N/A

Table 8 AsyncCopyTaskResult

Parameter

Type

Description

id

String

Definition :

Task ID, returned by the API for creating a check task. Each code check task, branch task, or incremental task generated through an API has a unique ID. Obtain the ID by calling the API used to . id indicates the task ID.

Constraints:

N/A

Value range:

1 to 32 characters.

Default value:

N/A

projectId

String

Definition :

You can obtain the 32-character UUID by calling the API used to query the project list.

Value range:

1 to 32 characters.

Status code: 400

Table 9 Response body parameters

Parameter

Type

Description

error_code

String

Definition:

Error code.

Value range:

N/A

error_msg

String

Definition:

Error message.

Value range:

N/A

Status code: 401

Table 10 Response body parameters

Parameter

Type

Description

error_code

String

Definition:

Error code.

Value range:

N/A

error_msg

String

Definition:

Error message.

Value range:

N/A

Example Requests

Create two tasks using the task template with the task ID 21ac33fdfaae4132bcb88cf0a6a7a2d3. The repositories of the two tasks are from CodeArts Repo. Their project IDs are 213d2d49dbb2473e9c8d4f117ab1b0dc and bc17c7dd92c84e84be62185b5e383e90, respectively. Their Git URLs are git@codehub.devcloud.example.com:213d2d49dbb2473e9c8d4f117ab1b0dc/phoenix-sample.git and git@codehub.devcloud.example.com:bc17c7dd92c84e84be62185b5e383e90/fortran_test.git, respectively.

POST https://{endpoint}/v4/tasks/21ac33fdfaae4132bcb88cf0a6a7a2d3/batch/async-copy

[ {
  "name" : "task_name1",
  "taskClassificationId" : "no_grouped",
  "repoUrl" : "git@codehub.devcloud.example.com:213d2d49dbb2473e9c8d4f117ab1b0dc/phoenix-sample.git",
  "projectId" : "213d2d49dbb2473e9c8d4f117ab1b0dc",
  "branchName" : "master",
  "configTemplate" : {
    "repoType" : "DevCloud"
  }
}, {
  "name" : "task_name2",
  "taskClassificationId" : "no_grouped",
  "repoUrl" : "git@codehub.devcloud.example.com:bc17c7dd92c84e84be62185b5e383e90/fortran_test.git",
  "projectId" : "bc17c7dd92c84e84be62185b5e383e90",
  "branchName" : "master",
  "configTemplate" : {
    "repoType" : "DevCloud"
  }
} ]

Example Responses

Status code: 200

Request succeeded!

[ {
  "id" : "24426b3d522f40719e22c4867fb79f3b",
  "create_time" : "2025-09-09 11:50:41",
  "type" : "CopyTask",
  "status" : "RUNNING",
  "user" : {
    "user_id" : "4050544ea69a40dabf28310fc3d10a09",
    "domain_id" : "389efb76b1354e4482eabeed25c895e4",
    "region" : "cn-north-7"
  }
}, {
  "id" : "b7875294d47841d48c4728c7ca17994a",
  "create_time" : "2025-09-09 11:50:41",
  "type" : "CopyTask",
  "status" : "RUNNING",
  "user" : {
    "user_id" : "4050544ea69a40dabf28310fc3d10a09",
    "domain_id" : "389efb76b1354e4482eabeed25c895e4",
    "region" : "cn-north-7"
  }
} ]

Status code: 400

Bad Request

{
  "error_code" : "CC.xxxxxxxx.400",
  "error_msg" : "Verify request parameter failed. Check whether the request parameters are correct."
}

Status code: 401

Unauthorized

{
  "error_code" : "CC.00000003",
  "error_msg" : "Authentication information expired."
}

Status Codes

Status Code

Description

200

Request succeeded!

400

Bad Request

401

Unauthorized

Error Codes

See Error Codes.