Unlink resource
For the complete documentation index, see llms.txt. For the full documentation snapshot, see llms-full.txt.
Unlink one or multiple resources from a view:
- Unlink flags using flag keys
- Unlink segments using segment IDs
curl --request DELETE \
--url https://app.launchdarkly.com/api/v2/projects/{projectKey}/views/{viewKey}/link/{resourceType} \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--header 'LD-API-Version: <ld-api-version>' \
--data '
{
"filter": "maintainerId:507f1f77bcf86cd799439011,tags:backend+beta",
"keys": [
"flag-1",
"flag-2"
],
"comment": ""
}
'import requests
url = "https://app.launchdarkly.com/api/v2/projects/{projectKey}/views/{viewKey}/link/{resourceType}"
payload = {
"filter": "maintainerId:507f1f77bcf86cd799439011,tags:backend+beta",
"keys": ["flag-1", "flag-2"],
"comment": ""
}
headers = {
"LD-API-Version": "<ld-api-version>",
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.delete(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'DELETE',
headers: {
'LD-API-Version': '<ld-api-version>',
Authorization: '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
filter: 'maintainerId:507f1f77bcf86cd799439011,tags:backend+beta',
keys: ['flag-1', 'flag-2'],
comment: ''
})
};
fetch('https://app.launchdarkly.com/api/v2/projects/{projectKey}/views/{viewKey}/link/{resourceType}', 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/projects/{projectKey}/views/{viewKey}/link/{resourceType}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
CURLOPT_POSTFIELDS => json_encode([
'filter' => 'maintainerId:507f1f77bcf86cd799439011,tags:backend+beta',
'keys' => [
'flag-1',
'flag-2'
],
'comment' => ''
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json",
"LD-API-Version: <ld-api-version>"
],
]);
$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/projects/{projectKey}/views/{viewKey}/link/{resourceType}"
payload := strings.NewReader("{\n \"filter\": \"maintainerId:507f1f77bcf86cd799439011,tags:backend+beta\",\n \"keys\": [\n \"flag-1\",\n \"flag-2\"\n ],\n \"comment\": \"\"\n}")
req, _ := http.NewRequest("DELETE", url, payload)
req.Header.Add("LD-API-Version", "<ld-api-version>")
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.delete("https://app.launchdarkly.com/api/v2/projects/{projectKey}/views/{viewKey}/link/{resourceType}")
.header("LD-API-Version", "<ld-api-version>")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"filter\": \"maintainerId:507f1f77bcf86cd799439011,tags:backend+beta\",\n \"keys\": [\n \"flag-1\",\n \"flag-2\"\n ],\n \"comment\": \"\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.launchdarkly.com/api/v2/projects/{projectKey}/views/{viewKey}/link/{resourceType}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
request["LD-API-Version"] = '<ld-api-version>'
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"filter\": \"maintainerId:507f1f77bcf86cd799439011,tags:backend+beta\",\n \"keys\": [\n \"flag-1\",\n \"flag-2\"\n ],\n \"comment\": \"\"\n}"
response = http.request(request)
puts response.read_body{
"failedResources": [
{
"environmentId": "environmentId",
"resourceKey": "resourceKey",
"errorMessage": "errorMessage",
"resourceType": "flag"
},
{
"environmentId": "environmentId",
"resourceKey": "resourceKey",
"errorMessage": "errorMessage",
"resourceType": "flag"
}
],
"successCount": 0,
"failureCount": 6
}{
"code": "code",
"message": "message"
}{
"code": "code",
"message": "message"
}{
"code": "code",
"message": "message"
}{
"code": "code",
"message": "message"
}Authorizations
Headers
Version of the endpoint.
beta Path Parameters
flags, segments Body
The resource to link to the view. Flags are identified by key. Segments are identified by segment ID.
- ViewLinkRequestKeys
- ViewLinkRequestSegmentIdentifiers
- ViewLinkRequestFilter
Keys of the resources (flags, segments) to link/unlink
["flag-1", "flag-2"]
Optional filter string to determine which resources should be linked. Resources only need to match either the filter or explicitly-listed keys to be linked (union). Uses the same syntax as list endpoints: flags use comma-separated field:value filters, segments use queryfilter syntax.
Supported filters by resource type:
- flags: query, tags, maintainerId, maintainerTeamKey, type, status, state, staleState, sdkAvailability, targeting, hasExperiment, hasDataExport, evaluated, creationDate, contextKindTargeted, contextKindsEvaluated, filterEnv, segmentTargeted, codeReferences.min, codeReferences.max, excludeSettings, releasePipeline, applicationEvaluated, purpose, guardedRollout, view, key, name, archived, followerId
- segments (queryfilter): query, tags, keys, excludedKeys, unbounded, external, view, type Some filters are only available when the corresponding feature is enabled on your account.
"maintainerId:507f1f77bcf86cd799439011,tags:backend+beta"
Optional comment for the link/unlink operation
curl --request DELETE \
--url https://app.launchdarkly.com/api/v2/projects/{projectKey}/views/{viewKey}/link/{resourceType} \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--header 'LD-API-Version: <ld-api-version>' \
--data '
{
"filter": "maintainerId:507f1f77bcf86cd799439011,tags:backend+beta",
"keys": [
"flag-1",
"flag-2"
],
"comment": ""
}
'import requests
url = "https://app.launchdarkly.com/api/v2/projects/{projectKey}/views/{viewKey}/link/{resourceType}"
payload = {
"filter": "maintainerId:507f1f77bcf86cd799439011,tags:backend+beta",
"keys": ["flag-1", "flag-2"],
"comment": ""
}
headers = {
"LD-API-Version": "<ld-api-version>",
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.delete(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'DELETE',
headers: {
'LD-API-Version': '<ld-api-version>',
Authorization: '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
filter: 'maintainerId:507f1f77bcf86cd799439011,tags:backend+beta',
keys: ['flag-1', 'flag-2'],
comment: ''
})
};
fetch('https://app.launchdarkly.com/api/v2/projects/{projectKey}/views/{viewKey}/link/{resourceType}', 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/projects/{projectKey}/views/{viewKey}/link/{resourceType}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
CURLOPT_POSTFIELDS => json_encode([
'filter' => 'maintainerId:507f1f77bcf86cd799439011,tags:backend+beta',
'keys' => [
'flag-1',
'flag-2'
],
'comment' => ''
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json",
"LD-API-Version: <ld-api-version>"
],
]);
$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/projects/{projectKey}/views/{viewKey}/link/{resourceType}"
payload := strings.NewReader("{\n \"filter\": \"maintainerId:507f1f77bcf86cd799439011,tags:backend+beta\",\n \"keys\": [\n \"flag-1\",\n \"flag-2\"\n ],\n \"comment\": \"\"\n}")
req, _ := http.NewRequest("DELETE", url, payload)
req.Header.Add("LD-API-Version", "<ld-api-version>")
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.delete("https://app.launchdarkly.com/api/v2/projects/{projectKey}/views/{viewKey}/link/{resourceType}")
.header("LD-API-Version", "<ld-api-version>")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"filter\": \"maintainerId:507f1f77bcf86cd799439011,tags:backend+beta\",\n \"keys\": [\n \"flag-1\",\n \"flag-2\"\n ],\n \"comment\": \"\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.launchdarkly.com/api/v2/projects/{projectKey}/views/{viewKey}/link/{resourceType}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
request["LD-API-Version"] = '<ld-api-version>'
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"filter\": \"maintainerId:507f1f77bcf86cd799439011,tags:backend+beta\",\n \"keys\": [\n \"flag-1\",\n \"flag-2\"\n ],\n \"comment\": \"\"\n}"
response = http.request(request)
puts response.read_body{
"failedResources": [
{
"environmentId": "environmentId",
"resourceKey": "resourceKey",
"errorMessage": "errorMessage",
"resourceType": "flag"
},
{
"environmentId": "environmentId",
"resourceKey": "resourceKey",
"errorMessage": "errorMessage",
"resourceType": "flag"
}
],
"successCount": 0,
"failureCount": 6
}{
"code": "code",
"message": "message"
}{
"code": "code",
"message": "message"
}{
"code": "code",
"message": "message"
}{
"code": "code",
"message": "message"
}