启动代码扫描
代码扫描(组织)
启动代码扫描 (Devin API)
通过 v3 组织 API 对代码仓库启动新的 Devin 代码扫描,也可指定扫描 Profile 或提交 SHA
POST
启动代码扫描
权限
UseCodeScans 权限。
行为
repo_name 的新代码扫描加入队列。扫描调度程序会异步启动扫描;响应将返回扫描记录,其初始 status 为 waiting 或 pending。轮询列出代码扫描以跟踪进度,并在扫描状态变为 completed 后,通过列出代码扫描发现项 (按 scan_id 过滤) 查看结果。
该扫描归属于调用主体 (即发出请求的服务用户或 PAT) 。Enterprise 作用域内的等效操作为启动代码扫描 (Enterprise)。
请求字段
repo_name(必填) :完整的代码仓库名称,例如owner/repo。该代码仓库必须已通过组织的 Git 集成获得访问权限。host:代码仓库所在的 Git 主机 (如果无法自动推断) 。profile_id:要应用的扫描 Profile。对于ingest模式的 Profile,请使用启动摄取扫描。scan_type:要运行的扫描类型。指定profile_id时,必须与该 Profile 的扫描类型一致。默认使用 Profile 的类型;未指定 Profile 的扫描则默认使用security。非安全扫描类型必须指定 Profile。commit_sha:扫描前要检出的提交。默认使用代码仓库默认分支的最新提交。
错误
- 当
scan_type与 Profile 不匹配,或未提供 Profile 却指定了非安全类scan_type时,返回400。 - 当组织仅允许摄取模式扫描,且未提供
ingest模式的 Profile 时,返回403。 - 当代码仓库或 Profile 对组织不可见时,返回
404。 - 当组织的扫描待办列表已满时,返回
409。请稍后重试。
授权
服务用户凭据(前缀:cog_)
路径参数
组织 ID(前缀:org-)
示例:
"org-abc123def456"
请求体
application/json
用于启动新代码扫描的请求正文。
要扫描的代码仓库全名。
扫描前要检出的提交。
代码仓库的 Git 主机(如果已知)。
要应用于此次扫描的扫描 Profile。
要运行的扫描类型。指定 Profile 时必须与该 Profile 的扫描类型匹配;默认使用该 Profile 的类型,未指定 Profile 的扫描则默认为 'security'。非安全类型必须指定 Profile,否则会被拒绝。
可用选项:
security, performance, db-queries, test-coverage, dead-code, code-quality, telemetry, accessibility, general, migration-docs 响应
成功响应
一次代码扫描。
扫描的创建时间(Unix 秒)。
代码仓库的 Git 托管平台(如已知)。
该扫描所属的组织。
扫描所使用的 Profile(如有)。
扫描的主代码仓库。多代码仓库扫描还会涵盖此处未列出的其他代码仓库。
扫描的唯一标识符。
扫描类型,在创建时确定。
可用选项:
security, performance, db-queries, test-coverage, dead-code, code-quality, telemetry, accessibility, general, migration-docs 扫描状态:waiting、pending、running、awaiting_user_input、completed、failed 或 cancelled。
可用选项:
waiting, pending, running, awaiting_user_input, completed, failed, cancelled 
