Get expiring context targets for feature flag
curl --request GET \
--url https://app.launchdarkly.com/api/v2/flags/{projectKey}/{featureFlagKey}/expiring-targets/{environmentKey} \
--header 'Authorization: <api-key>'import requests
url = "https://app.launchdarkly.com/api/v2/flags/{projectKey}/{featureFlagKey}/expiring-targets/{environmentKey}"
headers = {"Authorization": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: '<api-key>'}};
fetch('https://app.launchdarkly.com/api/v2/flags/{projectKey}/{featureFlagKey}/expiring-targets/{environmentKey}', 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/flags/{projectKey}/{featureFlagKey}/expiring-targets/{environmentKey}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>"
],
]);
$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://app.launchdarkly.com/api/v2/flags/{projectKey}/{featureFlagKey}/expiring-targets/{environmentKey}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://app.launchdarkly.com/api/v2/flags/{projectKey}/{featureFlagKey}/expiring-targets/{environmentKey}")
.header("Authorization", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.launchdarkly.com/api/v2/flags/{projectKey}/{featureFlagKey}/expiring-targets/{environmentKey}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"items": [
{
"_id": "12ab3c45de678910abc12345",
"_version": 1,
"expirationDate": "1672358400000",
"contextKind": "user",
"contextKey": "context-key-123abc",
"_resourceId": {
"environmentKey": "environment-key-123abc",
"flagKey": "<string>",
"key": "segment-key-123abc",
"kind": "segment",
"projectKey": "project-key-123abc"
},
"targetType": "included",
"variationId": "cc4332e2-bd4d-4fe0-b509-dfd2caf8dd73"
}
],
"_links": {}
}{
"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."
}Get expiring context targets for feature flag
Get a list of context targets on a feature flag that are scheduled for removal.
GET
/
api
/
v2
/
flags
/
{projectKey}
/
{featureFlagKey}
/
expiring-targets
/
{environmentKey}
Get expiring context targets for feature flag
curl --request GET \
--url https://app.launchdarkly.com/api/v2/flags/{projectKey}/{featureFlagKey}/expiring-targets/{environmentKey} \
--header 'Authorization: <api-key>'import requests
url = "https://app.launchdarkly.com/api/v2/flags/{projectKey}/{featureFlagKey}/expiring-targets/{environmentKey}"
headers = {"Authorization": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: '<api-key>'}};
fetch('https://app.launchdarkly.com/api/v2/flags/{projectKey}/{featureFlagKey}/expiring-targets/{environmentKey}', 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/flags/{projectKey}/{featureFlagKey}/expiring-targets/{environmentKey}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>"
],
]);
$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://app.launchdarkly.com/api/v2/flags/{projectKey}/{featureFlagKey}/expiring-targets/{environmentKey}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://app.launchdarkly.com/api/v2/flags/{projectKey}/{featureFlagKey}/expiring-targets/{environmentKey}")
.header("Authorization", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.launchdarkly.com/api/v2/flags/{projectKey}/{featureFlagKey}/expiring-targets/{environmentKey}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"items": [
{
"_id": "12ab3c45de678910abc12345",
"_version": 1,
"expirationDate": "1672358400000",
"contextKind": "user",
"contextKey": "context-key-123abc",
"_resourceId": {
"environmentKey": "environment-key-123abc",
"flagKey": "<string>",
"key": "segment-key-123abc",
"kind": "segment",
"projectKey": "project-key-123abc"
},
"targetType": "included",
"variationId": "cc4332e2-bd4d-4fe0-b509-dfd2caf8dd73"
}
],
"_links": {}
}{
"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 project key
The environment key
The feature flag key