Skip to main content

Create a strategy

POST 

/api/admin/strategies

deprecated

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

Body

required

createStrategySchema

    name stringrequired

    The name of the strategy type. Must be unique.

    Example: my-custom-strategy
    title string

    The title of the strategy

    Example: My awesome strategy
    description string

    A description of the strategy type.

    Example: Enable the feature for users who have not logged in before.
    editable boolean

    Whether the strategy type is editable or not. Defaults to true.

    Example: false
    deprecated boolean

    Whether the strategy type is deprecated or not. Defaults to false.

    Example: true

    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 stringrequired

    The name of the parameter

    Example: Rollout percentage
    type stringrequired

    Possible values: [string, percentage, list, number, boolean]

    Example: percentage
    description string

    A description of this strategy parameter. Use this to indicate to the users what the parameter does.

    Example: How many percent of users should see this feature?
    required boolean

    Whether this parameter must be configured when using the strategy. Defaults to false

    Example: false
  • ]

Responses

The resource was successfully created.

Response Headers

  • location

    string

    The location of the newly created resource.

Schema

    title stringnullable

    An optional title for the strategy

    Example: GradualRollout - Prod25
    name stringrequired

    The name (type) of the strategy

    Example: flexibleRollout
    displayName stringnullablerequired

    A human friendly name for the strategy

    Example: Gradual Rollout
    description stringnullablerequired

    A short description of the strategy

    Example: Gradual rollout to logged in users
    editable booleanrequired

    Whether the strategy can be edited or not. Strategies bundled with Unleash cannot be edited.

    Example: true
    deprecated booleanrequired
    Example: true

    parameters

    object[]

    required

    A list of relevant parameters for each strategy

  • Array [

  • name string
    Example: percentage
    type string
    Example: percentage
    description string
    Example: Gradual rollout to logged in users
    required boolean
    Example: true
  • ]

Loading...