Related issues / PRs: #6221, #6029
We need to create a new endpoint at /api/v1/environments/:key/update-flag/ which will allow us to have a single endpoint to update a flag, regardless of whether the environment has v2 feature versioning enabled or not.
The endpoint should cater for updating both the environment default flag, as well as creating and updating segment overrides.
The payload should look something like:
{ "feature": { // only one of these should be included in each request "name": "my_feature_name", "id": 1, }, "segment": { // since segment name is not unique (yet), we can't // offer name here like we do for feature "id": 1, "priority": 1, // can be null / omitted, which will add it to the bottom of the list }, "enabled": true, "value": { "string_value": "", "type": "integer" // one of "integer", "string", "boolean", "float" }, "multivariate": { // this section will cater for updating the percentage allocations of // each variation. It will not be possible to add new variations through // this endpoint. This list must include the data for all variations, it // will not be possible to update the percentage of a single variation // in this endpoint if there are more than one. "variants": [ { "id": 1, "percentage_allocation": 20 }, { "id": 1, "percentage_allocation": 30" } ] } }