Skip to content

Support Enable/Disable operations in Feature Flag API

Shinya Maeda requested to merge introduce-feature-flag-api-enable-disable into master

What does this MR do?

This MR introduces the following endpoints:

POST   /api/:version/projects/:id/feature_flags/enable(.:format)   - Enable a strategy for a feature flag on an environment
POST   /api/:version/projects/:id/feature_flags/disable(.:format)  - Disable a strategy for a feature flag on an environment

This enable/disable is a very convenient endpoint to enable specific strategy/environment-scope on a feature flag, because

  • User doesn't need to know if the feature flag exits on server side. The server side automagically handles the request for create or update.
  • They simply append/remove strategy from the strategies. This works as strategies are evaluated as OR. This approach is much more extensible than updating existing strategy that each strategy has a different parameter formats. This is also considered as Flipper-like approach.
  • Thus, by using this endpoint, users do not need to execute endpoints for multiple times. e.g. Get FF list => Update Scope.

These endpoints are mainly used in FF dogfooding, but of course can be used in the other ordinary cases.

Feature flag

This feature is built behind the feature flag - feature_flag_api



  • ee/app/finders/feature_flags_finder.rb
  • ee/app/services/feature_flags/enable_service.rb
  • ee/app/services/feature_flags/disable_service.rb


Does this MR meet the acceptance criteria?


Performance and Testing


If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:

  • [-] Label as security and @ mention @gitlab-com/gl-security/appsec
  • [-] The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
  • [-] Security reports checked/validated by a reviewer from the AppSec team
Edited by Shinya Maeda

Merge request reports