Skip to main content
POST
启动数据摄取扫描

权限

需要使用具有组织级 UseCodeScans 权限的服务用户个人访问令牌

行为

将以 摄取模式 运行的代码扫描加入队列。摄取扫描不会从头开始发现问题,而是接收来自其他来源的发现项 (例如 SAST 报告) ,由 Devin 根据代码仓库对其进行分流和验证。扫描由扫描调度器异步启动,并归属于调用主体。企业作用域内的等效操作为 启动摄取扫描 (Enterprise)

请求字段

  • repo_name (必填) :完整的代码仓库名称,例如 owner/repo
  • profile_id (必填) :处于 ingest 模式的扫描 Profile。处于 discover 模式的 Profile 会被拒绝,并返回 400
  • host:代码仓库的 Git 主机 (如果无法自动推断) 。
  • attachment_urls:要提供给扫描的 Devin 附件 URL (例如导出的扫描器报告) 。请先通过附件 API上传文件;该 API 需要 UseDevinSessions 权限。

错误

  • profile_id 不是摄取模式的 Profile 时,返回 400
  • 当代码仓库或 Profile 对该组织不可见时,返回 404
  • 当组织的扫描待办列表已满时,返回 409。请稍后重试。

授权

Authorization
string
header
必填

服务用户凭据(前缀:cog_)

路径参数

org_id
string
必填

组织 ID(前缀:org-)

示例:

"org-abc123def456"

请求体

application/json

用于启动摄取模式代码扫描的请求体。

仅接受摄取(ingest-mode)扫描 Profile:该 Profile 会针对指定代码仓库运行。

profile_id
string
必填

要运行的摄取模式扫描 Profile。必须是摄取 Profile;非摄取 Profile 将被拒绝并返回 400。

repo_name
string
必填

要扫描的代码仓库全名。

attachment_urls
string<uri>[] | null

提供给扫描的 Devin 附件 URL,例如通过 attachments API 上传的文件。附件必须属于正在扫描的组织。

Maximum array length: 10
Required string length: 1 - 2083
host
string | null

代码仓库的 Git 主机(如已知)。

响应

成功响应

一次代码扫描。

created_at
integer
必填

扫描的创建时间(Unix 秒)。

host
string | null
必填

代码仓库的 Git 托管平台(如已知)。

org_id
string
必填

该扫描所属的组织。

profile
CodeScanProfileResponse · object | null
必填

扫描所使用的 Profile(如有)。

repo_name
string
必填

扫描的主代码仓库。多代码仓库扫描还会涵盖此处未列出的其他代码仓库。

scan_id
string
必填

扫描的唯一标识符。

scan_type
enum<string>
必填

扫描类型,在创建时确定。

可用选项:
security,
performance,
db-queries,
test-coverage,
dead-code,
code-quality,
telemetry,
accessibility,
general,
migration-docs
status
enum<string>
必填

扫描状态:waiting、pending、running、awaiting_user_input、completed、failed 或 cancelled。

可用选项:
waiting,
pending,
running,
awaiting_user_input,
completed,
failed,
cancelled