Updated on 2026-02-03 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–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.

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:

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

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

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:

Operator.

Range:

N/A

statusFrom

String

Definition:

Issue initial status.

Range:

N/A

statusTo

String

Definition:

Issue target status.

Range:

N/A

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 issues in the latest version scan of task ID 897acf5exxx48a5013cd. The filtering conditions including issue status (pending or resolved), severity (major), and issue phase (immediate). Query issues in pagination mode, with 100 records on each page, and return the first page.

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

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

Status Codes

Status Code

Description

200

Response body of the code issue list.

400

Bad Request

401

Unauthorized

Error Codes

See Error Codes.