Querying Tasks
Function
This API is used to query code check tasks in a project based on the project ID, task name, task group ID, and task execution status. Information such as the task name, code repository address, branch, configuration template ID, and rule set is 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:list | List | task * | - | - | - |
| - | codeartscheck:ProjectId |
URI
GET /v1/tasks
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| page | No | Integer | Definition: Page number. Constraints: ≥ 1. Value range: 1–2,147,483,647 Default value: N/A |
| page_size | No | Integer | Definition: Page size. Constraints: The value ranges from 1 to 200. Value range: 1–200 Default value: N/A |
| search | No | String | Definition: Name of the task to be searched for. Constraints: N/A Value range: N/A 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: 1 to 32 characters. Default value: N/A. |
| review_result_types | No | String | Definition: Gate check result. Constraints: N/A Value range: Default value: N/A |
| job_status_types | No | String | Definition: Check status. Constraints: N/A Value range: Default value: N/A |
| order_by_execute_time | No | String | Definition: Whether to sort tasks by execution time. Constraints: N/A Value range: Default value: N/A |
| task_classification_id | No | String | Definition: Group ID of a task. You can obtain the group ID by calling the API for listing group information of a project. Constraints: N/A Value range: N/A Default value: N/A |
| repo_url | No | String | Definition: Code repository address. Constraints: N/A Value range: N/A Default value: N/A |
| branch | No | String | Definition: Branch. Constraints: N/A Value range: N/A Default value: N/A |
| repo_url_full_match | No | String | Definition: This parameter is used together with repo_url to determine whether to completely match repo_url when tasks are queried. Constraints: N/A Value range:
Default value: false |
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 |
| Content-Type | Yes | String | Definition Encoding format. Constraints N/A Range N/A Default Value application/json: The return value is in JSON format for any input value. |
| operator | No | String | Definition: Operator username. Constraints: N/A. Value range: 1 to 128 characters. Default value: N/A. |
Response Parameters
Status code: 200
| Parameter | Type | Description |
|---|---|---|
| httpStatus | String | Definition: HTTP response status. Value range: |
| result | ShowTasksListResult object | Definition Response body for querying tasks. |
| status | String | Definition: API response status. Value range: |
| Parameter | Type | Description |
|---|---|---|
| info | Array of TaskBasicInfo objects | Definition Task list. |
| total | Integer | Definition: Total number of code check tasks. Range: N/A |
| Parameter | Type | Description |
|---|---|---|
| branchName | String | Definition: Branch name. Range: N/A |
| canDelete | Boolean | Definition Whether granted the permission for deleting the task. Range |
| canEdit | Boolean | Definition: Whether the user has the edit permission. Value range: |
| canExecute | Boolean | Definition: Whether the user has the execute permission. Value range: |
| canRead | Boolean | Definition: Whether the user has the read permission. Value range: |
| configTemplate | ConfigTemplateBasicInfo object | Definition: Configuration template details. |
| configTemplateId | String | Definition: ID of the task configuration template. Value range: 1 to 128 characters. |
| createTime | String | Definition: Task creation time (UTC). Format: yyyy-MM-ddTHH:mm:ssZ. For example, 2025-11-28T06:55:41Z. Value range: N/A |
| id | 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 128 characters. |
| isFollowed | Boolean | Definition: Whether a task is favorited. Value range: |
| jobResult | JobResultInfo object | Definition Execution result. |
| lastJob | JobBasicInfo object | Definition Execution record information. |
| lastUpdateTime | String | Definition: Time (UTC) when a task was last updated. Format: yyyy-MM-ddTHH:mm:ssZ. For example, 2025-11-28T06:55:41Z. Value range: N/A |
| name | String | Definition: code check task name. Range: N/A |
| owner | String | Definition: Owner of a code check task. Range: N/A |
| projectId | String | Definition : 32-character project UUID. Obtain it by calling the API used to query the project list. Value range: 1 to 32 characters. |
| projectName | String | Definition: Project name. Range: N/A |
| region | String | Definition: Huawei Cloud region. Range: N/A |
| repoUrl | String | Definition: Code repository address. Range: N/A |
| ruleSets | Array of ConfigTemplateRuleSetInfo objects | Definition Rule set configuration list. |
| ruleType | String | Definition: Task type. Value range: |
| taskGroupId | String | Definition: Task group ID. Value range: 1 to 128 characters. |
| Parameter | Type | Description |
|---|---|---|
| arch | String | Definition: Executor type. Range: x86 or Arm. |
| branch | String | Definition: Branch name. Range: N/A |
| createTime | String | Definition: Configuration template creation time (UTC). Format: yyyy-MM-ddTHH:mm:ssZ. For example, 2025-11-28T06:55:41Z. Value range: N/A |
| creator | String | Definition: Creator of the configuration template. Range: N/A |
| exclude | String | Definition: Excluded directories in a task. Range: N/A |
| id | String | Definition: Configuration template ID. The configuration template ID is required for modifying the configuration information. Each CodeArts Check task and its branch tasks have the same unique configuration template ID. Value range: N/A |
| includePaths | String | Definition: Checked directory. If you do not specify any directory, all code files in the code repository are checked. If you specify one or more directories, only the files in the specified directories are checked. Range: N/A |
| lastReviser | String | Definition: Last modifier name. Range: N/A |
| lastUpdateTime | String | Definition: Time (UTC) when the configuration template was last modified. Format: yyyy-MM-ddTHH:mm:ssZ. For example, 2025-11-28T06:55:41Z. Value range: N/A |
| name | String | Definition: Name of a configuration template. Range: N/A |
| projectId | String | Definition : 32-character project UUID. Obtain it by calling the API used to query the project list. Value range: 1 to 32 characters. |
| projectName | String | Definition: Project name. Range: N/A |
| region | String | Definition: Huawei Cloud region. Range: N/A |
| repoType | String | Definition: Code repository type. Value range: |
| repoUrl | String | Definition: Code repository address. Range: N/A |
| resourcePoolId | String | Definition: ID of an enabled agent pool. Leave this parameter as an empty string ("") when using built-in executors. Value range: N/A |
| resourcePoolName | String | Definition: Name of an enabled agent pool. Leave this parameter blank when using built-in executors. Range: N/A |
| resource_pool_type | String | Definition: Enabled agent pool type. Value range: |
| reviewData | Array of ReviewDataInfoResponse objects | Definition Task gate configurations. |
| reviewDataJson | String | Definition: JSON characters of the task gate configurations. Range: N/A |
| ruleSets | Array of ConfigTemplateRuleSetInfo objects | Definition Rule set configuration list. |
| Parameter | Type | Description |
|---|---|---|
| compareType | String | Definition: Calculation logic. Range: The value is ≤. |
| isCheck | Integer | Definition Gate switch. Range |
| name | String | Definition: Gate item. Range: Number of critical issues. Number of major issues. Number of minor issues. Number of suggestions. |
| value | Integer | Definition: Gate threshold. Value range: ≥0 |
| Parameter | Type | Description |
|---|---|---|
| executor | String | Definition: Name of the user who executes the task. Range: N/A |
| finishTime | String | Definition: Execution completion time (UTC). Format: yyyy-MM-ddTHH:mm:ssZ. For example, 2025-11-28T06:55:41Z. Value range: N/A |
| jobResult | JobResultInfo object | Definition Execution result. |
| 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. |
| process | ProcessInfo object | Definition Execution record information. |
| startTime | String | Definition: Execution start time (UTC). Format: yyyy-MM-ddTHH:mm:ssZ. For example, 2025-11-28T06:55:41Z. Value range: N/A |
| status | String | Definition: Task execution status. Range: |
| 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. |
| Parameter | Type | Description |
|---|---|---|
| CRITICAL | Integer | Definition: Number of major issues. Value range: ≥0 |
| DELAYSTATUS_COUNT | Integer | Definition: Number of deferred issues. Value range: ≥0 |
| FATAL | Integer | Definition: Number of critical issues. Value range: ≥0 |
| GENERAL | Integer | Definition: Number of minor issues. Value range: ≥0 |
| INFO | Integer | Definition: Number of information issues. Value range: ≥0 |
| PROMPT | Integer | Definition: Number of suggestions. Value range: ≥0 |
| codeLine | Integer | Definition: Number of scanned code lines, excluding blank and comment lines. Value range: ≥0 |
| defectCount | Integer | Definition: Total bugs. Value range: ≥0 |
| dismissed | Integer | Definition: Number of ignored issues. Value range: ≥0 |
| fileTotal | Integer | Definition: Total number of files. Value range: ≥0 |
| fixed | Integer | Definition: Number of fixed issues. Value range: ≥0 |
| id | String | Definition: Execution ID, which is returned by the API of code check task execution. Each code check task has a unique execution ID. Value range: N/A |
| jobId | String | Definition: Execution ID, which is returned by the API of code check task execution. Each code check task has a unique execution ID. Value range: N/A |
| newUnsolvedDefectCount | Integer | Definition: Number of new issues that are not resolved. Value range: ≥0 |
| nonSecurityDefectCount | Integer | Definition: Number of non-security issues. Value range: ≥0 |
| reviewResult | String | Definition: Gate check result. Range: |
| securityDefectCount | Integer | Definition: Number of security issues. Value range: ≥0 |
| solvedDefectCount | Integer | Definition: Number of resolved issues. Range: N/A |
| unsolvedDefectCount | Integer | Definition: Number of unresolved issues. Range: N/A |
| Parameter | Type | Description |
|---|---|---|
| exeTime | String | Definition: Execution time, in seconds. Range: N/A |
| executeTime | String | Definition: Execution time. The format is %dm%ds, for example, 6m6s. Value range: N/A |
| message | String | Definition: Execution process. Range: N/A |
| process | String | Definition: Task execution progress, in percentage. Range: N/A |
| status | String | Definition: Task execution status. Range: |
| Parameter | Type | Description |
|---|---|---|
| language | String | Definition Language type. Range Custom language or system language. The following system languages are supported: |
| ruleSetId | String | Definition: Rule set ID. Value range: 1 to 32 characters. |
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 code check task list of the project whose project ID is 685ddb216a12457593569a753e4d5573.
GET https://{endpoint}/v1/tasks?project_id=685ddb216a12457593569a753e4d5573 Example Responses
Status code: 200
The task list is displayed.
{
"httpStatus" : "OK",
"result" : {
"info" : [ {
"avastarType" : "pure-green",
"branchName" : "master",
"canDelete" : true,
"canEdit" : true,
"canExecute" : true,
"canRead" : true,
"checkParamList" : [ ],
"configTemplate" : {
"arch" : "X86",
"branch" : "master",
"checkersVersions" : [ ],
"configImageMappings" : [ ],
"createTime" : "2024-10-30T08:43:41Z",
"creator" : "codecheck_gray02",
"customParams" : [ ],
"delayTime" : [ ],
"engines" : [ ],
"exclude" : "",
"groups" : "",
"id" : "107fc738969b11ef8ce6fa163e4dad77",
"includePaths" : "",
"lastReviser" : "codecheck_gray02",
"lastUpdateTime" : "2024-10-30T08:43:41Z",
"manifestFile" : "",
"matchRepos" : "",
"modelSets" : [ ],
"name" : "template_107fc738969b11ef8ce6fa163e4dad77",
"parentId" : "",
"projectId" : "edd273b35def47278140367342aeb5e3",
"projectName" : "Engine baseline cases (do not modify)",
"region" : "suzhou",
"repoType" : "DevCloud",
"repoUrl" : "git@codehub.devcloud.cn-north-5.huaweicloud.com:edd273b35def47278140367342aeb5e3/engine_codemars_guiyi_java.git",
"resourcePoolId" : "",
"resourcePoolName" : "",
"resource_pool_type" : "",
"reviewData" : [ {
"compareType" : "≤",
"isCheck" : 1,
"name" : "Number of critical issues.",
"value" : 0
}, {
"compareType" : "≤",
"isCheck" : 1,
"name" : "Member of major issues.",
"value" : 0
}, {
"compareType" : "≤",
"isCheck" : 0,
"name" : "Number of minor issues.",
"value" : 0
}, {
"compareType" : "≤",
"isCheck" : 0,
"name" : "Number of suggestions.",
"value" : 0
} ],
"reviewDataJson" : "[{\"compareType\":\"≤\",\"isCheck\":1,\"name\":\"Number of critical issues\",\"value\":0},{\"compareType\":\"≤\",\"isCheck\":1,\"name\":\"Number of major issues\",\"value\":0},{\"compareType\":\"≤\",\"isCheck\":0,\"name\":\"Number of minor issues\",\"value\":0},{\"compareType\":\"≤\",\"isCheck\":0,\"name\":\"Number of suggestion issues\",\"value\":0}]",
"ruleSets" : [ {
"language" : "JAVA",
"ruleSetId" : "d2feb9c786054a8aa93ffc10dabb0b2b"
} ],
"toolImage" : "",
"toolVersionId" : "",
"type" : "private",
"versionUpdateDelayDays" : [ ],
"ymlPath" : "",
"zone" : "green"
},
"configTemplateId" : "107fc738969b11ef8ce6fa163e4dad77",
"createTime" : "2024-10-30T08:43:41Z",
"criterionSets" : [ ],
"customParams" : [ ],
"id" : "51c9e8f2af4d49769c4e47e31243a3fd",
"isDelete" : 1,
"isFollowed" : true,
"jobId" : "676672b0933e4c18a04e22d2df896364",
"jobNum" : 0,
"jobResult" : {
"DELAYSTATUS_COUNT" : 0,
"codeLine" : 616213,
"defectCount" : 181187,
"id" : "676672b0933e4c18a04e22d2df896364",
"jobId" : "676672b0933e4c18a04e22d2df896364",
"newUnsolvedDefectCount" : 6,
"nonSecurityDefectCount" : 0,
"reviewResult" : "error",
"securityDefectCount" : 0,
"solvedDefectCount" : 0,
"unsolvedDefectCount" : 181187
},
"lastJob" : {
"executor" : "codecheck_gray02",
"finishTime" : "2025-09-12T08:41:26Z",
"id" : "676672b0933e4c18a04e22d2df896364",
"jobResult" : {
"DELAYSTATUS_COUNT" : 0,
"codeLine" : 616213,
"defectCount" : 181187,
"id" : "676672b0933e4c18a04e22d2df896364",
"jobId" : "676672b0933e4c18a04e22d2df896364",
"newUnsolvedDefectCount" : 6,
"nonSecurityDefectCount" : 0,
"reviewResult" : "error",
"securityDefectCount" : 0,
"solvedDefectCount" : 0,
"unsolvedDefectCount" : 181187
},
"jobType" : "FULL",
"process" : {
"exeTime" : "468",
"executeTime" : "7m48s",
"message" : "2025/09/12 16:38:12 GMT+08:00 Running on server:21.102.***.***\n2025/09/12 16:38:13 GMT+08:00 waiting subJob to execute\n2025/09/12 16:41:17 GMT+08:00 start sync fixed defect snapshotData!\n2025/09/12 16:41:20 GMT+08:00 sync defect SnapshotData success!\n2025/09/12 16:41:21 GMT+08:00 flush redis cache successfully!\n2025/09/12 16:41:21 GMT+08:00 [WARNING] : Some languages in the code are not checked! Languages in code: [SQL, SHELL], while in rules: [JAVA]\n2025/09/12 16:41:21 GMT+08:00 all subJob finish!\n",
"process" : "100%",
"status" : "success"
},
"ruleSets" : [ ],
"startTime" : "2025-09-12T08:33:34Z",
"status" : "success",
"subJobIds" : [ ],
"subJobStatuses" : [ ],
"taskId" : "51c9e8f2af4d49769c4e47e31243a3fd"
},
"lastUpdateTime" : "2024-10-30T08:43:41Z",
"modelSets" : [ ],
"name" : "Engine task_ydf_Cloud-based P3C default rule set",
"owner" : "codecheck_gray02",
"projectId" : "edd273b35def47278140367342aeb5e3",
"projectName" : "Engine baseline cases (do not modify)",
"region" : "suzhou",
"repoUrl" : "git@codehub.devcloud.cn-north-5.huaweicloud.com:edd273b35def47278140367342aeb5e3/engine_codemars_guiyi_java.git",
"reviewData" : [ ],
"ruleSets" : [ {
"language" : "JAVA",
"ruleSetId" : "d2feb9c786054a8aa93ffc10dabb0b2b"
} ],
"ruleType" : "basic",
"tags" : "",
"taskGroupId" : "65659ed7e5094e07bae22b93630f516d",
"taskIds" : [ ],
"zone" : "green"
} ],
"total" : 2631
},
"status" : "success"
} 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 | The task list is displayed. |
| 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