Deze pagina is nog niet beschikbaar in uw eigen taal. We werken er hard aan om meer taalversies toe te voegen. Bedankt voor uw steun.

Querying Defect Details

Updated on 2023-11-28 GMT+08:00

Function

This API is used to query defect result details by check task ID in pagination mode.

URI

GET /v2/tasks/{task_id}/defects-detail

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

task_id

Yes

String

Task ID.

Table 2 Query Parameters

Parameter

Mandatory

Type

Description

offset

No

Integer

Pagination index, offset

Minimum: 0

Default: 0

limit

No

Integer

Number of records displayed on each page. A maximum of 100 records can be displayed on each page.

Minimum: 1

Maximum: 100

Default: 10

status_ids

No

String

Filter by Issue Status

severity

No

String

Indicates the severity. 0: critical; 1: major; 2: minor; 3: warning.

Request Parameters

Table 3 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

It can be obtained by calling an IAM API. The value of X-Subject-Token in the response header is the user token.

Minimum: 1

Maximum: 100000

Response Parameters

Status code: 200

Table 4 Response body parameters

Parameter

Type

Description

defects

Array of DefectInfoV2 objects

Defect Details

total

Integer

Total

Table 5 DefectInfoV2

Parameter

Type

Description

defect_id

String

ID of a defect.

defect_checker_name

String

Name of the check item corresponding to the defect

defect_status

String

Defect status. The options are as follows: 0: resolved; 1: resolved; 2: ignored.

rule_system_tags

String

Rule tag. Multiple tags are separated by commas (,).

rule_id

String

Rule ID.

rule_name

String

NATRuleName

line_number

String

Line No. of the File Where the Defect Is Located

defect_content

String

Defect Description

defect_level

String

Defect level. The options are as follows: 0: critical; 1: major; 2: minor; 3: warning.

file_path

String

Defect File Path

created_at

String

Creation Time

issue_key

String

Unique ID of a question.

fragment

Array of DefectFragmentV2 objects

Defect Code Snippet Details

events

Array of DefectEvents objects

Call chain information

Table 6 DefectFragmentV2

Parameter

Type

Description

line_num

String

Line number

line_content

String

Content of the Code Line

start_offset

Integer

Defect Start Column No.

end_offset

Integer

Defect End Column No.

Table 7 DefectEvents

Parameter

Type

Description

events

Array of DefectEvents objects

Call chain information

description

String

Description

fix_suggestions

Array of strings

Solution

line

Integer

Line that has a defect

end_line

Integer

Line where a defect ends

code_context_start_line

Integer

Line where a defect starts

main

Boolean

Code snippet

path

String

Path

tag

String

Tag

main_buggy_code

String

Code snippet corresponding to the main event

code_context

String

Code Context

Status code: 400

Table 8 Response body parameters

Parameter

Type

Description

error_code

String

Error Codes

error_msg

String

Description

Status code: 401

Table 9 Response body parameters

Parameter

Type

Description

error_code

String

Error Codes

error_msg

String

Description

Example Requests

GET https://{endpoint}/v2/tasks/2b31ed520xxxxxxebedb6e57xxxxxxxx/defects-summary

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" : "The network is busy. Please try again later."
}

Status code: 401

Unauthorized

{
  "error_code" : "CC.00000003",
  "error_msg" : "The authentication information has expired."
}

Status Codes

Status Code

Description

200

Request succeeded!

400

Bad Request

401

Unauthorized

Error Codes

See Error Codes.

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback