Updated on 2025-08-21 GMT+08:00

Querying Issue Details

Function

This API is used to query the issues in pagination mode based on a check task ID.

Calling Method

For details, see Calling APIs.

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 CodeArts Check task, branch task, or incremental task generated through an API has a unique ID.

Constraints

N/A

Range

N/A

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–200

status_ids

No

String

Definition

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

Constraints

N/A

Range

  • 0: pending

  • 1: resolved and fixed

  • 2: ignored

  • 3: reopened

  • 4: pending review

Default Value

0

severity

No

String

Definition

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

Constraints

N/A

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

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 a token by calling the IAM API forobtaining a user token. The value of X-Subject-Token in the response header is the user token.

Constraints

N/A

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.

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

rule_system_tags

String

Definition

Tag. Separate multiple tags with commas (,).

Range

N/A

rule_id

String

Definition

Rule ID.

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.

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 the issue was detected. Format: 2025-07-21T03:38:53Z.

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.

Range

N/A

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

Error code.

error_msg

String

Error message.

Status code: 401

Table 9 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error message.

Example Requests

Query the details of pending issues under task ID 2b31ed520xxxxxxebedb6e57xxxxxxxx.

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

null

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.00000000",
  "error_msg" : "Network busy. Try again later."
}

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.