Updated on 2025-08-21 GMT+08:00

Executing a Check Task

Function

This API is used to execute a check task.

Calling Method

For details, see Calling APIs.

URI

POST /v2/tasks/{task_id}/run

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

task_id

Yes

String

Definition

Task ID, returned by the API for creating a check task. Each CodeArts Check task, branch task, or incremental task generated through an API has a unique ID.

Constraints

N/A

Range

N/A

Default Value

N/A

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

Definition

User token. Obtain a token by calling the IAM API forobtaining a user token. The value of X-Subject-Token in the response header is the user token.

Constraints

N/A

Range

1–100,000 characters

Default Value

N/A

Table 3 Request body parameters

Parameter

Mandatory

Type

Description

username

No

String

This parameter is deprecated.

access_token

No

String

This parameter is deprecated.

git_url

No

String

This parameter is deprecated.

git_branch

No

String

This parameter is deprecated.

ref

No

String

Definition

The method of pulling MR code from a repository. Set this parameter if MR code fails to be pulled in the check stage.

Constraints

N/A

Range

  • pull: Pull code using pull/xx/xx.

  • merge_request: Pull code using merge_request/xx/xx.

Default Value

If this parameter is not passed, the backend automatically identifies the repository type, pulling MR code from a Gitee repository using pull/xx/xx or from a non-Gitee repository using merge_request/xx/xx.

Response Parameters

Status code: 200

Table 4 Response body parameters

Parameter

Type

Description

exec_id

String

Definition

Execution record ID of a check task.

Range

32-character UUID.

Status code: 400

Table 5 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error message.

Status code: 401

Table 6 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error message.

Example Requests

Execute a check task. Pass the ref parameter if you want to specify the incremental code downloading mode.

POST https://{endpoint}/v2/tasks/{task_id}/run

{
  "ref" : "merge_request"
}

Example Responses

Status code: 200

Request succeeded!

{
  "exec_id" : "d163535d0*******81d6a7654443e"
}

Status code: 400

Bad Request

{
  "error_code" : "CC.00000000",
  "error_msg" : "Network busy. Try again later."
}

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.