Querying Task Execution Record by Task ID
Function
This API is used to query the execution records of a task by task ID, execution time, and task execution status.
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 /v4/tasks/{task_id}/jobs
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| 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 Range 1 to 32 characters. Default Value N/A |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| statuses | No | Array of strings | Definition: Task execution status. Constraints: N/A Value range: Default value: N/A |
| begin_start_time | No | String | Definition: Check start time. Constraints: N/A Value range: Use UTC time in format "yyyy-MM-ddTHH:mm:ssZ". For example, 2020-09-25T12:05:00Z. Default value: N/A |
| end_start_time | No | String | Definition: Check end time. Constraints: N/A Value range: Use UTC time in format "yyyy-MM-ddTHH:mm:ssZ". For example, 2020-09-25T12:05:00Z. Default value: N/A |
| page | No | Integer | Definition: Page number. Constraints: N/A Value range: ≥ 1 Default value: 1 |
| page_size | No | Integer | Definition: Page size. Constraints: N/A Value range: 1–200 Default value: 200 |
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 | No | String | Definition: Media type and encoding format. Constraints: N/A Value range: N/A Default value: application/json;charset=UTF-8 |
Response Parameters
Status code: 200
| Parameter | Type | Description |
|---|---|---|
| data | Array of SimpleJobInfoV4 objects | Definition: Execution record list. Range: N/A |
| total | Integer | Definition: Total number of executions. Range: N/A |
| Parameter | Type | Description |
|---|---|---|
| subJobIds | Array of strings | Definition: Subtask ID. Value range: N/A |
| finishTime | String | Definition: End time. Range: N/A |
| subJobStatuses | Array of strings | Definition: Subtask status. Range: N/A |
| reviewResult | String | Definition Quality gate result of code check. Range |
| branchName | String | Definition: Branch name. Range: N/A |
| source | String | Definition Task source. Range |
| ruleSets | Array of strings | Definition: Rule set. Range: N/A |
| executor | String | Definition: Operator. Range: N/A |
| startTime | String | Definition Start time of a code check. Range N/A |
| 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 |
| 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. |
| 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: N/A |
| status | String | Definition: Task execution status. Range: |
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 execution record of a code check task with the task ID a746dcxxxxxxxxxxxxxxx4339d7.
GET https://{endpoint}/v4/tasks/a746dcxxxxxxxxxxxxxxx4339d7/jobs Example Responses
Status code: 200
Request succeeded.
{
"data" : [ {
"subJobIds" : [ ],
"finishTime" : "2025-01-24T03:16:49Z",
"subJobStatuses" : [ ],
"reviewResult" : "success",
"branchName" : "master",
"source" : "customer",
"ruleSets" : [ ],
"executor" : "devcloud_codecheck_01",
"startTime" : "2025-01-24T03:12:44Z",
"id" : "07xxxxxxxxxxxxxxxxxxxxxxxxxxxxx29",
"jobType" : "FULL",
"taskId" : "d1xxxxxxxxxxxxxxxxxxxxxxxxxxxe",
"status" : "success"
}, {
"subJobIds" : [ ],
"finishTime" : "2024-11-01T07:59:28Z",
"subJobStatuses" : [ ],
"reviewResult" : "success",
"branchName" : "master",
"source" : "customer",
"ruleSets" : [ ],
"executor" : "P_codecheck001",
"startTime" : "2024-11-01T07:58:31Z",
"id" : "84xxxxxxxxxxxxxxxxxxxxxxxxxxxx6f",
"jobType" : "FULL",
"taskId" : "d1xxxxxxxxxxxxxxxxxxxxxxxxxxxe",
"status" : "failed"
} ],
"total" : 2
} 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 | 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