curl --request PATCH \
--url https://api.devin.ai/v3/organizations/{org_id}/snapshot-setup/blueprints/{blueprint_id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"build_on_default_branch_commit": true,
"contents": "<string>",
"position": 123,
"report_check_runs": true
}
'import requests
url = "https://api.devin.ai/v3/organizations/{org_id}/snapshot-setup/blueprints/{blueprint_id}"
payload = {
"build_on_default_branch_commit": True,
"contents": "<string>",
"position": 123,
"report_check_runs": True
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
build_on_default_branch_commit: true,
contents: '<string>',
position: 123,
report_check_runs: true
})
};
fetch('https://api.devin.ai/v3/organizations/{org_id}/snapshot-setup/blueprints/{blueprint_id}', 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}/snapshot-setup/blueprints/{blueprint_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'build_on_default_branch_commit' => true,
'contents' => '<string>',
'position' => 123,
'report_check_runs' => true
]),
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}/snapshot-setup/blueprints/{blueprint_id}"
payload := strings.NewReader("{\n \"build_on_default_branch_commit\": true,\n \"contents\": \"<string>\",\n \"position\": 123,\n \"report_check_runs\": true\n}")
req, _ := http.NewRequest("PATCH", 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.patch("https://api.devin.ai/v3/organizations/{org_id}/snapshot-setup/blueprints/{blueprint_id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"build_on_default_branch_commit\": true,\n \"contents\": \"<string>\",\n \"position\": 123,\n \"report_check_runs\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.devin.ai/v3/organizations/{org_id}/snapshot-setup/blueprints/{blueprint_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"build_on_default_branch_commit\": true,\n \"contents\": \"<string>\",\n \"position\": 123,\n \"report_check_runs\": true\n}"
response = http.request(request)
puts response.read_body{
"blueprint_id": "<string>",
"created_at": 123,
"repo_name": "<string>",
"type": "enterprise",
"updated_at": 123,
"build_on_default_branch_commit": true,
"report_check_runs": true,
"source": "git"
}{
"status": 123,
"title": "<string>",
"detail": "<string>",
"error_code": "<string>",
"errors": [
{}
],
"instance": "<string>",
"type": "about:blank"
}{
"status": 123,
"title": "<string>",
"detail": "<string>",
"error_code": "<string>",
"errors": [
{}
],
"instance": "<string>",
"type": "about:blank"
}{
"status": 123,
"title": "<string>",
"detail": "<string>",
"error_code": "<string>",
"errors": [
{}
],
"instance": "<string>",
"type": "about:blank"
}{
"status": 123,
"title": "<string>",
"detail": "<string>",
"error_code": "<string>",
"errors": [
{}
],
"instance": "<string>",
"type": "about:blank"
}{
"status": 123,
"title": "<string>",
"detail": "<string>",
"error_code": "<string>",
"errors": [
{}
],
"instance": "<string>",
"type": "about:blank"
}{
"status": 123,
"title": "<string>",
"detail": "<string>",
"error_code": "<string>",
"errors": [
{}
],
"instance": "<string>",
"type": "about:blank"
}更新一个蓝图的内容、位置、来源和/或 commit 构建设置
更新单个蓝图的部分字段。不会自动触发构建。
支持的字段:
contents—— 为蓝图写入新的 YAML 版本。position—— 设置代码仓库层级蓝图的执行顺序位置。 对组织级蓝图使用此字段时返回400(组织级蓝图没有执行顺序位置)。source—— 将代码仓库切换为git或database模式。 仅适用于代码仓库层级的根蓝图。{"source": "database", "contents": ...}会解除关联,并将contents设为新的唯一版本。build_on_default_branch_commit/report_check_runs—— 按代码仓库配置 commit 构建及其 GitHub 检查运行。仅适用于 github.com 代码仓库的根蓝图。
请求体为空时返回 400。
curl --request PATCH \
--url https://api.devin.ai/v3/organizations/{org_id}/snapshot-setup/blueprints/{blueprint_id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"build_on_default_branch_commit": true,
"contents": "<string>",
"position": 123,
"report_check_runs": true
}
'import requests
url = "https://api.devin.ai/v3/organizations/{org_id}/snapshot-setup/blueprints/{blueprint_id}"
payload = {
"build_on_default_branch_commit": True,
"contents": "<string>",
"position": 123,
"report_check_runs": True
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
build_on_default_branch_commit: true,
contents: '<string>',
position: 123,
report_check_runs: true
})
};
fetch('https://api.devin.ai/v3/organizations/{org_id}/snapshot-setup/blueprints/{blueprint_id}', 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}/snapshot-setup/blueprints/{blueprint_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'build_on_default_branch_commit' => true,
'contents' => '<string>',
'position' => 123,
'report_check_runs' => true
]),
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}/snapshot-setup/blueprints/{blueprint_id}"
payload := strings.NewReader("{\n \"build_on_default_branch_commit\": true,\n \"contents\": \"<string>\",\n \"position\": 123,\n \"report_check_runs\": true\n}")
req, _ := http.NewRequest("PATCH", 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.patch("https://api.devin.ai/v3/organizations/{org_id}/snapshot-setup/blueprints/{blueprint_id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"build_on_default_branch_commit\": true,\n \"contents\": \"<string>\",\n \"position\": 123,\n \"report_check_runs\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.devin.ai/v3/organizations/{org_id}/snapshot-setup/blueprints/{blueprint_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"build_on_default_branch_commit\": true,\n \"contents\": \"<string>\",\n \"position\": 123,\n \"report_check_runs\": true\n}"
response = http.request(request)
puts response.read_body{
"blueprint_id": "<string>",
"created_at": 123,
"repo_name": "<string>",
"type": "enterprise",
"updated_at": 123,
"build_on_default_branch_commit": true,
"report_check_runs": true,
"source": "git"
}{
"status": 123,
"title": "<string>",
"detail": "<string>",
"error_code": "<string>",
"errors": [
{}
],
"instance": "<string>",
"type": "about:blank"
}{
"status": 123,
"title": "<string>",
"detail": "<string>",
"error_code": "<string>",
"errors": [
{}
],
"instance": "<string>",
"type": "about:blank"
}{
"status": 123,
"title": "<string>",
"detail": "<string>",
"error_code": "<string>",
"errors": [
{}
],
"instance": "<string>",
"type": "about:blank"
}{
"status": 123,
"title": "<string>",
"detail": "<string>",
"error_code": "<string>",
"errors": [
{}
],
"instance": "<string>",
"type": "about:blank"
}{
"status": 123,
"title": "<string>",
"detail": "<string>",
"error_code": "<string>",
"errors": [
{}
],
"instance": "<string>",
"type": "about:blank"
}{
"status": 123,
"title": "<string>",
"detail": "<string>",
"error_code": "<string>",
"errors": [
{}
],
"instance": "<string>",
"type": "about:blank"
}权限
要求服务用户或个人访问令牌在组织级别具备ManageRepoBlueprints 权限。创建或更新组织级蓝图需要 ManageOrgSnapshots 权限。
行为
更新蓝图的内容和/或位置。不会自动触发构建。授权
服务用户凭据(前缀:cog_)
请求体
对组织层级或代码仓库层级的蓝图进行部分更新。
可提供任意字段子集。未设置的字段将保持不变。
如果为组织层级蓝图提供 position、source 或 commit 构建设置,则会返回 400 —— 只有代码仓库层级蓝图才有这些字段。不会触发构建。
设置此字段可开启或关闭在每次向默认分支推送时构建环境的功能。仅 github.com 代码仓库的根蓝图支持此设置。每次此类推送都会将一次构建加入队列。
如果设置,则会用新版本替换该蓝图的 YAML 内容。
如果设置,则更新此代码仓库层级蓝图的执行位置。位置不要求唯一;执行排序时如出现并列,服务器会任意决定先后顺序。
设置此字段可开启或关闭将每次 commit 构建上报为 GitHub 检查运行的功能。启用此功能前,必须先开启 'build_on_default_branch_commit'。
设置此字段可切换代码仓库的蓝图来源。此字段仅适用于代码仓库的根蓝图(作用域蓝图会继承此设置)。'git' 从默认分支拉取 .devin/blueprint.yaml(文件不存在时返回 404),且不能与 'contents' 同时使用;'database' 保留当前 YAML(如果提供了 'contents',则使用其内容),并停止从代码仓库同步。如果蓝图已处于该模式,则不执行任何操作。
git, database 响应
成功响应
公开的 Blueprint 资源结构。
注意:type 枚举未来可能会扩展;客户端 MUST 以优雅方式
处理未知值。YAML 内容需通过
GET /blueprints/{id}/contents 单独获取。
enterprise, org, repo 是否在每次向代码仓库的默认分支推送时构建环境。仅当此蓝图为代码仓库的根蓝图时有效,否则为 null。
是否将每次 commit 构建作为 GitHub 检查运行上报至对应的 commit。仅当此蓝图为代码仓库的根蓝图时有效,否则为 null。
YAML 的编写位置:'git'(从代码仓库中的 .devin/blueprint.yaml 同步)或 'database'(通过 API/UI 编辑)。企业级和组织级蓝图的此值始终为 null。
git, database 
