启动数据摄取扫描
curl --request POST \
--url https://api.devin.ai/v3/organizations/{org_id}/code-scans/ingestion \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"profile_id": "<string>",
"repo_name": "<string>",
"attachment_urls": [
"<string>"
],
"host": "<string>"
}
'import requests
url = "https://api.devin.ai/v3/organizations/{org_id}/code-scans/ingestion"
payload = {
"profile_id": "<string>",
"repo_name": "<string>",
"attachment_urls": ["<string>"],
"host": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
profile_id: '<string>',
repo_name: '<string>',
attachment_urls: ['<string>'],
host: '<string>'
})
};
fetch('https://api.devin.ai/v3/organizations/{org_id}/code-scans/ingestion', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.devin.ai/v3/organizations/{org_id}/code-scans/ingestion",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'profile_id' => '<string>',
'repo_name' => '<string>',
'attachment_urls' => [
'<string>'
],
'host' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.devin.ai/v3/organizations/{org_id}/code-scans/ingestion"
payload := strings.NewReader("{\n \"profile_id\": \"<string>\",\n \"repo_name\": \"<string>\",\n \"attachment_urls\": [\n \"<string>\"\n ],\n \"host\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.devin.ai/v3/organizations/{org_id}/code-scans/ingestion")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"profile_id\": \"<string>\",\n \"repo_name\": \"<string>\",\n \"attachment_urls\": [\n \"<string>\"\n ],\n \"host\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.devin.ai/v3/organizations/{org_id}/code-scans/ingestion")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"profile_id\": \"<string>\",\n \"repo_name\": \"<string>\",\n \"attachment_urls\": [\n \"<string>\"\n ],\n \"host\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"created_at": 123,
"host": "<string>",
"org_id": "<string>",
"profile": {
"name": "<string>",
"profile_id": "<string>"
},
"repo_name": "<string>",
"scan_id": "<string>",
"scan_type": "security",
"status": "waiting"
}{
"status": 123,
"title": "<string>",
"detail": "<string>",
"errors": [
{}
],
"instance": "<string>",
"type": "about:blank"
}{
"status": 123,
"title": "<string>",
"detail": "<string>",
"errors": [
{}
],
"instance": "<string>",
"type": "about:blank"
}{
"status": 123,
"title": "<string>",
"detail": "<string>",
"errors": [
{}
],
"instance": "<string>",
"type": "about:blank"
}{
"status": 123,
"title": "<string>",
"detail": "<string>",
"errors": [
{}
],
"instance": "<string>",
"type": "about:blank"
}{
"status": 123,
"title": "<string>",
"detail": "<string>",
"errors": [
{}
],
"instance": "<string>",
"type": "about:blank"
}{
"status": 123,
"title": "<string>",
"detail": "<string>",
"errors": [
{}
],
"instance": "<string>",
"type": "about:blank"
}代码扫描(组织)
摄取扫描(Devin API)
通过 v3 组织 API 使用采集 Profile 启动以摄取模式运行的 Devin 代码扫描,对外部扫描器的发现项进行分流
POST
/
v3
/
organizations
/
{org_id}
/
code-scans
/
ingestion
启动数据摄取扫描
curl --request POST \
--url https://api.devin.ai/v3/organizations/{org_id}/code-scans/ingestion \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"profile_id": "<string>",
"repo_name": "<string>",
"attachment_urls": [
"<string>"
],
"host": "<string>"
}
'import requests
url = "https://api.devin.ai/v3/organizations/{org_id}/code-scans/ingestion"
payload = {
"profile_id": "<string>",
"repo_name": "<string>",
"attachment_urls": ["<string>"],
"host": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
profile_id: '<string>',
repo_name: '<string>',
attachment_urls: ['<string>'],
host: '<string>'
})
};
fetch('https://api.devin.ai/v3/organizations/{org_id}/code-scans/ingestion', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.devin.ai/v3/organizations/{org_id}/code-scans/ingestion",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'profile_id' => '<string>',
'repo_name' => '<string>',
'attachment_urls' => [
'<string>'
],
'host' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.devin.ai/v3/organizations/{org_id}/code-scans/ingestion"
payload := strings.NewReader("{\n \"profile_id\": \"<string>\",\n \"repo_name\": \"<string>\",\n \"attachment_urls\": [\n \"<string>\"\n ],\n \"host\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.devin.ai/v3/organizations/{org_id}/code-scans/ingestion")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"profile_id\": \"<string>\",\n \"repo_name\": \"<string>\",\n \"attachment_urls\": [\n \"<string>\"\n ],\n \"host\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.devin.ai/v3/organizations/{org_id}/code-scans/ingestion")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"profile_id\": \"<string>\",\n \"repo_name\": \"<string>\",\n \"attachment_urls\": [\n \"<string>\"\n ],\n \"host\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"created_at": 123,
"host": "<string>",
"org_id": "<string>",
"profile": {
"name": "<string>",
"profile_id": "<string>"
},
"repo_name": "<string>",
"scan_id": "<string>",
"scan_type": "security",
"status": "waiting"
}{
"status": 123,
"title": "<string>",
"detail": "<string>",
"errors": [
{}
],
"instance": "<string>",
"type": "about:blank"
}{
"status": 123,
"title": "<string>",
"detail": "<string>",
"errors": [
{}
],
"instance": "<string>",
"type": "about:blank"
}{
"status": 123,
"title": "<string>",
"detail": "<string>",
"errors": [
{}
],
"instance": "<string>",
"type": "about:blank"
}{
"status": 123,
"title": "<string>",
"detail": "<string>",
"errors": [
{}
],
"instance": "<string>",
"type": "about:blank"
}{
"status": 123,
"title": "<string>",
"detail": "<string>",
"errors": [
{}
],
"instance": "<string>",
"type": "about:blank"
}{
"status": 123,
"title": "<string>",
"detail": "<string>",
"errors": [
{}
],
"instance": "<string>",
"type": "about:blank"
}权限
UseCodeScans 权限的服务用户或个人访问令牌。
行为
请求字段
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。请稍后重试。
授权
服务用户凭据(前缀:cog_)
路径参数
组织 ID(前缀:org-)
示例:
"org-abc123def456"
请求体
application/json
用于启动摄取模式代码扫描的请求体。
仅接受摄取(ingest-mode)扫描 Profile:该 Profile 会针对指定代码仓库运行。
响应
成功响应
一次代码扫描。
扫描的创建时间(Unix 秒)。
代码仓库的 Git 托管平台(如已知)。
该扫描所属的组织。
扫描所使用的 Profile(如有)。
Show child attributes
Show child attributes
扫描的主代码仓库。多代码仓库扫描还会涵盖此处未列出的其他代码仓库。
扫描的唯一标识符。
扫描类型,在创建时确定。
可用选项:
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 
