4.8 KiB
4.8 KiB
Traces
代码溯源初始化
用户同意协议后请求的接口,创建代码溯源的账号
示例:
curl -X POST \
http://localhost:3000/api/traces/trace_users.json
await octokit.request('POST /api/traces/trace_users.json')
HTTP 请求
POST api/traces/trace_users.json
返回的JSON示例:
{
"status": 0,
"message": "success"
}
代码分析结果列表
查询项目下代码分析的结果
示例:
curl -X GET \
http://localhost:3000/api/traces/yystopf/many_branch/task_results.json
await octokit.request('GET /api/traces/:owner/:repo/task_results.json')
HTTP 请求
GET api/traces/:owner/:repo/task_results.json
请求参数
参数 | 必选 | 默认 | 类型 | 字段说明 |
---|---|---|---|---|
owner | 是 | 否 | string | 项目所有者标识 |
repo | 是 | 否 | string | 项目标识 |
page | 否 | 1 | int | 页码 |
limit | 否 | 15 | int | 每页数量 |
返回字段说明(暂缺)
返回的JSON示例:
{
"data": [
{
"accuracy": "20",
"code_type": "C",
"depth": "2",
"detect_flag": "快速-组件级",
"detect_rule": "快速-组件级,2,20,,开源软件,50,10",
"detect_startdate": "2022-05-10 15:59:46 ",
"detect_status": "fail",
"detectflag": "快速-组件级",
"fail_reason": "Invalid package type",
"file_name": "many_branch.zip",
"license_process": "100",
"licenseparam": "开源软件",
"package_type": "",
"product_name": "84727546110",
"project_id": "6dbc3e42-5857-4ca4-a54d-58fd9dbf6dc5",
"sim_process": "100",
"similarity_process": "2",
"task_id": "15139171-091b-4316-98b1-6068970efa44",
"totalsize": 5,
"uid": "78",
"vuln_process": "",
"vulnlevel": ""
}
]
}
新建分析
用户选择仓库分支进行代码分析的接口
示例:
curl -X POST \
http://localhost:3000/api/traces/yystopf/many_branch/tasks.json
await octokit.request('POST /api/traces/:owner/:repo/tasks.json')
HTTP 请求
POST api/traces/:owner/:repo/tasks.json
请求参数
参数 | 必选 | 默认 | 类型 | 字段说明 |
---|---|---|---|---|
owner | 是 | 否 | string | 项目所有者标识 |
repo | 是 | 否 | string | 项目标识 |
branch_name | 是 | 否 | string | 分支名称 |
返回的JSON示例:
{
"status": 0,
"message": "success"
}
重新扫描
对代码分析结果进行再次分析
示例:
curl -X GET \
http://localhost:3000/api/traces/yystopf/many_branch/reload_task.json
await octokit.request('GET /api/traces/:owner/:repo/reload_task.json')
HTTP 请求
GET api/traces/:owner/:repo/reload_task.json
请求参数
参数 | 必选 | 默认 | 类型 | 字段说明 |
---|---|---|---|---|
owner | 是 | 否 | string | 项目所有者标识 |
repo | 是 | 否 | string | 项目标识 |
project_id | 是 | 否 | string | 代码分析结果里的project_id |
branch_name | 是 | 否 | string | 分支名称 |
返回的JSON示例:
{
"status": 0,
"message": "success"
}
下载报告
把代码分析的结果下载到本地
示例:
curl -X GET \
http://localhost:3000/api/traces/yystopf/many_branch/task_pdf.json
await octokit.request('GET /api/traces/:owner/:repo/task_pdf.json')
HTTP 请求
GET api/traces/:owner/:repo/task_pdf.json
请求参数
参数 | 必选 | 默认 | 类型 | 字段说明 |
---|---|---|---|---|
owner | 是 | 否 | string | 项目所有者标识 |
repo | 是 | 否 | string | 项目标识 |
task_id | 是 | 否 | string | 代码分析结果里的task_id |
返回的JSON示例:
{
"status": 0,
"message": "success"
}