Create a strategy
POST<your-unleash-url>/api/admin/strategies
This endpoint has been deprecated and may be replaced or 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
Bodyrequired
The name of the strategy type. Must be unique.
my-custom-strategy
The title of the strategy
My awesome strategy
A description of the strategy type.
Enable the feature for users who have not logged in before.
Whether the strategy type is editable or not. Defaults to true
.
false
Whether the strategy type is deprecated or not. Defaults to false
.
true
parameters object[]required
Responses
- 201
- 401
- 403
- 409
- 415
Response Headers
- application/json
- Schema
- Example (auto)
Schema
An optional title for the strategy
GradualRollout - Prod25
The name (type) of the strategy
flexibleRollout
A human friendly name for the strategy
Gradual Rollout
A short description of the strategy
Gradual rollout to logged in users
Whether the strategy can be edited or not. Strategies bundled with Unleash cannot be edited.
true
true
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
}
]
}
- application/json
- Schema
- Example (auto)
Schema
The ID of the error instance
9c40958a-daac-400e-98fb-3bb438567008
The name of the error kind
AuthenticationRequired
A 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."
}
- application/json
- Schema
- Example (auto)
Schema
The ID of the error instance
9c40958a-daac-400e-98fb-3bb438567008
The name of the error kind
NoAccessError
A 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."
}
- application/json
- Schema
- Example (auto)
Schema
The ID of the error instance
9c40958a-daac-400e-98fb-3bb438567008
The name of the error kind
NameExistsError
A 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\"."
}
- application/json
- Schema
- Example (auto)
Schema
The ID of the error instance
9c40958a-daac-400e-98fb-3bb438567008
The name of the error kind
ContentTypeerror
A 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."
}
Authorization: Authorization
name: Authorizationtype: apiKeyin: headerdescription: API key needed to access this API
- curl
- python
- go
- nodejs
- ruby
- csharp
- php
- java
- powershell
- CURL
curl -L '<your-unleash-url>/api/admin/strategies' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: <API_KEY_VALUE>' \
-d '{
"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
}
]
}'