Skip to main content

Set environment-default strategy

POST 

<your-unleash-url>/api/admin/projects/:projectId/environments/: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.

Request

Responses

createFeatureStrategySchema

Authorization: Authorization

name: Authorizationtype: apiKeyin: headerdescription: API key needed to access this API
curl -L '<your-unleash-url>/api/admin/projects/:projectId/environments/:environment/default-strategy' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: <API_KEY_VALUE>' \
-d '{
"name": "flexibleRollout",
"title": "Gradual Rollout 25-Prod",
"disabled": false,
"sortOrder": 9999,
"constraints": [
{
"values": [
"1",
"2"
],
"inverted": false,
"operator": "IN",
"contextName": "appName",
"caseInsensitive": false
}
],
"variants": [
{
"name": "blue_group",
"weight": 0,
"weightType": "fix",
"stickiness": "custom.context.field",
"payload": {
"type": "json",
"value": "{\"color\": \"red\"}"
}
}
],
"parameters": {
"groupId": "some_new",
"rollout": "25",
"stickiness": "sessionId"
},
"segments": [
1,
2
]
}'
Request Collapse all
Base URL
<your-unleash-url>
Auth
Parameters
— pathrequired
— pathrequired
Body required
{
  "name": "flexibleRollout",
  "title": "Gradual Rollout 25-Prod",
  "disabled": false,
  "sortOrder": 9999,
  "constraints": [
    {
      "values": [
        "1",
        "2"
      ],
      "inverted": false,
      "operator": "IN",
      "contextName": "appName",
      "caseInsensitive": false
    }
  ],
  "variants": [
    {
      "name": "blue_group",
      "weight": 0,
      "weightType": "fix",
      "stickiness": "custom.context.field",
      "payload": {
        "type": "json",
        "value": "{\"color\": \"red\"}"
      }
    }
  ],
  "parameters": {
    "groupId": "some_new",
    "rollout": "25",
    "stickiness": "sessionId"
  },
  "segments": [
    1,
    2
  ]
}
ResponseClear

Click the Send API Request button above and see the response here!