Skip to content
This repository has been archived by the owner on Feb 22, 2023. It is now read-only.

API v2 Get the Enabled Status for a Feature

Darren Oakley edited this page Oct 18, 2021 · 1 revision

GET /v2/groups/{group_name}/features/{feature_name}

http://example.com/api/v2/groups/{group_name}/features/{feature_name}
http://example.com/api/v2/groups/{group_name}/features/{feature_name}?user_group={a_user_group}&user_id={a_user_id}

This endpoint returns the enabled/disabled status (based on the passed URL parameters) for a given feature.

Example Request:

The following curl requests would show the enabled/disabled status for the feature "show-article-metrics", in the group "pubserv" (with the second example passing through a user_group value of 'admin', and a user_id value of '12345' to be considered when setting the status of the feature flag):

curl 'http://example.com/api/v2/groups/pubserv/features/show-article-metrics'
curl 'http://example.com/api/v2/groups/pubserv/features/show-article-metrics?user_group=admin&user_id=12345'

Example Response:

{
  "response": true
}

When a Group or Feature Does Not Exist...

If you request information for a group or feature that does not exist, Bandiera will return a default response (in this case a false value), along with a warning. For example:

When a group doesn't exist:

{
  "response": false,
  "warning": "This group does not exist in the Bandiera database."
}

When a feature doesn't exist:

{
  "response": false,
  "warning": "This feature does not exist in the Bandiera database."
}

user_group not Provided for a User Group Based Flag

If you request a user group based feature flag without providing a user_group, Bandiera will return a default response (a false value) along with a warning:

{
  "response": false,
  "warning": "This feature is configured for user groups - you must pass a user_group"
}

user_id not Provided for a Percentage Based Flag

If you request a percentage based feature flag without providing a user_id, Bandiera will return a default response (a false value), along with a warning:

{
  "response": false,
  "warning": "This feature is configured for a % of users - you must pass a user_id"
}