Updated on 2026-08-10 GMT+08:00

Obtaining Code Issues

Function

This API is used to query code issues that meet specified conditions.

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

POST /v1/defect/issue-list-by-filter

Request Parameters

Table 1 Request header parameters

Parameter

Mandatory

Type

Description

X-Language

No

String

Definition:

Language of the response.

Constraints:

N/A

Value range:

  • zh-cn: Chinese.

  • en-us: English.

Default value:

zh-cn

Table 2 Request body parameters

Parameter

Mandatory

Type

Description

taskId

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

mergeId

No

String

Definition:

Merge request ID. This parameter is only used to distinguish version and quality gate scans. Leave it blank for a version scan and pass any non-empty value for a quality gate scan.

Constraints:

N/A

Range:

N/A

Default value:

N/A

jobId

No

String

Definition:

Execution ID, which is returned by the API of code check task execution. Each code check task has a unique execution ID. Leave this parameter blank for a version scan and pass a value for a quality gate scan. That is, the ID field in the response of API Querying Task Execution Record by Task ID.

Constraints:

N/A

Value range:

1 to 32 characters.

Default value:

N/A

pageSize

No

Integer

Definition:

Page size.

Constraints:

N/A.

Value range:

1 to 200.

Default value:

10

page

No

Integer

Definition:

Page number.

Constraints:

N/A

Range:

≥1

Default value:

N/A

languages

No

String

Definition:

Programming language.

Constraints:

N/A.

Value range:

  • Python

  • Java

  • C++

  • CSS

  • PHP

  • JavaScript

  • Go

  • HTML

  • C#

  • TypeScript

  • Shell

  • Lua

  • Rust

  • Kotlin

  • Scala

  • ArkTS

  • SQL

  • Cangjie

Default value:

N/A.

ruleIds

No

String

Definition:

Rule ID. Obtain the rule ID by calling the API for obtaining the issue statistics. The facets parameter is passed to ruleIds. In the Facet.property=ruleIds response body, FacetItem.val indicates the rule ID.

Constraints:

N/A

Value range:

N/A

Default value:

N/A

authors

No

String

Definition:

Username of the issue owner.

Constraints:

N/A

Range:

N/A

Default value:

N/A

isNew

No

String

Definition:

Whether only news issues are shown.

Constraints:

N/A

Value range:

  • 0: all issues.

  • 1: new issues.

Default value:

N/A

statusIds

No

String

Definition:

Issue status.

Constraints:

N/A.

Value range:

  • 0: pending

  • 2: resolved

  • 5: ignored

  • 6: fixed

Default value:

N/A.

severities

No

String

Definition:

Issue severity.

Constraints:

N/A

Value range:

  • 0: critical

  • 1: major

  • 2: minor

  • 3: suggestion

Default value:

N/A

delayStatus

No

String

Definition:

Issue phase.

Constraints:

N/A

Value range:

  • 0: immediate.

  • 1: deferred.

Default value:

N/A

fileNames

No

String

Definition:

File name for exact match.

Constraints:

N/A

Range:

N/A

Default value:

N/A

userTags

No

Array of strings

Definition:

Tag.

Constraints:

N/A

Range:

N/A

Default value:

N/A

cwes

No

Array of strings

Definition:

CWE ID.

Constraints:

N/A

Value range:

N/A

Default value:

N/A

Response Parameters

Status code: 200

Table 3 Response body parameters

Parameter

Type

Description

status

String

Definition:

Response status.

Value range:

  • success: successful.

  • error: failed.

result

Array of IssueListByFilter objects

Definition:

Code issues.

Table 4 IssueListByFilter

Parameter

Type

Description

total

Integer

Definition

Total number of code issues.

Range

N/A

info

Array of Issue objects

Definition:

Code issue.

Table 5 Issue

Parameter

Type

Description

defectLevel

String

Definition:

Issue severity.

Value range:

  • 0: critical

  • 1: major

  • 2: minor

  • 3: suggestion

defectStatus

String

Definition:

Issue status.

Value range:

  • 0: pending

  • 2: resolved

  • 5: ignored

  • 6: fixed

checkerName

String

