Querying Issue Details
Function
This API is used to query issue details by task ID.
Calling Method
For details, see Calling APIs.
URI
GET /v2/tasks/{task_id}/defects-detail
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
task_id |
Yes |
String |
Task ID. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
offset |
No |
Integer |
Offset for pagination. |
limit |
No |
Integer |
Number of items displayed on each page. A maximum of 100 items are supported. |
status_ids |
No |
String |
Issue status. Filter issues by status. |
severity |
No |
String |
Issue severity. 0: critical; 1: major; 2: minor; 3: suggestion. |
Request Parameters
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
X-Auth-Token |
Yes |
String |
It can be obtained by calling the IAM API used to obtain a user token. The value of X-Subject-Token in the response header is the user token. |
Response Parameters
Status code: 200
Parameter |
Type |
Description |
---|---|---|
defects |
Array of DefectInfoV2 objects |
Issue details. |
total |
Integer |
Total number. |
Parameter |
Type |
Description |
---|---|---|
defect_id |
String |
Issue ID. |
defect_checker_name |
String |
Name of the check item corresponding to the issue. |
defect_status |
String |
Issue status. 0: unresolved; 1: resolved; 2: ignored. |
rule_system_tags |
String |
Rule tag. Multiple tags are separated by commas (,). |
rule_id |
String |
Rule ID. |
rule_name |
String |
Rule name. |
line_number |
String |
Line No. of the file where the issue is located. |
defect_content |
String |
Issue description. |
defect_level |
String |
Issue severity. 0: critical; 1: major; 2: minor; 3: suggestion. |
file_path |
String |
Issue file path. |
created_at |
String |
Creation time. |
issue_key |
String |
Unique ID of an issue. |
fragment |
Array of DefectFragmentV2 objects |
Issue code snippet details. |
events |
Array of DefectEvents objects |
Trace information. |
Parameter |
Type |
Description |
---|---|---|
line_num |
String |
Line No. |
line_content |
String |
Code line content. |
start_offset |
Integer |
The sequence number of the column where an issue starts. |
end_offset |
Integer |
The sequence number of the column where an issue ends. |
Parameter |
Type |
Description |
---|---|---|
events |
Array of DefectEvents objects |
Trace information. |
description |
String |
Description. |
fix_suggestions |
Array of strings |
Fix suggestion. |
line |
Integer |
Line that has an issue. |
end_line |
Integer |
Line where an issue ends. |
code_context_start_line |
Integer |
Line where an issue 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
Parameter |
Type |
Description |
---|---|---|
error_code |
String |
Error code. |
error_msg |
String |
Error message. |
Status code: 401
Parameter |
Type |
Description |
---|---|---|
error_code |
String |
Error code. |
error_msg |
String |
Error message. |
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" : "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.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot