Create a strategy
POST <your-unleash-url>/api/admin/strategies
Authorization
name: Authorizationtype: apiKeyin: headerdescription: API key needed to access this API
This endpoint has been deprecated and may be removed in future versions of the API.
Creates a custom strategy type based on the supplied data. Custom strategies are deprecated and should not be used. Prefer using built in strategies with constraints instead.
Request
- application/json
Body
required
createStrategySchema
- name string required
The name of the strategy type. Must be unique.
- title string
The title of the strategy
- description string
A description of the strategy type.
- editable boolean
Whether the strategy type is editable or not. Defaults to
true
. - deprecated boolean
Whether the strategy type is deprecated or not. Defaults to
false
. parameters object[]required
- 201
- 401
- 403
- 409
- 415
The resource was successfully created.
Response Headers
- application/json
- Schema
- Example (from schema)
Schema
- title string nullable
An optional title for the strategy
- name string required
The name (type) of the strategy
- displayName string nullable required
A human friendly name for the strategy
- description string nullable required
A short description of the strategy
- editable boolean required
Whether the strategy can be edited or not. Strategies bundled with Unleash cannot be edited.
- deprecated boolean required
parameters object[]required
{
"title": "GradualRollout - Prod25",
"name": "flexibleRollout",
"displayName": "Gradual Rollout",
"description": "Gradual rollout to logged in users",
"editable": true,
"deprecated": true,
"parameters": [
{
"name": "percentage",
"type": "percentage",
"description": "Gradual rollout to logged in users",
"required": true
}
]
}
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 POST '<your-unleash-url>/api/admin/strategies' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: <API_KEY_VALUE>' \
--data-raw '{
"name": "my-custom-strategy",
"title": "My awesome strategy",
"description": "Enable the feature for users who have not logged in before.",
"editable": false,
"deprecated": true,
"parameters": [
{
"name": "Rollout percentage",
"type": "percentage",
"description": "How many percent of users should see this feature?",
"required": false
}
]
}'
curl -L -X POST '<your-unleash-url>/api/admin/strategies' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: <API_KEY_VALUE>' \
--data-raw '{
"name": "my-custom-strategy",
"title": "My awesome strategy",
"description": "Enable the feature for users who have not logged in before.",
"editable": false,
"deprecated": true,
"parameters": [
{
"name": "Rollout percentage",
"type": "percentage",
"description": "How many percent of users should see this feature?",
"required": false
}
]
}'
curl -L -X POST '<your-unleash-url>/api/admin/strategies' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: <API_KEY_VALUE>' \
--data-raw '{
"name": "my-custom-strategy",
"title": "My awesome strategy",
"description": "Enable the feature for users who have not logged in before.",
"editable": false,
"deprecated": true,
"parameters": [
{
"name": "Rollout percentage",
"type": "percentage",
"description": "How many percent of users should see this feature?",
"required": false
}
]
}'
curl -L -X POST '<your-unleash-url>/api/admin/strategies' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: <API_KEY_VALUE>' \
--data-raw '{
"name": "my-custom-strategy",
"title": "My awesome strategy",
"description": "Enable the feature for users who have not logged in before.",
"editable": false,
"deprecated": true,
"parameters": [
{
"name": "Rollout percentage",
"type": "percentage",
"description": "How many percent of users should see this feature?",
"required": false
}
]
}'
curl -L -X POST '<your-unleash-url>/api/admin/strategies' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: <API_KEY_VALUE>' \
--data-raw '{
"name": "my-custom-strategy",
"title": "My awesome strategy",
"description": "Enable the feature for users who have not logged in before.",
"editable": false,
"deprecated": true,
"parameters": [
{
"name": "Rollout percentage",
"type": "percentage",
"description": "How many percent of users should see this feature?",
"required": false
}
]
}'
curl -L -X POST '<your-unleash-url>/api/admin/strategies' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: <API_KEY_VALUE>' \
--data-raw '{
"name": "my-custom-strategy",
"title": "My awesome strategy",
"description": "Enable the feature for users who have not logged in before.",
"editable": false,
"deprecated": true,
"parameters": [
{
"name": "Rollout percentage",
"type": "percentage",
"description": "How many percent of users should see this feature?",
"required": false
}
]
}'
curl -L -X POST '<your-unleash-url>/api/admin/strategies' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: <API_KEY_VALUE>' \
--data-raw '{
"name": "my-custom-strategy",
"title": "My awesome strategy",
"description": "Enable the feature for users who have not logged in before.",
"editable": false,
"deprecated": true,
"parameters": [
{
"name": "Rollout percentage",
"type": "percentage",
"description": "How many percent of users should see this feature?",
"required": false
}
]
}'
curl -L -X POST '<your-unleash-url>/api/admin/strategies' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: <API_KEY_VALUE>' \
--data-raw '{
"name": "my-custom-strategy",
"title": "My awesome strategy",
"description": "Enable the feature for users who have not logged in before.",
"editable": false,
"deprecated": true,
"parameters": [
{
"name": "Rollout percentage",
"type": "percentage",
"description": "How many percent of users should see this feature?",
"required": false
}
]
}'
curl -L -X POST '<your-unleash-url>/api/admin/strategies' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: <API_KEY_VALUE>' \
--data-raw '{
"name": "my-custom-strategy",
"title": "My awesome strategy",
"description": "Enable the feature for users who have not logged in before.",
"editable": false,
"deprecated": true,
"parameters": [
{
"name": "Rollout percentage",
"type": "percentage",
"description": "How many percent of users should see this feature?",
"required": false
}
]
}'