Help Center/ CodeArts Check/ API Reference/ APIs/ Issue Management/ Querying Historical Check Results
Updated on 2026-02-03 GMT+08:00

Querying Historical Check Results

Function

This API is used to query the number of issues of each severity level in every scan for a task during a specified period. If the request contains information such as task ID (task_id), the number of issues at each issue severity will be 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:getReport

Read

task *

-

-

-

-

codeartscheck:ProjectId

URI

GET /v2/{project_id}/tasks/{task_id}/checkrecord

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 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:

N/A

Default value:

N/A

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:

1 to 32 characters.

Default value:

N/A

Table 2 Query Parameters

Parameter

Mandatory

Type

Description

offset

No

Integer

Definition

Page number. It is similar to page_num.

Constraints

N/A

Range

0–999,999

limit

No

Integer

Definition

Number of records on each page. It is similar to page_size.

Constraints

N/A

Range

1-1,000

start_time

No

String

Definition

Check start time. Use UTC time in format "yyyy-MM-ddTHH:mm:ssZ". For example, 2020-09-25T12:05:00Z.

Constraints

N/A

Range

N/A

Default Value

2000-01-01T00:00:00Z

end_time

No

String

Definition

Check end time. Use UTC time in format "yyyy-MM-ddTHH:mm:ssZ". For example, 2020-09-25T12:05:00Z.

Constraints

N/A

Range

N/A

Default Value

Current time

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

Table 4 Response body parameters

Parameter

Type

Description

data

Array of CheckRecordDataInfo objects

Definition:

Number of issues of each severity level during each scan.

total

Integer

Definition

Total number of scans.

Range

N/A

Table 5 CheckRecordDataInfo

Parameter

Type

Description

job_id

String

Definition:

Execution ID.

Value range:

N/A

check_time

String

Definition:

Check task start time (UTC). Format: yyyy-MM-ddTHH:mm:ssZ. For example, 2020-09-25T12:05:00Z.

Value range:

N/A

check_end_time

String

Definition:

Check task end time (UTC). Format: yyyy-MM-ddTHH:mm:ssZ. For example, 2020-09-25T12:05:00Z.

Value range:

N/A

issue_counts

CheckRecordIssueCountsInfo object

Definition:

Number of issues of each severity level.

Table 6 CheckRecordIssueCountsInfo

Parameter

Type

Description

critical

Integer

Definition

Number of critical issues.

Range

N/A

serious

Integer

Definition

Number of major issues.

Range

N/A

normal

Integer

Definition

Number of minor issues.

Range

N/A

prompt

Integer

Definition

Number of suggestions.

Range

N/A

Status code: 400

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

Example Requests

Query all scan results of task ID 2b31ed520xxxxxxebedb6e57xxxxxxxx under project ID e04b357xxxxx5ed832xxxxxx from 2025-06-01T00:00:00Z to 2025-06-10T00:00:00Z.

GET https://{endpoint}/v2/363540xxxxxxxx5105099944xxxxxxxx/tasks/2b31ed520xxxxxxebedb6e57xxxxxxxx/checkrecord?start_time=2025-06-01T00:00:00Z&end_time=2025-06-10T00:00:00Z

Example Responses

Status code: 200

Request succeeded!

{
  "total" : 100,
  "data" : [ {
    "check_time" : "2023-11-29T05:28:41Z",
    "check_end_time" : "2023-11-29T05:30:38Z",
    "job_id" : "84xxxxxxxxxxxxxxxxxxxxxxxxxxxx6f",
    "issue_counts" : {
      "critical" : 0,
      "serious" : 1,
      "normal" : 2,
      "prompt" : 3
    }
  }, {
    "check_time" : "2023-09-29T05:28:41Z",
    "check_end_time" : "2023-09-29T05:30:38Z",
    "job_id" : "a4xxxxxxxxxxxxxxxxxxxxxxxxxxxxb1",
    "issue_counts" : {
      "critical" : 0,
      "serious" : 1,
      "normal" : 2,
      "prompt" : 3
    }
  } ]
}

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."
}

SDK Sample Code

The SDK sample code is as follows.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
package com.huaweicloud.sdk.test;

import com.huaweicloud.sdk.core.auth.ICredential;
import com.huaweicloud.sdk.core.auth.BasicCredentials;
import com.huaweicloud.sdk.core.exception.ConnectionException;
import com.huaweicloud.sdk.core.exception.RequestTimeoutException;
import com.huaweicloud.sdk.core.exception.ServiceResponseException;
import com.huaweicloud.sdk.codecheck.v2.region.CodeCheckRegion;
import com.huaweicloud.sdk.codecheck.v2.*;
import com.huaweicloud.sdk.codecheck.v2.model.*;


public class CheckRecordSolution {

    public static void main(String[] args) {
        // The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security.
        // In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment
        String ak = System.getenv("CLOUD_SDK_AK");
        String sk = System.getenv("CLOUD_SDK_SK");

        ICredential auth = new BasicCredentials()
                .withAk(ak)
                .withSk(sk);

        CodeCheckClient client = CodeCheckClient.newBuilder()
                .withCredential(auth)
                .withRegion(CodeCheckRegion.valueOf("<YOUR REGION>"))
                .build();
        CheckRecordRequest request = new CheckRecordRequest();
        request.withProjectId("{project_id}");
        request.withTaskId("{task_id}");
        try {
            CheckRecordResponse response = client.checkRecord(request);
            System.out.println(response.toString());
        } catch (ConnectionException e) {
            e.printStackTrace();
        } catch (RequestTimeoutException e) {
            e.printStackTrace();
        } catch (ServiceResponseException e) {
            e.printStackTrace();
            System.out.println(e.getHttpStatusCode());
            System.out.println(e.getRequestId());
            System.out.println(e.getErrorCode());
            System.out.println(e.getErrorMsg());
        }
    }
}
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# coding: utf-8

import os
from huaweicloudsdkcore.auth.credentials import BasicCredentials
from huaweicloudsdkcodecheck.v2.region.codecheck_region import CodeCheckRegion
from huaweicloudsdkcore.exceptions import exceptions
from huaweicloudsdkcodecheck.v2 import *

if __name__ == "__main__":
    # The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security.
    # In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment
    ak = os.environ["CLOUD_SDK_AK"]
    sk = os.environ["CLOUD_SDK_SK"]

    credentials = BasicCredentials(ak, sk)

    client = CodeCheckClient.new_builder() \
        .with_credentials(credentials) \
        .with_region(CodeCheckRegion.value_of("<YOUR REGION>")) \
        .build()

    try:
        request = CheckRecordRequest()
        request.project_id = "{project_id}"
        request.task_id = "{task_id}"
        response = client.check_record(request)
        print(response)
    except exceptions.ClientRequestException as e:
        print(e.status_code)
        print(e.request_id)
        print(e.error_code)
        print(e.error_msg)
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package main

import (
	"fmt"
	"github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/basic"
    codecheck "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/codecheck/v2"
	"github.com/huaweicloud/huaweicloud-sdk-go-v3/services/codecheck/v2/model"
    region "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/codecheck/v2/region"
)

func main() {
    // The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security.
    // In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment
    ak := os.Getenv("CLOUD_SDK_AK")
    sk := os.Getenv("CLOUD_SDK_SK")

    auth := basic.NewCredentialsBuilder().
        WithAk(ak).
        WithSk(sk).
        Build()

    client := codecheck.NewCodeCheckClient(
        codecheck.CodeCheckClientBuilder().
            WithRegion(region.ValueOf("<YOUR REGION>")).
            WithCredential(auth).
            Build())

    request := &model.CheckRecordRequest{}
	request.ProjectId = "{project_id}"
	request.TaskId = "{task_id}"
	response, err := client.CheckRecord(request)
	if err == nil {
        fmt.Printf("%+v\n", response)
    } else {
        fmt.Println(err)
    }
}

For SDK sample code of more programming languages, see the Sample Code tab in API Explorer. SDK sample code can be automatically generated.

Status Codes

Status Code

Description

200

Request succeeded!

400

Bad Request

401

Unauthorized

Error Codes

See Error Codes.