Definition:

Check engine.

Range:

N/A

defectType

String

Definition:

Tool rule name.

Range:

N/A

fileName

String

Definition

Code file name.

Range

N/A

filePath

String

Definition:

File path.

Range:

N/A

ruleId

String

Definition:

Unique ID of a rule.

Range:

N/A

author

String

Definition:

Owner.

Range:

N/A

createdAt

String

Definition:

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

Value range:

N/A

criterionName

String

Definition:

Rule name.

Range:

N/A

ruleLanguage

String

Definition:

Programming language.

Value range:

  • Python

  • Java

  • C++

  • CSS

  • PHP

  • JavaScript

  • Go

  • HTML

  • C#

  • TypeScript

  • Shell

  • Lua

  • Rust

  • Kotlin

  • Scala

  • ArkTS

  • SQL

  • Cangjie

mergeKey

String

Definition:

MergeKey, that is, issue ID.

Value range:

1 to 32 characters.

functionName

String

Definition:

Function name.

Range:

N/A

isNew

String

Definition:

Whether only news issues are shown.

Value range:

  • 0: all issues.

  • 1: new issues.

delayStatus

String

Definition:

Issue phase.

Value range:

  • 0: immediate.

  • 1: deferred.

criterionType

String

Definition:

Rule type.

Range:

N/A

delayStartTime

String

Definition:

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

Value range:

N/A

delayEndTime

String

Definition:

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

Value range:

N/A

approver

String

Definition

The [ field is discarded.](tag:hws,hws_hk)

Range

N/A

cwe

String

Definition:

CWE IDs.

Range:

N/A

statusComment

Array of Comment objects

Definition:

Issue operation history.

fragment

Array of Fragment objects

Definition:

Code snippet of the issue.

versionRuleId

String

Definition:

Tool rule version ID.

Range:

N/A

criterionVersionRuleId

String

Definition:

Rule version ID.

Range:

N/A

ruleRuleId

String

Definition:

Unique ID of a tool rule.

Range:

N/A

issueId

String

Definition

Trouble ticket ID. You can create a trouble ticket for a code issue on the code issue page.

Range

N/A

category

String

Definition

Rule category.

Range

N/A

subcategory

String

Definition

This field is deprecated.

Range

N/A

Table 6 Comment

Parameter

Type

Description

id

Integer

Definition:

Operation history ID.

Range:

N/A

comments

String

Definition:

Remarks.

Value range:

1 to 256 characters.

mergeKey

String

Definition:

MergeKey, that is, issue ID.

Value range:

1 to 32 characters.

createTime

String

Definition:

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

Value range:

N/A

applicant

String

Definition

[ applicant.](tag:hws,hws_hk)

Range

N/A

approver

String

Definition

The [ field is discarded.](tag:hws,hws_hk)

Range

N/A

statusFrom

String

Definition

Issue initial status.

Range

  • 0: pending

  • 2: resolved

  • 5: ignored

  • 6: fixed

statusTo

String

Definition

Issue target status.

Range

  • 0: pending

  • 2: resolved

  • 5: ignored

  • 6: fixed

ignoreType

String

Definition

Deprecated field.

Range

  • NO_RISK: No risk found. Immediate resolution not needed.

  • FALSE_POSITIVES: Falsely reported.

  • THIRD_PARTY: Open source and third party

  • EFFUCUENCY_RETAIN: Performance sensitive with dangerous functions

  • NO_SUPPORT_INKERNEL: Unsupported unsafe kernel function

  • EXCLUDE_SCENES: Exception scenario

  • COMPATIBLE_THIRD_PARTY: Compatible with third-party components

Table 7 Fragment

Parameter

Type

Description

bugId

String

Definition:

Code snippet ID of the issue.

Range:

N/A

lineNum

String

Definition:

No. of the line where an issue occurs.

Range:

N/A

lineContent

String

Definition:

Line code of the issue.

Range:

N/A

filePath

String

Definition:

File path.

Range:

N/A

description

String

Definition:

Issue description.

Range:

N/A

codeContextStartLine

String

Definition:

Start line No. of the code context.

Range:

N/A

codeContext

String

Definition:

