Help Center/ CodeArts Check/ API Reference/ APIs/ Task Management/ Creating a Check Task (Version 3)
Updated on 2026-02-03 GMT+08:00

Creating a Check Task (Version 3)

Function

This API is used to create a code check task in a project based on the project ID, repository address, branch, task name, and rule set, and returns the ID of the new code check task.

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 /v3/task

Request Parameters

Table 1 Request body parameters

Parameter

Mandatory

Type

Description

branch

Yes

String

Definition:

Repository branch.

Constraints:

N/A

Value range:

1 to 200 characters.

Default value:

N/A

config_template

Yes

CreateTaskV3ConfigTemplate object

Definition:

Task configuration template parameter, which stores configurations related to the task.

Constraints:

N/A

Value range:

N/A

Default value:

N/A

name

Yes

String

Definition:

Task name.

Constraints:

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

Value range:

1 to 128 characters.

Default value:

N/A

project_id

No

String

Definition :

32-character project UUID. Obtain it by calling the API used to query the project list.

Constraints:

N/A

Value range:

32-character project ID.

Default value:

N/A

project_name

No

String

Definition :

Project name. Obtain the name by calling the API used to query the project list.

Constraints:

N/A

Value range:

N/A

Default value:

N/A

repo_url

Yes

String

Definition:

Code repository address.

Constraints:

N/A

Value range:

For a CodeArts Repo repository, enter an address starting with git.

For a non-CodeArts Repo repository, enter an address starting with http.

Default value:

N/A

Table 2 CreateTaskV3ConfigTemplate

Parameter

Mandatory

Type

Description

repo_type

Yes

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

branch

Yes

String

Definition:

Branch name.

Constraints:

N/A

Range:

N/A

Default value:

N/A

rule_sets

Yes

Array of ConfigTemplateRuleSet objects

Definition:

Rule set list.

project_id

Yes

String

Definition :

32-character project UUID. Obtain it by calling the API used to query the project list.

Constraints:

N/A

Value range:

32-character project ID.

Default value:

N/A

project_name

Yes

String

Definition :

Project name. Obtain the name by calling the API used to query the project list.

Constraints:

N/A

Value range:

N/A

Default value:

N/A

authId

No

String

Definition:

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

Constraints:

This parameter is mandatory for repositories other than CodeArts Repo.

Range:

N/A

Default value:

N/A

authType

No

String

Definition:

Authorization type.

Constraints:

This parameter is mandatory for repositories other than CodeArts Repo.

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

Table 3 ConfigTemplateRuleSet

Parameter

Mandatory

Type

Description

language

No

String

Definition:

Language type.

Constraints:

N/A

Value range:

Custom language or system language. The following system languages are supported:

  • ArkTS

  • C#

  • Cangjie

  • C++

  • CSS

  • Go

  • HTML

  • Java

  • JavaScript

  • Kotlin

  • Lua

  • PHP

  • Python

  • Rust

  • Scala

  • Shell

  • SQL

  • Terraform

  • TypeScript

Default value:

N/A

Response Parameters

Status code: 200

Table 4 Response body parameters

Parameter

Type

Description

result

CreateTaskV3Result object

Definition:

Result of creating a check task.

httpStatus

String

Definition:

HTTP response status.

Value range:

  • OK: The request has been successfully processed, and the server returns the requested resource or operation result.

  • ACCEPTED: The request has been accepted by the server, but the processing is not complete (usually used for asynchronous operations).

  • INTERNAL_SERVER_ERROR: internal API exception.

  • BAD_REQUEST: abnormal parameter verification.

status

String

Definition:

API response status.

Value range:

  • success: successful response.

  • error: response failed.

Table 5 CreateTaskV3Result

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

Status code: 400

Table 6 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 7 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 a code check task named CppWebHookTest, with the branch being master, the check language being C++, and the repository type being CodeArts Repo in the project whose project ID is 8c7c74775f4f496596e4a39d34b209c3 and project name is projectName.

POST https://{endpoint}/v3/task

{
  "repo_url" : "git@codehub.devcloud.example.com:8c7c74775f4f496596e4a39d34b209c3/CppWebHookTest.git",
  "branch" : "master",
  "name" : "CppWebHookTest",
  "config_template" : {
    "branch" : "master",
    "repo_type" : "DevCloud",
    "rule_sets" : [ {
      "language" : "C++"
    } ],
    "project_id" : "8c7c74775f4f496596e4a39d34b209c3",
    "project_name" : "projectName"
  },
  "project_id" : "8c7c74775f4f496596e4a39d34b209c3",
  "project_name" : "projectName"
}

Example Responses

Status code: 200

Request succeeded!

{
  "httpStatus" : "OK",
  "result" : {
    "checkParamList" : [ ],
    "criterionSets" : [ ],
    "customParams" : [ ],
    "id" : "8df8d58f832a408f88e4aebea0ff6fc5",
    "modelSets" : [ ],
    "reviewData" : [ ],
    "ruleSets" : [ ],
    "taskIds" : [ ],
    "versionUpdateDelayDays" : [ ]
  },
  "status" : "success"
}

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.