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
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| project_id | Yes | String | Definition This parameter is deprecated in earlier versions and its authenticity is not verified. 32-character project UUID. Obtain it by calling the API used to query the project list. Constraints N/A Range 32-character project ID. Default Value N/A |
| task_id | Yes | String | Definition : Task ID, which is the return value of the API used to create a check task. Each check task, its brach tasks, and incremental tasks created through APIs have a unique task ID. Obtain the ID by calling the API used to query the task list. id indicates the task ID. Constraints: N/A. Value range: 1 to 32 characters. Default value: N/A. |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| page_num | No | Integer | Definition: Page index. Constraints: N/A. Value range: 1-2147483647 |
| page_size | No | Integer | Definition Number of records displayed on each page. Constraints N/A Range 1–100 |
| check_type | No | String | Definition: Task type. Constraints: N/A. Value range: Default value: branch. |
| 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
| 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 Range The length is the value of [1-100000]. Default Value N/A |
Response Parameters
Status code: 200 check_type: branch/tag
| 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 |
| Parameter | Type | Description |
|---|---|---|
| taskId | String | Definition : Task ID, which is the return value of the API used to create a check task. Each check task, its brach tasks, and incremental tasks created through APIs have a unique task ID. Obtain the ID by calling the API used to query the task list. 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: |
| status | String | Definition: Execution status of the last code check task. Value range: |
Status code: 200 check_type: mr/cr
| Parameter | Type | Description |
|---|---|---|
| incTasks | Array of IncTaskInfo objects | Definition: Details about the MR and CR tasks in the task specified by task_id. |
| total | Integer | Definition: Total number. Value range: ≥ 0. |
| Parameter | Type | Description |
|---|---|---|
| taskId | String | Definition : Task ID, which is the return value of the API used to create a check task. Each check task, its brach tasks, and incremental tasks created through APIs have a unique task ID. Obtain the ID by calling the API used to query the task list. 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: - INC_COMMIT: incremental check for the most recent commit in the pipeline, specified by commit ID, under version-level check mode (task settings > check scope > check mode). - INC_LAST_SUCCESS_COMMIT: incremental check between the commit of a specified commit ID and the commit of the ID of the last successful gate check in the pipeline. |
| status | String | Definition: Task execution status. Value range: |
| 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
| 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
| 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.
{
"incTasks" : [ {
"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
A request error occurred.
{
"error_code" : "CC.xxxxxxxx.400",
"error_msg" : "Verify request parameter failed. Check whether the request parameters are correct."
} Status code: 401
The permission is insufficient.
{
"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 | A request error occurred. |
| 401 | The permission is insufficient. |
Error Codes
See Error Codes.
What is your overall rating for this page?
Thank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot