Create a new segment
POST/api/admin/segments
Creates a new segment using the payload provided
Request
- application/json
Body
required
upsertSegmentSchema
Array [
]
The name of the segment
beta-usersA description of what the segment is for
Users willing to help us test and build new features.The project the segment belongs to if any.
red-vistaconstraints
object[]
required
The list of constraints that make up this segment
The name of the context field that this constraint should apply to.
appNameThe operator to use when evaluating this constraint. For more information about the various operators, refer to the strategy constraint operator documentation.
Possible values: [NOT_IN, IN, STR_ENDS_WITH, STR_STARTS_WITH, STR_CONTAINS, NUM_EQ, NUM_GT, NUM_GTE, NUM_LT, NUM_LTE, DATE_AFTER, DATE_BEFORE, SEMVER_EQ, SEMVER_GT, SEMVER_LT]
INWhether the operator should be case sensitive or not. Defaults to false (being case sensitive).
falseWhether the result should be negated or not. If true, will turn a true result into a false result and vice versa.
falseThe context values that should be used for constraint evaluation. Use this property instead of value for properties that accept multiple values.
["my-app","my-other-app"]The context value that should be used for constraint evaluation. Use this property instead of values for properties that only accept single values.
my-appResponses
- 201
- 400
- 401
- 403
- 409
- 415
The resource was successfully created.
Response Headers
location
string
The location of the newly created resource.
- application/json
- Schema
- Example (from schema)
Schema
Array [
]
The ID of this segment
2The name of this segment
ios-usersThe description for this segment
IOS users segmentconstraints
object[]
required
The list of constraints that are used in this segment
The name of the context field that this constraint should apply to.
appNameThe operator to use when evaluating this constraint. For more information about the various operators, refer to the strategy constraint operator documentation.
Possible values: [NOT_IN, IN, STR_ENDS_WITH, STR_STARTS_WITH, STR_CONTAINS, NUM_EQ, NUM_GT, NUM_GTE, NUM_LT, NUM_LTE, DATE_AFTER, DATE_BEFORE, SEMVER_EQ, SEMVER_GT, SEMVER_LT]
INWhether the operator should be case sensitive or not. Defaults to false (being case sensitive).
falseWhether the result should be negated or not. If true, will turn a true result into a false result and vice versa.
falseThe context values that should be used for constraint evaluation. Use this property instead of value for properties that accept multiple values.
["my-app","my-other-app"]The context value that should be used for constraint evaluation. Use this property instead of values for properties that only accept single values.
my-appThe number of feature flags that use this segment. The number also includes the any flags with pending change requests that would add this segment.
3The number of projects that use this segment. The number includes any projects with pending change requests that would add this segment.
2The project the segment belongs to. Only present if the segment is a project-specific segment.
red-vistaThe creator's email or username
someone@example.comWhen the segment was created
2023-04-12T11:13:31.960Z{
"id": 2,
"name": "ios-users",
"description": "IOS users segment",
"constraints": [
{
"contextName": "appName",
"operator": "IN",
"caseInsensitive": false,
"inverted": false,
"values": [
"my-app",
"my-other-app"
],
"value": "my-app"
}
],
"usedInFeatures": 3,
"usedInProjects": 2,
"project": "red-vista",
"createdBy": "someone@example.com",
"createdAt": "2023-04-12T11:13:31.960Z"
}
The request data does not match what we expect.
- application/json
- Schema
- Example (from schema)
Schema
The ID of the error instance
9c40958a-daac-400e-98fb-3bb438567008The name of the error kind
ValidationErrorA description of what went wrong.
The request payload you provided doesn't conform to the schema. The .parameters property should be object. You sent [].{
"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
The ID of the error instance
9c40958a-daac-400e-98fb-3bb438567008The name of the error kind
AuthenticationRequiredA description of what went wrong.
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.{
"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
The ID of the error instance
9c40958a-daac-400e-98fb-3bb438567008The name of the error kind
NoAccessErrorA description of what went wrong.
You need the "UPDATE_ADDON" permission to perform this action in the "development" environment.{
"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
The ID of the error instance
9c40958a-daac-400e-98fb-3bb438567008The name of the error kind
NameExistsErrorA description of what went wrong.
There is already a feature called "my-awesome-feature".{
"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
The ID of the error instance
9c40958a-daac-400e-98fb-3bb438567008The name of the error kind
ContentTypeerrorA description of what went wrong.
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.{
"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."
}