Updated on 2026-02-03 GMT+08:00

Querying Branches

Function

This API is used to query the task list by project ID, task ID, and task type on multiple pages. You can query the branch tasks, tag tasks, MR tasks, and commit tasks under a 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:get

Read

task *

-

-

-

-

codeartscheck:ProjectId

URI

GET /v3/{project_id}/tasks/{task_id}/branches

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

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

task_id

Yes

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

Table 2 Query Parameters

Parameter

Mandatory

Type

Description

page_num

No

Integer

Definition:

Page index.

Constraints:

N/A

Value range:

1–100

page_size

No

Integer

Definition:

Number of records displayed on each page.

Constraints:

N/A

Value range:

1–100

check_type

No

String

Definition:

Task type.

Constraints:

N/A

Value range:

  • branch: branch

  • tag: tag.

  • mr: merge request.

  • cr: change request.

Default value:

N/A

offset

No

Integer

Definition:

This parameter is deprecated and serves no purpose. Do not use it.

Constraints:

N/A

Value range:

N/A

Default value:

N/A

limit

No

Integer

Definition:

This parameter is deprecated and serves no purpose. Do not use it.

Constraints:

N/A

Value range:

N/A

Default value:

N/A

Request Parameters

Table 3 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

Definition :

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

Constraints:

N/A

Value range:

1–100,000 characters.

Default value:

N/A

Response Parameters

Status code: 200 check_type: branch/tag

Table 4 Response body parameters

Parameter

Type

Description

branchTasks

Array of BranchTaskInfo objects

Definition:

Details about the branch and tag tasks in the task specified by task_id.

total

Integer

Definition:

Total number.

Value range:

≥0

Table 5 BranchTaskInfo

Parameter

Type

Description

taskId

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.

Value range:

1 to 32 characters.

branchName

String

Definition:

Branch name.

Value range:

N/A

isDefault

String

Definition:

Default branch or not

Value range:

  • true: default branch.

  • false: not a default branch.

status

String

Definition:

Execution status of the last code check task.

Value range:

  • quering: initial state.

  • running: The task is running.

  • success: check successful.

  • failed: check failed.

  • aborted: task aborted.

Status code: 200 check_type: mr/cr

Table 6 Response body parameters

Parameter

Type

Description

branchTasks

Array of IncTaskInfo objects

Details about the MR and CR tasks in the task specified by task_id.

total

Integer

Total number.

Table 7 IncTaskInfo

Parameter

Type

Description

taskId

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.

Value range:

1 to 32 characters.

mergeId

String

Definition:

MR ID for MR queries or Git commit ID for CR queries.

Value range:

N/A

jobType

String

Definition:

Task type.

Value range:

  • FULL: version-level task.

  • INC_GIT: gate-level task.

  • INC_COMMIT: incremental check of a specified commit ID in a pipeline.

  • INC_LAST_SUCCESS_COMMIT: incremental check between the commit ID specified by a pipeline and the commit ID of the last successful gate check.

status

String

Definition:

Task execution status.

Value range:

  • quering: initial state.

  • running: The task is running.

  • success: check successful.

  • failed: check failed.

  • aborted: task aborted.

startTime

String

Definition:

Check start time (UTC). Format: yyyy-MM-ddTHH:mm:ssZ. For example, 2025-11-28T06:55:41Z.

Value range:

N/A

finishTime

String

Definition:

Check end time (UTC). Format: yyyy-MM-ddTHH:mm:ssZ. For example, 2025-11-28T06:55:41Z.

Value range:

N/A

mergeInfo

String

Definition:

MR information.

Value range:

N/A

jobId

String

Definition :

Execution record ID, that is, the unique ID of each version or quality gate scan. Obtain the ID by calling the API used to execute the check task.

Value range:

N/A

Status code: 400

Table 8 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 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

Example Requests

Query the information about the branch tasks that have been created under the task specified by task_id.

GET https://{endpoint}/v3/{project_id}/tasks/{task_id}/branches

Example Responses

Status code: 200 check_type: branch/tag

Request succeeded!

{
  "branchTasks" : [ {
    "taskId" : "11223344xxxxxxxx11223344xxxxxxx1",
    "branchName" : "dev01",
    "isDefault" : "false",
    "status" : "failed"
  }, {
    "taskId" : "11223344xxxxxxxx11223344xxxxxxx2",
    "branchName" : "master",
    "isDefault" : "true",
    "status" : "success"
  } ],
  "total" : 6
}

Status code: 200 check_type: mr/cr

Request succeeded!

{
  "branchTasks" : [ {
    "taskId" : "e6f59xxxx4fc46bcabfxxxxfa502fe56",
    "mergeId" : "2",
    "jobType" : "INC_GIT",
    "status" : "success",
    "startTime" : "2025-01-15T12:23:51Z",
    "finishTime" : "2025-01-15T12:25:06Z",
    "mergeInfo" : "test",
    "jobId" : "49e3bbxxxx8842819da744d9xxxx8478"
  } ],
  "total" : 23
}

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 check_type: branch/tag

Request succeeded!

200 check_type: mr/cr

Request succeeded!

400

Bad Request

401

Unauthorized

Error Codes

See Error Codes.