API Reference
Update Segment
Update the segment. Only segments in state UNALLOCATED can be updated.
PATCH
/
v1
/
segments
/
{segment}
Update Segment
curl --request PATCH \
--url https://flags.eu.confidence.dev/v1/segments/{segment} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"displayName": "<string>",
"description": "<string>",
"targeting": {
"criteria": [
{}
],
"expression": {
"ref": "<string>",
"not": {},
"and": {
"operands": [
{}
]
},
"or": {
"operands": [
{}
]
}
}
},
"allocation": {
"proportion": {
"value": "<string>"
},
"exclusivityTags": [
"<string>"
],
"exclusiveTo": [
"<string>"
]
},
"labels": [
{}
],
"workflowInstance": "<string>",
"flag": "<string>",
"owner": "<string>"
}
'import requests
url = "https://flags.eu.confidence.dev/v1/segments/{segment}"
payload = {
"name": "<string>",
"displayName": "<string>",
"description": "<string>",
"targeting": {
"criteria": [{}],
"expression": {
"ref": "<string>",
"not": {},
"and": { "operands": [{}] },
"or": { "operands": [{}] }
}
},
"allocation": {
"proportion": { "value": "<string>" },
"exclusivityTags": ["<string>"],
"exclusiveTo": ["<string>"]
},
"labels": [{}],
"workflowInstance": "<string>",
"flag": "<string>",
"owner": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
displayName: '<string>',
description: '<string>',
targeting: {
criteria: [{}],
expression: {ref: '<string>', not: {}, and: {operands: [{}]}, or: {operands: [{}]}}
},
allocation: {
proportion: {value: '<string>'},
exclusivityTags: ['<string>'],
exclusiveTo: ['<string>']
},
labels: [{}],
workflowInstance: '<string>',
flag: '<string>',
owner: '<string>'
})
};
fetch('https://flags.eu.confidence.dev/v1/segments/{segment}', 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://flags.eu.confidence.dev/v1/segments/{segment}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'displayName' => '<string>',
'description' => '<string>',
'targeting' => [
'criteria' => [
[
]
],
'expression' => [
'ref' => '<string>',
'not' => [
],
'and' => [
'operands' => [
[
]
]
],
'or' => [
'operands' => [
[
]
]
]
]
],
'allocation' => [
'proportion' => [
'value' => '<string>'
],
'exclusivityTags' => [
'<string>'
],
'exclusiveTo' => [
'<string>'
]
],
'labels' => [
[
]
],
'workflowInstance' => '<string>',
'flag' => '<string>',
'owner' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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://flags.eu.confidence.dev/v1/segments/{segment}"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"displayName\": \"<string>\",\n \"description\": \"<string>\",\n \"targeting\": {\n \"criteria\": [\n {}\n ],\n \"expression\": {\n \"ref\": \"<string>\",\n \"not\": {},\n \"and\": {\n \"operands\": [\n {}\n ]\n },\n \"or\": {\n \"operands\": [\n {}\n ]\n }\n }\n },\n \"allocation\": {\n \"proportion\": {\n \"value\": \"<string>\"\n },\n \"exclusivityTags\": [\n \"<string>\"\n ],\n \"exclusiveTo\": [\n \"<string>\"\n ]\n },\n \"labels\": [\n {}\n ],\n \"workflowInstance\": \"<string>\",\n \"flag\": \"<string>\",\n \"owner\": \"<string>\"\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.patch("https://flags.eu.confidence.dev/v1/segments/{segment}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"displayName\": \"<string>\",\n \"description\": \"<string>\",\n \"targeting\": {\n \"criteria\": [\n {}\n ],\n \"expression\": {\n \"ref\": \"<string>\",\n \"not\": {},\n \"and\": {\n \"operands\": [\n {}\n ]\n },\n \"or\": {\n \"operands\": [\n {}\n ]\n }\n }\n },\n \"allocation\": {\n \"proportion\": {\n \"value\": \"<string>\"\n },\n \"exclusivityTags\": [\n \"<string>\"\n ],\n \"exclusiveTo\": [\n \"<string>\"\n ]\n },\n \"labels\": [\n {}\n ],\n \"workflowInstance\": \"<string>\",\n \"flag\": \"<string>\",\n \"owner\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://flags.eu.confidence.dev/v1/segments/{segment}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"displayName\": \"<string>\",\n \"description\": \"<string>\",\n \"targeting\": {\n \"criteria\": [\n {}\n ],\n \"expression\": {\n \"ref\": \"<string>\",\n \"not\": {},\n \"and\": {\n \"operands\": [\n {}\n ]\n },\n \"or\": {\n \"operands\": [\n {}\n ]\n }\n }\n },\n \"allocation\": {\n \"proportion\": {\n \"value\": \"<string>\"\n },\n \"exclusivityTags\": [\n \"<string>\"\n ],\n \"exclusiveTo\": [\n \"<string>\"\n ]\n },\n \"labels\": [\n {}\n ],\n \"workflowInstance\": \"<string>\",\n \"flag\": \"<string>\",\n \"owner\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"createTime": {},
"updateTime": {},
"creator": "<string>",
"updater": "<string>",
"name": "<string>",
"displayName": "<string>",
"description": "<string>",
"targeting": {
"criteria": [
{}
],
"expression": {
"ref": "<string>",
"not": {},
"and": {
"operands": [
{}
]
},
"or": {
"operands": [
{}
]
}
}
},
"allocation": {
"proportion": {
"value": "<string>"
},
"exclusivityTags": [
"<string>"
],
"exclusiveTo": [
"<string>"
]
},
"state": "STATE_UNSPECIFIED",
"bitsetAllocation": {
"bitset": {}
},
"labels": [
{}
],
"workflowInstance": "<string>",
"flag": "<string>",
"owner": "<string>"
}Was this page helpful?
⌘I
Update Segment
curl --request PATCH \
--url https://flags.eu.confidence.dev/v1/segments/{segment} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"displayName": "<string>",
"description": "<string>",
"targeting": {
"criteria": [
{}
],
"expression": {
"ref": "<string>",
"not": {},
"and": {
"operands": [
{}
]
},
"or": {
"operands": [
{}
]
}
}
},
"allocation": {
"proportion": {
"value": "<string>"
},
"exclusivityTags": [
"<string>"
],
"exclusiveTo": [
"<string>"
]
},
"labels": [
{}
],
"workflowInstance": "<string>",
"flag": "<string>",
"owner": "<string>"
}
'import requests
url = "https://flags.eu.confidence.dev/v1/segments/{segment}"
payload = {
"name": "<string>",
"displayName": "<string>",
"description": "<string>",
"targeting": {
"criteria": [{}],
"expression": {
"ref": "<string>",
"not": {},
"and": { "operands": [{}] },
"or": { "operands": [{}] }
}
},
"allocation": {
"proportion": { "value": "<string>" },
"exclusivityTags": ["<string>"],
"exclusiveTo": ["<string>"]
},
"labels": [{}],
"workflowInstance": "<string>",
"flag": "<string>",
"owner": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
displayName: '<string>',
description: '<string>',
targeting: {
criteria: [{}],
expression: {ref: '<string>', not: {}, and: {operands: [{}]}, or: {operands: [{}]}}
},
allocation: {
proportion: {value: '<string>'},
exclusivityTags: ['<string>'],
exclusiveTo: ['<string>']
},
labels: [{}],
workflowInstance: '<string>',
flag: '<string>',
owner: '<string>'
})
};
fetch('https://flags.eu.confidence.dev/v1/segments/{segment}', 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://flags.eu.confidence.dev/v1/segments/{segment}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'displayName' => '<string>',
'description' => '<string>',
'targeting' => [
'criteria' => [
[
]
],
'expression' => [
'ref' => '<string>',
'not' => [
],
'and' => [
'operands' => [
[
]
]
],
'or' => [
'operands' => [
[
]
]
]
]
],
'allocation' => [
'proportion' => [
'value' => '<string>'
],
'exclusivityTags' => [
'<string>'
],
'exclusiveTo' => [
'<string>'
]
],
'labels' => [
[
]
],
'workflowInstance' => '<string>',
'flag' => '<string>',
'owner' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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://flags.eu.confidence.dev/v1/segments/{segment}"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"displayName\": \"<string>\",\n \"description\": \"<string>\",\n \"targeting\": {\n \"criteria\": [\n {}\n ],\n \"expression\": {\n \"ref\": \"<string>\",\n \"not\": {},\n \"and\": {\n \"operands\": [\n {}\n ]\n },\n \"or\": {\n \"operands\": [\n {}\n ]\n }\n }\n },\n \"allocation\": {\n \"proportion\": {\n \"value\": \"<string>\"\n },\n \"exclusivityTags\": [\n \"<string>\"\n ],\n \"exclusiveTo\": [\n \"<string>\"\n ]\n },\n \"labels\": [\n {}\n ],\n \"workflowInstance\": \"<string>\",\n \"flag\": \"<string>\",\n \"owner\": \"<string>\"\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.patch("https://flags.eu.confidence.dev/v1/segments/{segment}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"displayName\": \"<string>\",\n \"description\": \"<string>\",\n \"targeting\": {\n \"criteria\": [\n {}\n ],\n \"expression\": {\n \"ref\": \"<string>\",\n \"not\": {},\n \"and\": {\n \"operands\": [\n {}\n ]\n },\n \"or\": {\n \"operands\": [\n {}\n ]\n }\n }\n },\n \"allocation\": {\n \"proportion\": {\n \"value\": \"<string>\"\n },\n \"exclusivityTags\": [\n \"<string>\"\n ],\n \"exclusiveTo\": [\n \"<string>\"\n ]\n },\n \"labels\": [\n {}\n ],\n \"workflowInstance\": \"<string>\",\n \"flag\": \"<string>\",\n \"owner\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://flags.eu.confidence.dev/v1/segments/{segment}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"displayName\": \"<string>\",\n \"description\": \"<string>\",\n \"targeting\": {\n \"criteria\": [\n {}\n ],\n \"expression\": {\n \"ref\": \"<string>\",\n \"not\": {},\n \"and\": {\n \"operands\": [\n {}\n ]\n },\n \"or\": {\n \"operands\": [\n {}\n ]\n }\n }\n },\n \"allocation\": {\n \"proportion\": {\n \"value\": \"<string>\"\n },\n \"exclusivityTags\": [\n \"<string>\"\n ],\n \"exclusiveTo\": [\n \"<string>\"\n ]\n },\n \"labels\": [\n {}\n ],\n \"workflowInstance\": \"<string>\",\n \"flag\": \"<string>\",\n \"owner\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"createTime": {},
"updateTime": {},
"creator": "<string>",
"updater": "<string>",
"name": "<string>",
"displayName": "<string>",
"description": "<string>",
"targeting": {
"criteria": [
{}
],
"expression": {
"ref": "<string>",
"not": {},
"and": {
"operands": [
{}
]
},
"or": {
"operands": [
{}
]
}
}
},
"allocation": {
"proportion": {
"value": "<string>"
},
"exclusivityTags": [
"<string>"
],
"exclusiveTo": [
"<string>"
]
},
"state": "STATE_UNSPECIFIED",
"bitsetAllocation": {
"bitset": {}
},
"labels": [
{}
],
"workflowInstance": "<string>",
"flag": "<string>",
"owner": "<string>"
}
