Code references
Delete branches
For the complete documentation index, see llms.txt. For the full documentation snapshot, see llms-full.txt.
Asynchronously delete a number of branches.
POST
/
api
/
v2
/
code-refs
/
repositories
/
{repo}
/
branch-delete-tasks
Delete branches
curl --request POST \
--url https://app.launchdarkly.com/api/v2/code-refs/repositories/{repo}/branch-delete-tasks \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
[
"branch-to-be-deleted",
"another-branch-to-be-deleted"
]
'import requests
url = "https://app.launchdarkly.com/api/v2/code-refs/repositories/{repo}/branch-delete-tasks"
payload = ["branch-to-be-deleted", "another-branch-to-be-deleted"]
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify(['branch-to-be-deleted', 'another-branch-to-be-deleted'])
};
fetch('https://app.launchdarkly.com/api/v2/code-refs/repositories/{repo}/branch-delete-tasks', 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://app.launchdarkly.com/api/v2/code-refs/repositories/{repo}/branch-delete-tasks",
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([
'branch-to-be-deleted',
'another-branch-to-be-deleted'
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"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://app.launchdarkly.com/api/v2/code-refs/repositories/{repo}/branch-delete-tasks"
payload := strings.NewReader("[\n \"branch-to-be-deleted\",\n \"another-branch-to-be-deleted\"\n]")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<api-key>")
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://app.launchdarkly.com/api/v2/code-refs/repositories/{repo}/branch-delete-tasks")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("[\n \"branch-to-be-deleted\",\n \"another-branch-to-be-deleted\"\n]")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.launchdarkly.com/api/v2/code-refs/repositories/{repo}/branch-delete-tasks")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "[\n \"branch-to-be-deleted\",\n \"another-branch-to-be-deleted\"\n]"
response = http.request(request)
puts response.read_body{
"code": "invalid_request",
"message": "Invalid request body"
}{
"code": "unauthorized",
"message": "Invalid access token"
}{
"code": "forbidden",
"message": "Forbidden. Access to the requested resource was denied."
}{
"code": "not_found",
"message": "Invalid resource identifier"
}{
"code": "rate_limited",
"message": "You've exceeded the API rate limit. Try again later."
}⌘I
Delete branches
curl --request POST \
--url https://app.launchdarkly.com/api/v2/code-refs/repositories/{repo}/branch-delete-tasks \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
[
"branch-to-be-deleted",
"another-branch-to-be-deleted"
]
'import requests
url = "https://app.launchdarkly.com/api/v2/code-refs/repositories/{repo}/branch-delete-tasks"
payload = ["branch-to-be-deleted", "another-branch-to-be-deleted"]
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify(['branch-to-be-deleted', 'another-branch-to-be-deleted'])
};
fetch('https://app.launchdarkly.com/api/v2/code-refs/repositories/{repo}/branch-delete-tasks', 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://app.launchdarkly.com/api/v2/code-refs/repositories/{repo}/branch-delete-tasks",
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([
'branch-to-be-deleted',
'another-branch-to-be-deleted'
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"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://app.launchdarkly.com/api/v2/code-refs/repositories/{repo}/branch-delete-tasks"
payload := strings.NewReader("[\n \"branch-to-be-deleted\",\n \"another-branch-to-be-deleted\"\n]")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<api-key>")
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://app.launchdarkly.com/api/v2/code-refs/repositories/{repo}/branch-delete-tasks")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("[\n \"branch-to-be-deleted\",\n \"another-branch-to-be-deleted\"\n]")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.launchdarkly.com/api/v2/code-refs/repositories/{repo}/branch-delete-tasks")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "[\n \"branch-to-be-deleted\",\n \"another-branch-to-be-deleted\"\n]"
response = http.request(request)
puts response.read_body{
"code": "invalid_request",
"message": "Invalid request body"
}{
"code": "unauthorized",
"message": "Invalid access token"
}{
"code": "forbidden",
"message": "Forbidden. Access to the requested resource was denied."
}{
"code": "not_found",
"message": "Invalid resource identifier"
}{
"code": "rate_limited",
"message": "You've exceeded the API rate limit. Try again later."
}