Create a strategy
POST /api/admin/strategies
Creates a strategy type based on the supplied data.
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
The parameter list lets you pass arguments to your custom activation strategy. These will be made available to your custom strategy implementation.
Array [name string requiredThe name of the parameter
type string requiredPossible values: [
string
,percentage
,list
,number
,boolean
]description stringA description of this strategy parameter. Use this to indicate to the users what the parameter does.
required booleanWhether this parameter must be configured when using the strategy. Defaults to
false
]
- 201
- 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
- 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
A list of relevant parameters for each strategy
Array [name stringtype stringdescription stringrequired boolean]
{
"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."
}