查询缺陷详情
功能介绍
根据检查任务ID分页查询任务检查结果的缺陷列表。
调用方法
请参见如何调用API。
URI
GET /v2/tasks/{task_id}/defects-detail
|
参数 |
是否必选 |
参数类型 |
描述 |
|---|---|---|---|
|
task_id |
是 |
String |
参数解释: 任务ID,即新建检查任务接口的返回值,每个CodeArtsCheck任务及其下的分支任务、通过API创建的增量任务都有1个唯一的任务ID。 约束限制: 不涉及。 取值范围: 不涉及。 默认取值: 不涉及。 |
|
参数 |
是否必选 |
参数类型 |
描述 |
|---|---|---|---|
|
offset |
否 |
Integer |
参数解释: 页码,类似page_num的作用。 约束限制: 不涉及。 取值范围: 0-999999 |
|
limit |
否 |
Integer |
参数解释: 每页数量,类似page_size的作用。 约束限制: 不涉及。 取值范围: 1-200 |
|
status_ids |
否 |
String |
参数解释: 问题状态,多个以","分隔。 约束限制: 不涉及。 取值范围:
默认取值: 0 |
|
severity |
否 |
String |
参数解释: 问题级别,多个以","分隔。 约束限制: 不涉及。 取值范围:
默认取值: 不涉及。 |
|
delay_status |
否 |
String |
参数解释: 延迟状态,多个以","分隔。 约束限制: 不涉及。 取值范围:
默认取值: 不涉及。 |
请求参数
|
参数 |
是否必选 |
参数类型 |
描述 |
|---|---|---|---|
|
X-Auth-Token |
是 |
String |
参数解释: 用户Token。 通过调用IAM服务获取用户Token接口获取(响应消息头中X-Subject-Token的值)。 约束限制: 不涉及。 取值范围: 字符串长度不少于1,不超过10万。 默认取值: 不涉及。 |
响应参数
状态码:200
|
参数 |
参数类型 |
描述 |
|---|---|---|
|
defects |
Array of DefectInfoV2 objects |
参数解释: 缺陷详情列表。 |
|
total |
Integer |
参数解释: 总数。 取值范围: 不涉及。 |
|
参数 |
参数类型 |
描述 |
|---|---|---|
|
defect_id |
String |
参数解释: MergeKey,问题ID。 取值范围: 不涉及。 |
|
defect_checker_name |
String |
参数解释: 规则名称。 取值范围: 不涉及。 |
|
defect_status |
String |
参数解释: 问题状态。 取值范围:
|
|
rule_system_tags |
String |
参数解释: 标签,多个标签用逗号隔开。 取值范围: 不涉及。 |
|
rule_id |
String |
参数解释: 规则id。 取值范围: 不涉及。 |
|
rule_name |
String |
参数解释: 规则名称。 取值范围: 不涉及。 |
|
line_number |
String |
参数解释: 问题所在文件行号。 取值范围: 不涉及。 |
|
defect_content |
String |
参数解释: 问题详细描述。 取值范围: 不涉及。 |
|
defect_level |
String |
参数解释: 问题级别。 取值范围:
|
|
file_path |
String |
参数解释: 问题文件路径。 取值范围: 不涉及。 |
|
created_at |
String |
参数解释: 问题发现时间,格式2025-07-21T03:38:53Z。 取值范围: 不涉及。 |
|
issue_key |
String |
参数解释: MergeKey,问题ID。 取值范围: 不涉及。 |
|
fragment |
Array of DefectFragmentV2 objects |
参数解释: 代码片段内容。 |
|
events |
Array of DefectEvents objects |
参数解释: 调用链信息。 |
|
参数 |
参数类型 |
描述 |
|---|---|---|
|
line_num |
String |
参数解释: 行号。 取值范围: 不涉及。 |
|
line_content |
String |
参数解释: 行代码内容。 取值范围: 不涉及。 |
|
start_offset |
Integer |
参数解释: 废弃字段。 取值范围: 不涉及。 |
|
end_offset |
Integer |
参数解释: 废弃字段。 取值范围: 不涉及。 |
|
参数 |
参数类型 |
描述 |
|---|---|---|
|
events |
Array of DefectEvents objects |
参数解释: 调用链信息。 |
|
description |
String |
参数解释: 问题详细描述。 取值范围: 不涉及。 |
|
fix_suggestions |
Array of strings |
参数解释: 修复建议。 取值范围: 不涉及。 |
|
line |
Integer |
参数解释: 问题所在文件行号。 取值范围: 不涉及。 |
|
end_line |
Integer |
参数解释: 废弃字段。 取值范围: 不涉及。 |
|
main |
Boolean |
参数解释: 废弃字段。 取值范围: 不涉及。 |
|
path |
String |
参数解释: 文件路径。 取值范围: 不涉及。 |
|
tag |
String |
参数解释: 废弃字段。 取值范围: 不涉及。 |
|
main_buggy_code |
String |
参数解释: 问题主事件对应的代码片段内容。 取值范围: 不涉及。 |
|
code_context |
String |
参数解释: 代码上下文。 取值范围: 不涉及。 |
|
code_context_start_line |
Integer |
参数解释: 代码上下文起始行号。 取值范围: 不涉及。 |
状态码:400
|
参数 |
参数类型 |
描述 |
|---|---|---|
|
error_code |
String |
错误码 |
|
error_msg |
String |
错误描述 |
状态码:401
|
参数 |
参数类型 |
描述 |
|---|---|---|
|
error_code |
String |
错误码 |
|
error_msg |
String |
错误描述 |
请求示例
查询ID为2b31ed520xxxxxxebedb6e57xxxxxxxx的任务下的待处理问题详情
GET https://{endpoint}/v2/tasks/2b31ed520xxxxxxebedb6e57xxxxxxxx/defects-detail?status_ids=0
响应示例
状态码: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
}
状态码:400
Bad Request
{
"error_code" : "CC.00000000",
"error_msg" : "网络繁忙,请稍后再试"
}
状态码:401
Unauthorized
{
"error_code" : "CC.00000003",
"error_msg" : "认证信息过期"
}
状态码
|
状态码 |
描述 |
|---|---|
|
200 |
Request succeeded! |
|
400 |
Bad Request |
|
401 |
Unauthorized |
错误码
请参见错误码。