Update Segment
Update the segment. Only segments in state UNALLOCATED can be updated.
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>"
]
},
"bitsetAllocation": {
"bitset": {}
},
"labels": [
{}
],
"workflowInstance": "<string>",
"flag": "<string>",
"owner": "<string>"
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
Query Parameters
The list of fields in the Segment that you want to update e.g. 'targeting', if empty all mutable properties are updated. Fields are specified relative to the segment.
Body
The resource name of the segment.
For example:
segments/0smva5nxuhv4yts6paxt
A human-friendly name for the segment.
A description for the segment.
How much of the total population that is allocated to this segment, and the coordination with other segments.
Show child attributes
Show child attributes
General labels for this resource.
Show child attributes
Show child attributes
The workflow instance that created this segment. If set, permissions will be inherited from the workflow instance, in addition to the segment permissions.
The flag owning the rule this segment is connected to. If set, permissions will be inherited from the flag, in addition to the segment permissions.
The owner of the resource. If not set will default to the creator.
Response
Returns a Segment.
A reusable slice of an entity population.
Time when the segment was first created.
Time when the segment was last updated.
Reference to the identity that created this segment.
Reference to the identity that last updated this segment.
The resource name of the segment.
For example:
segments/0smva5nxuhv4yts6paxt
A human-friendly name for the segment.
A description for the segment.
How much of the total population that is allocated to this segment, and the coordination with other segments.
Show child attributes
Show child attributes
Current state of the segment.
STATE_UNSPECIFIED, OK, UNALLOCATED, ALLOCATED, ARCHIVED A bitset representing the buckets that are allocated for this segment.
Show child attributes
Show child attributes
General labels for this resource.
Show child attributes
Show child attributes
The workflow instance that created this segment. If set, permissions will be inherited from the workflow instance, in addition to the segment permissions.
The flag owning the rule this segment is connected to. If set, permissions will be inherited from the flag, in addition to the segment permissions.
The owner of the resource. If not set will default to the creator.
Was this page helpful?
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>"
]
},
"bitsetAllocation": {
"bitset": {}
},
"labels": [
{}
],
"workflowInstance": "<string>",
"flag": "<string>",
"owner": "<string>"
}
