跳转到主要内容
DELETE
/
v3beta1
/
organizations
/
{org_id}
/
repositories
/
{repository_path}
/
indexing
/
branches
/
{branch_name}
取消分支的索引
curl --request DELETE \
  --url https://api.devin.ai/v3beta1/organizations/{org_id}/repositories/{repository_path}/indexing/branches/{branch_name} \
  --header 'Authorization: Bearer <token>'
import requests

url = "https://api.devin.ai/v3beta1/organizations/{org_id}/repositories/{repository_path}/indexing/branches/{branch_name}"

headers = {"Authorization": "Bearer <token>"}

response = requests.delete(url, headers=headers)

print(response.text)
const options = {method: 'DELETE', headers: {Authorization: 'Bearer <token>'}};

fetch('https://api.devin.ai/v3beta1/organizations/{org_id}/repositories/{repository_path}/indexing/branches/{branch_name}', 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/v3beta1/organizations/{org_id}/repositories/{repository_path}/indexing/branches/{branch_name}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
package main

import (
"fmt"
"net/http"
"io"
)

func main() {

url := "https://api.devin.ai/v3beta1/organizations/{org_id}/repositories/{repository_path}/indexing/branches/{branch_name}"

req, _ := http.NewRequest("DELETE", url, nil)

req.Header.Add("Authorization", "Bearer <token>")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.delete("https://api.devin.ai/v3beta1/organizations/{org_id}/repositories/{repository_path}/indexing/branches/{branch_name}")
.header("Authorization", "Bearer <token>")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.devin.ai/v3beta1/organizations/{org_id}/repositories/{repository_path}/indexing/branches/{branch_name}")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Delete.new(url)
request["Authorization"] = 'Bearer <token>'

response = http.request(request)
puts response.read_body
{
  "branches": [
    "<string>"
  ],
  "indexing_enabled": true,
  "repository_path": "<string>",
  "indexing_status": {
    "indexing_enabled": true,
    "latest_completed_search_index_job": {
      "branch_name": "<string>",
      "commit": "<string>",
      "created_at": 123,
      "job_id": "<string>"
    },
    "latest_completed_wiki_index_job": {
      "branch_name": "<string>",
      "commit": "<string>",
      "created_at": 123,
      "job_id": "<string>"
    },
    "latest_indexes": [
      {
        "branch_name": "<string>",
        "commit": "<string>",
        "created_at": 123,
        "job_id": "<string>"
      }
    ]
  }
}
{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}

权限

需要服务用户在组织级别具备 IndexOrgRepositories 权限。

行为

将指定代码仓库中的特定分支从索引范围中移除。如果移除后未剩余任何分支,则会自动禁用该代码仓库的索引。 如果该分支未配置索引,则返回 404。

授权

Authorization
string
header
必填

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

路径参数

repository_path
string
必填
branch_name
string
必填
org_id
string
必填

组织 ID(前缀:org-)

示例:

"org-abc123def456"

响应

成功响应

branches
string[]
必填
indexing_enabled
boolean
必填
repository_path
string
必填
indexing_status
RepoIndexingStatusResponse · object | null