Projects

Set environment-default strategy

Sets a default strategy for this environment. Unleash will use this strategy by default when enabling a feature flag. Use the wild card "*" for :environment to add to all environments.

post/api/admin/projects/{projectId}/environments/{environment}/default-strategy

Path parameters

projectIdstring required
environmentstring required

Request body

namestring required

The name of the strategy type

titlestring nullable

A descriptive title for the strategy

disabledboolean nullable

A toggle to disable the strategy. defaults to false. Disabled strategies are not evaluated or returned to the SDKs

sortOrdernumber

The order of the strategy in the list

parametersParametersSchema

A list of parameters for a strategy

segmentsnumber[]

Ids of segments to use for this strategy

Example request

{
  "name": "flexibleRollout",
  "title": "Gradual Rollout 25-Prod",
  "sortOrder": 9999,
  "constraints": [
    {
      "values": [
        "1",
        "2"
      ],
      "inverted": false,
      "operator": "IN",
      "contextName": "appName",
      "caseInsensitive": false
    }
  ],
  "variants": [
    {
      "name": "blue_group",
      "weightType": "fix",
      "stickiness": "custom.context.field",
      "payload": {
        "type": "json",
        "value": "{\"color\": \"red\"}"
      }
    }
  ],
  "segments": [
    1,
    2
  ]
}

Response

createFeatureStrategySchema

namestring required

The name of the strategy type

titlestring nullable

A descriptive title for the strategy

disabledboolean nullable

A toggle to disable the strategy. defaults to false. Disabled strategies are not evaluated or returned to the SDKs

sortOrdernumber

The order of the strategy in the list

parametersParametersSchema

A list of parameters for a strategy

segmentsnumber[]

Ids of segments to use for this strategy

Example response

{
  "name": "flexibleRollout",
  "title": "Gradual Rollout 25-Prod",
  "sortOrder": 9999,
  "constraints": [
    {
      "values": [
        "1",
        "2"
      ],
      "inverted": false,
      "operator": "IN",
      "contextName": "appName",
      "caseInsensitive": false
    }
  ],
  "variants": [
    {
      "name": "blue_group",
      "weightType": "fix",
      "stickiness": "custom.context.field",
      "payload": {
        "type": "json",
        "value": "{\"color\": \"red\"}"
      }
    }
  ],
  "segments": [
    1,
    2
  ]
}

Changes

Changed in 2 of the 7 revisions of this API.133

  • b2c3116e633e122See the full diff
    • the // request property's minLength was increased from 0 to 1

      request-property-min-length-increased

    • added the new SEMVER_GTE enum value to the // response property for the response status

      response-property-enum-value-added

    • added the new SEMVER_LTE enum value to the // response property for the response status

      response-property-enum-value-added

    • added the new SEMVER_GTE enum value to the request property //

      request-property-enum-value-added

    • added the new SEMVER_LTE enum value to the request property //

      request-property-enum-value-added

  • 774670258f0411See the full diff
    • added the new REGEX enum value to the // response property for the response status

      response-property-enum-value-added

    • added the new REGEX enum value to the request property //

      request-property-enum-value-added

    This revision also has 2 changes that name no endpoint, such as unreferenced schemas being removed. See the revision's changelog