Code context.

Range:

N/A

events

String

Definition:

Traces.

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 list of issues detected in the latest version-level scan of the task whose ID is 897acf5exxx48a5013cd. The filter criteria are as follows: The issue status is to be handled or resolved, the issue severity is major, and the issue delay status is formal. The issues are queried on multiple pages, with 100 issues displayed on each page. The first page is displayed.

POST https://{endpoint}/v1/defect/issue-list-by-filter

{
  "taskId" : "897acf5exxx48a5013cd",
  "jobId" : "",
  "mergeId" : "",
  "statusIds" : "0,2",
  "severities" : "1",
  "delayStatus" : "0",
  "isNew" : "",
  "languages" : "",
  "authors" : "",
  "fileNames" : "",
  "ruleIds" : "",
  "page" : 1,
  "pageSize" : 10
}

Example Responses

Status code: 200

Response body of the code issue list.

{
  "status" : "success",
  "error" : null,
  "result" : [ {
    "total" : "87",
    "info" : [ {
      "defectLevel" : "2",
      "issueId" : null,
      "defectStatus" : "0",
      "checkerName" : "apiengine",
      "defectType" : "API_DOC_STRUCT_03",
      "fileName" : "API_DOC_STRUCT_03.d.ts",
      "filePath" : "API_DOC_STRUCT_03.d.ts",
      "modulePath" : null,
      "moduleID" : "-1",
      "ruleId" : "10ccf00e72094ab99e53418fa74b1859",
      "author" : "test_user",
      "createdAt" : "2024-08-02T07:00:35Z",
      "nickName" : "test_user",
      "criterionName" : "API.DOC.STRUCT.03 The @struct tag is improperly used",
      "ruleLanguage" : "TYPESCRIPT",
      "owner" : null,
      "mergeKey" : "15ab8c7ee14cf18a559f166f9219998e",
      "functionName" : "",
      "isNew" : "0",
      "delayStatus" : "0",
      "isHit" : null,
      "criterionType" : "common",
      "delayStartTime" : null,
      "delayEndTime" : null,
      "approver" : "",
      "ruleUrl" : "",
      "cwe" : null,
      "statusComment" : [ ],
      "fragment" : [ {
        "bugId" : "a47506a9-7260-48e4-9c0c-f59783957b6c",
        "lineNum" : "29",
        "lineContent" : "export declare enum GridObjectSortComponentType",
        "filePath" : "API_DOC_STRUCT_03.d.ts",
        "description" : "API check error of [wrong scene]: JSDoc label validity verification failed. The [struct] label is not allowed. Please check the label usage method.",
        "codeContextStartLine" : 24,
        "codeContext" : " * @enum { string }\n * @syscap SystemCapability.ArkUI.ArkUI.Full\n * @crossplatform\n * @since 11\n */\nexport declare enum GridObjectSortComponentType {}",
        "engine" : "",
        "category" : "",
        "subcategory" : "",
        "events" : "[{\"description\":\"API check error of [wrong scene]: JSDoc label validity verification failed. The [struct] label is not allowed. Please check the label usage method.\",\"fixSuggestion\":[],\"line\":29,\"main\":true,\"path\":\"API_DOC_STRUCT_03.d.ts\",\"mainBuggyCode\":\"export declare enum GridObjectSortComponentType\",\"codeContext\":\" * @enum { string }\\n * @syscap SystemCapability.ArkUI.ArkUI.Full\\n * @crossplatform\\n * @since 11\\n */\\nexport declare enum GridObjectSortComponentType {}\",\"codeContextStartLine\":24,\"codePassage\":[],\"events\":[],\"isContextShow\":false}]",
        "extendInfo" : null
      } ],
      "versionRuleId" : "11ef44b094c732d0a5de99700335f1a8",
      "criterionVersionRuleId" : "10ccf00e72094ab99e53418fa74b1859",
      "codeUrl" : null,
      "ruleRuleId" : "11ef44b094c732d0a5de99700335f1a8"
    } ]
  } ]
}

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

Response body of the code issue list.

400

A request error occurred.

401

The permission is insufficient.

Error Codes

See Error Codes.