Create extinction
curl --request POST \
--url https://app.launchdarkly.com/api/v2/code-refs/repositories/{repo}/branches/{branch}/extinction-events \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
[
{
"revision": "a94a8fe5ccb19ba61c4c0873d391e987982fbbd3",
"message": "Remove flag for launched feature",
"time": "1636558831870",
"flagKey": "enable-feature",
"projKey": "default"
}
]
'import requests
url = "https://app.launchdarkly.com/api/v2/code-refs/repositories/{repo}/branches/{branch}/extinction-events"
payload = [
{
"revision": "a94a8fe5ccb19ba61c4c0873d391e987982fbbd3",
"message": "Remove flag for launched feature",
"time": "1636558831870",
"flagKey": "enable-feature",
"projKey": "default"
}
]
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([
{
revision: 'a94a8fe5ccb19ba61c4c0873d391e987982fbbd3',
message: 'Remove flag for launched feature',
time: '1636558831870',
flagKey: 'enable-feature',
projKey: 'default'
}
])
};
fetch('https://app.launchdarkly.com/api/v2/code-refs/repositories/{repo}/branches/{branch}/extinction-events', 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}/branches/{branch}/extinction-events",
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([
[
'revision' => 'a94a8fe5ccb19ba61c4c0873d391e987982fbbd3',
'message' => 'Remove flag for launched feature',
'time' => '1636558831870',
'flagKey' => 'enable-feature',
'projKey' => 'default'
]
]),
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}/branches/{branch}/extinction-events"
payload := strings.NewReader("[\n {\n \"revision\": \"a94a8fe5ccb19ba61c4c0873d391e987982fbbd3\",\n \"message\": \"Remove flag for launched feature\",\n \"time\": \"1636558831870\",\n \"flagKey\": \"enable-feature\",\n \"projKey\": \"default\"\n }\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}/branches/{branch}/extinction-events")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("[\n {\n \"revision\": \"a94a8fe5ccb19ba61c4c0873d391e987982fbbd3\",\n \"message\": \"Remove flag for launched feature\",\n \"time\": \"1636558831870\",\n \"flagKey\": \"enable-feature\",\n \"projKey\": \"default\"\n }\n]")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.launchdarkly.com/api/v2/code-refs/repositories/{repo}/branches/{branch}/extinction-events")
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 {\n \"revision\": \"a94a8fe5ccb19ba61c4c0873d391e987982fbbd3\",\n \"message\": \"Remove flag for launched feature\",\n \"time\": \"1636558831870\",\n \"flagKey\": \"enable-feature\",\n \"projKey\": \"default\"\n }\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."
}Create extinction
Create a new extinction.
POST
/
api
/
v2
/
code-refs
/
repositories
/
{repo}
/
branches
/
{branch}
/
extinction-events
Create extinction
curl --request POST \
--url https://app.launchdarkly.com/api/v2/code-refs/repositories/{repo}/branches/{branch}/extinction-events \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
[
{
"revision": "a94a8fe5ccb19ba61c4c0873d391e987982fbbd3",
"message": "Remove flag for launched feature",
"time": "1636558831870",
"flagKey": "enable-feature",
"projKey": "default"
}
]
'import requests
url = "https://app.launchdarkly.com/api/v2/code-refs/repositories/{repo}/branches/{branch}/extinction-events"
payload = [
{
"revision": "a94a8fe5ccb19ba61c4c0873d391e987982fbbd3",
"message": "Remove flag for launched feature",
"time": "1636558831870",
"flagKey": "enable-feature",
"projKey": "default"
}
]
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([
{
revision: 'a94a8fe5ccb19ba61c4c0873d391e987982fbbd3',
message: 'Remove flag for launched feature',
time: '1636558831870',
flagKey: 'enable-feature',
projKey: 'default'
}
])
};
fetch('https://app.launchdarkly.com/api/v2/code-refs/repositories/{repo}/branches/{branch}/extinction-events', 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}/branches/{branch}/extinction-events",
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([
[
'revision' => 'a94a8fe5ccb19ba61c4c0873d391e987982fbbd3',
'message' => 'Remove flag for launched feature',
'time' => '1636558831870',
'flagKey' => 'enable-feature',
'projKey' => 'default'
]
]),
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}/branches/{branch}/extinction-events"
payload := strings.NewReader("[\n {\n \"revision\": \"a94a8fe5ccb19ba61c4c0873d391e987982fbbd3\",\n \"message\": \"Remove flag for launched feature\",\n \"time\": \"1636558831870\",\n \"flagKey\": \"enable-feature\",\n \"projKey\": \"default\"\n }\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}/branches/{branch}/extinction-events")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("[\n {\n \"revision\": \"a94a8fe5ccb19ba61c4c0873d391e987982fbbd3\",\n \"message\": \"Remove flag for launched feature\",\n \"time\": \"1636558831870\",\n \"flagKey\": \"enable-feature\",\n \"projKey\": \"default\"\n }\n]")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.launchdarkly.com/api/v2/code-refs/repositories/{repo}/branches/{branch}/extinction-events")
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 {\n \"revision\": \"a94a8fe5ccb19ba61c4c0873d391e987982fbbd3\",\n \"message\": \"Remove flag for launched feature\",\n \"time\": \"1636558831870\",\n \"flagKey\": \"enable-feature\",\n \"projKey\": \"default\"\n }\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."
}Authorizations
Path Parameters
The repository name
The URL-encoded branch name
Body
application/json
The identifier for the revision where flag became extinct. For example, a commit SHA.
Example:
"a94a8fe5ccb19ba61c4c0873d391e987982fbbd3"
Description of the extinction. For example, the commit message for the revision.
Example:
"Remove flag for launched feature"
Time of extinction
Example:
"1636558831870"
The feature flag key
Example:
"enable-feature"
The project key
Example:
"default"
Response
Action succeeded