Updated on 2026-02-03 GMT+08:00

Querying Issue Details

Function

This API is used to query the issues in pagination mode based on a check task ID. You can filter issues by issue status, severity, and other parameters.

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/tasks/{task_id}/defects-detail

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

Table 2 Query Parameters

Parameter

Mandatory

Type

Description

offset

No

Integer

Definition:

Offset.

Constraints:

N/A

Value range:

0-999999

limit

No

Integer

Definition:

Number of returned records. The actual number of returned records may be greater than the value of this parameter. The number of returned records after deduplication based on defect_id is equal to the value of this parameter.

Constraints:

N/A

Value range:

1–200

status_ids

No

String

Definition:

Issue status. Separate multiple statuses with commas (,).

Constraints:

N/A

Value range:

  • 0: pending

  • 1: resolved

  • 2: ignored

Default value:

0

severity

No

String

Definition:

Issue severity. Separate multiple severity options with commas (,).

Constraints:

N/A

Value range:

  • 0: critical

  • 1: major

  • 2: minor

  • 3: suggestion

Default value:

N/A

delay_status

No

String

Definition:

Issue phase. Separate multiple phases with commas (,).

Constraints:

N/A

Value range:

  • 0: immediate (official version)

  • 1: deferred (delayed version)

Default value:

N/A

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

defects

Array of DefectInfoV2 objects

Definition:

Issue details list. Note that the data here may be different from the limit data in the input parameter. The service splits the response data.

total

Integer

Definition

Total number.

Range

N/A

Table 5 DefectInfoV2

Parameter

Type

Description

defect_id

String

Definition

MergeKey, that is, issue ID.

Range

N/A

defect_checker_name

String

Definition

Rule name.

Range

N/A

defect_status

String

Definition:

Issue status.

Value range:

  • 0: pending

  • 1: resolved and fixed

  • 2: ignored

rule_system_tags

String

Definition

Tag. Separate multiple tags with commas (,).

Range

N/A

rule_id

String

Definition:

Rule ID.

Value range:

N/A

rule_name

String

Definition

Rule name.

Range

N/A

line_number

String

Definition

No. of the line where the issue occurs in the file.

Range

N/A

defect_content

String

Definition

Issue description.

Range

N/A

defect_level

String

Definition:

Issue severity.

Value range:

  • 0: critical

  • 1: major

  • 2: minor

  • 3: suggestion

file_path

String

Definition

File path of the issue.

Range

N/A

created_at

String

Definition:

Time when an issue is found. Use UTC time in format "yyyy-MM-ddTHH:mm:ssZ". For example, 2020-09-25T12:05:00Z.

Value range:

N/A

issue_key

String

Definition

MergeKey, that is, issue ID.

Range

N/A

fragment

Array of DefectFragmentV2 objects

Definition

Code snippet.

events

Array of DefectEvents objects

Definition

Traces.

Table 6 DefectFragmentV2

Parameter

Type

Description

line_num

String

Definition

Line No.

Range

N/A

line_content

String

Definition

Line code.

Range

N/A

start_offset

Integer

Definition

This field is deprecated.

Range

N/A

end_offset

Integer

Definition

This field is deprecated.

Range

N/A

Table 7 DefectEvents

Parameter

Type

Description

events

Array of DefectEvents objects

Definition

Traces.

description

String

Definition

Issue description.

Range

N/A

fix_suggestions

Array of strings

Definition:

Fix suggestions.

line

Integer

Definition

No. of the line where the issue occurs in the file.

Range

N/A

end_line

Integer

Definition

This field is deprecated.

Range

N/A

main

Boolean

Definition

This field is deprecated.

Range

N/A

path

String

Definition

File path.

Range

N/A

tag

String

Definition

This field is deprecated.

Range

N/A

main_buggy_code

String

Definition

Code snippet where the main event of the issue occurred.

Range

N/A

code_context

String

Definition

Code context.

Range

N/A

code_context_start_line

Integer

Definition

Start line No. of the code context.

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 details of pending issues under task ID 2b31ed520xxxxxxebedb6e57xxxxxxxx.

GET https://{endpoint}/v2/tasks/2b31ed520xxxxxxebedb6e57xxxxxxxx/defects-detail?status_ids=0

Example Responses

Status code: 200

Request succeeded!

{
  "defects" : [ {
    "line_number" : "81",
    "defect_id" : "5b71a4594bcb4a69a33f576c3564e6cc",
    "rule_system_tags" : "fossscan",
    "rule_id" : "111",
    "rule_name" : "FossScan.1 OpenSource Software",
    "defect_checker_name" : "Disallow fallthrough of `case` statements",
    "defect_status" : "0",
    "defect_content" : "Update or refactor this function so that its implementation doesn't duplicate the one on line 60.",
    "defect_level" : "1",
    "file_path" : "code/types/functions.ts",
    "created_at" : "2020-07-21T02:12:01Z",
    "issue_key" : "AA76E96XXXXXXXXXXXXXXXXXCAAE5",
    "fragment" : [ {
      "line_num" : "78",
      "line_content" : "    export function padding(all: number);",
      "start_offset" : -1,
      "end_offset" : -1
    }, {
      "line_num" : "79",
      "line_content" : "    export function padding(topAndBottom: number, leftAndRight: number);",
      "start_offset" : -1,
      "end_offset" : -1
    }, {
      "line_num" : "80",
      "line_content" : "    export function padding(top: number, right: number, bottom: number, left: number);",
      "start_offset" : -1,
      "end_offset" : -1
    }, {
      "line_num" : "81",
      "line_content" : "    export function padding(a: number, b?: number, c?: number, d?: number) {",
      "start_offset" : 11,
      "end_offset" : 19
    }, {
      "line_num" : "82",
      "line_content" : "        if (b === undefined && c === undefined && d === undefined) {",
      "start_offset" : -1,
      "end_offset" : -1
    } ]
  }, {
    "line_number" : "190",
    "defect_id" : "5b71a4594wtrfsgrew546t466c3564e6cc",
    "rule_system_tags" : "fossscan",
    "rule_id" : "112",
    "rule_name" : "FossScan.1 OpenSource Software",
    "defect_checker_name" : "Disallow fallthrough of `case` statements",
    "defect_status" : "0",
    "defect_content" : "Update or refactor this function so that its implementation doesn't duplicate the one on line 173.",
    "defect_level" : "1",
    "file_path" : "code/types/types.ts",
    "created_at" : "2020-07-21T02:12:01Z",
    "issue_key" : "AA76E96XXXXXXXXXXXXXXXXXFE3B6",
    "fragment" : [ {
      "line_num" : "187",
      "line_content" : "    var _value;",
      "start_offset" : -1,
      "end_offset" : -1
    }, {
      "line_num" : "188",
      "line_content" : "    function getOrSet(): number;",
      "start_offset" : -1,
      "end_offset" : -1
    }, {
      "line_num" : "189",
      "line_content" : "    function getOrSet(value: number);",
      "start_offset" : -1,
      "end_offset" : -1
    }, {
      "line_num" : "190",
      "line_content" : " \"    function getOrSet(value?: number) {\"",
      "start_offset" : 4,
      "end_offset" : 12
    }, {
      "line_num" : "191",
      "line_content" : " \"        if (value === undefined) {\"",
      "start_offset" : -1,
      "end_offset" : -1
    } ]
  } ],
  "total" : 2
}

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

Request succeeded!

400

Bad Request

401

Unauthorized

Error Codes

See Error Codes.