Update segment by id
PUT <your-unleash-url>/api/admin/segments/:id
Authorization
name: Authorizationtype: apiKeyin: headerdescription: API key needed to access this API
Updates the content of the segment with the provided payload. Requires name
and constraints
to be present. If project
is not present, it will be set to null
. Any other fields not specified will be left untouched.
Request
Path Parameters
- id string required
- application/json
Body
required
upsertSegmentSchema
- name string required
The name of the segment
- description string nullable
A description of what the segment is for
- project string nullable
The project the segment belongs to if any.
constraints object[]required
- 204
- 400
- 401
- 403
- 409
- 415
This response has no body.
The request data does not match what we expect.
- application/json
- Schema
- Example (from schema)
Schema
- id string
The ID of the error instance
- name string
The name of the error kind
- message string
A description of what went wrong.
{
"id": "9c40958a-daac-400e-98fb-3bb438567008",
"name": "ValidationError",
"message": "The request payload you provided doesn't conform to the schema. The .parameters property should be object. You sent []."
}
Authorization information is missing or invalid. Provide a valid API token as the authorization
header, e.g. authorization:*.*.my-admin-token
.
- application/json
- Schema
- Example (from schema)
Schema
- id string
The ID of the error instance
- name string
The name of the error kind
- message string
A description of what went wrong.
{
"id": "9c40958a-daac-400e-98fb-3bb438567008",
"name": "AuthenticationRequired",
"message": "You must log in to use Unleash. Your request had no authorization header, so we could not authorize you. Try logging in at /auth/simple/login."
}
The provided user credentials are valid, but the user does not have the necessary permissions to perform this operation
- application/json
- Schema
- Example (from schema)
Schema
- id string
The ID of the error instance
- name string
The name of the error kind
- message string
A description of what went wrong.
{
"id": "9c40958a-daac-400e-98fb-3bb438567008",
"name": "NoAccessError",
"message": "You need the \"UPDATE_ADDON\" permission to perform this action in the \"development\" environment."
}
The provided resource can not be created or updated because it would conflict with the current state of the resource or with an already existing resource, respectively.
- application/json
- Schema
- Example (from schema)
Schema
- id string
The ID of the error instance
- name string
The name of the error kind
- message string
A description of what went wrong.
{
"id": "9c40958a-daac-400e-98fb-3bb438567008",
"name": "NameExistsError",
"message": "There is already a feature called \"my-awesome-feature\"."
}
The operation does not support request payloads of the provided type. Please ensure that you're using one of the listed payload types and that you have specified the right content type in the "content-type" header.
- application/json
- Schema
- Example (from schema)
Schema
- id string
The ID of the error instance
- name string
The name of the error kind
- message string
A description of what went wrong.
{
"id": "9c40958a-daac-400e-98fb-3bb438567008",
"name": "ContentTypeerror",
"message": "We do not accept the content-type you provided (application/xml). Try using one of the content-types we do accept instead (application/json) and make sure the body is in the corresponding format."
}
Authorization
name: Authorizationtype: apiKeyin: headerdescription: API key needed to access this API
Request
Request
curl -L -X PUT '<your-unleash-url>/api/admin/segments/:id' \
-H 'Content-Type: application/json' \
-H 'Authorization: <API_KEY_VALUE>' \
--data-raw '{
"name": "beta-users",
"description": "Users willing to help us test and build new features.",
"project": "red-vista",
"constraints": [
{
"contextName": "appName",
"operator": "IN",
"caseInsensitive": false,
"inverted": false,
"values": [
"my-app",
"my-other-app"
],
"value": "my-app"
}
]
}'
curl -L -X PUT '<your-unleash-url>/api/admin/segments/:id' \
-H 'Content-Type: application/json' \
-H 'Authorization: <API_KEY_VALUE>' \
--data-raw '{
"name": "beta-users",
"description": "Users willing to help us test and build new features.",
"project": "red-vista",
"constraints": [
{
"contextName": "appName",
"operator": "IN",
"caseInsensitive": false,
"inverted": false,
"values": [
"my-app",
"my-other-app"
],
"value": "my-app"
}
]
}'
curl -L -X PUT '<your-unleash-url>/api/admin/segments/:id' \
-H 'Content-Type: application/json' \
-H 'Authorization: <API_KEY_VALUE>' \
--data-raw '{
"name": "beta-users",
"description": "Users willing to help us test and build new features.",
"project": "red-vista",
"constraints": [
{
"contextName": "appName",
"operator": "IN",
"caseInsensitive": false,
"inverted": false,
"values": [
"my-app",
"my-other-app"
],
"value": "my-app"
}
]
}'
curl -L -X PUT '<your-unleash-url>/api/admin/segments/:id' \
-H 'Content-Type: application/json' \
-H 'Authorization: <API_KEY_VALUE>' \
--data-raw '{
"name": "beta-users",
"description": "Users willing to help us test and build new features.",
"project": "red-vista",
"constraints": [
{
"contextName": "appName",
"operator": "IN",
"caseInsensitive": false,
"inverted": false,
"values": [
"my-app",
"my-other-app"
],
"value": "my-app"
}
]
}'
curl -L -X PUT '<your-unleash-url>/api/admin/segments/:id' \
-H 'Content-Type: application/json' \
-H 'Authorization: <API_KEY_VALUE>' \
--data-raw '{
"name": "beta-users",
"description": "Users willing to help us test and build new features.",
"project": "red-vista",
"constraints": [
{
"contextName": "appName",
"operator": "IN",
"caseInsensitive": false,
"inverted": false,
"values": [
"my-app",
"my-other-app"
],
"value": "my-app"
}
]
}'
curl -L -X PUT '<your-unleash-url>/api/admin/segments/:id' \
-H 'Content-Type: application/json' \
-H 'Authorization: <API_KEY_VALUE>' \
--data-raw '{
"name": "beta-users",
"description": "Users willing to help us test and build new features.",
"project": "red-vista",
"constraints": [
{
"contextName": "appName",
"operator": "IN",
"caseInsensitive": false,
"inverted": false,
"values": [
"my-app",
"my-other-app"
],
"value": "my-app"
}
]
}'
curl -L -X PUT '<your-unleash-url>/api/admin/segments/:id' \
-H 'Content-Type: application/json' \
-H 'Authorization: <API_KEY_VALUE>' \
--data-raw '{
"name": "beta-users",
"description": "Users willing to help us test and build new features.",
"project": "red-vista",
"constraints": [
{
"contextName": "appName",
"operator": "IN",
"caseInsensitive": false,
"inverted": false,
"values": [
"my-app",
"my-other-app"
],
"value": "my-app"
}
]
}'
curl -L -X PUT '<your-unleash-url>/api/admin/segments/:id' \
-H 'Content-Type: application/json' \
-H 'Authorization: <API_KEY_VALUE>' \
--data-raw '{
"name": "beta-users",
"description": "Users willing to help us test and build new features.",
"project": "red-vista",
"constraints": [
{
"contextName": "appName",
"operator": "IN",
"caseInsensitive": false,
"inverted": false,
"values": [
"my-app",
"my-other-app"
],
"value": "my-app"
}
]
}'
curl -L -X PUT '<your-unleash-url>/api/admin/segments/:id' \
-H 'Content-Type: application/json' \
-H 'Authorization: <API_KEY_VALUE>' \
--data-raw '{
"name": "beta-users",
"description": "Users willing to help us test and build new features.",
"project": "red-vista",
"constraints": [
{
"contextName": "appName",
"operator": "IN",
"caseInsensitive": false,
"inverted": false,
"values": [
"my-app",
"my-other-app"
],
"value": "my-app"
}
]
}'