4 API Reference
Pratik Bhattacharya редактировал(а) эту страницу 2021-12-21 00:08:15 +05:30

In this section we will show the APIs required for evaluating feature flags. Evaluation refers to the process of checking if a feature flag is active for the given context.

Evaluate API

Evaluates the given features

HTTP Request

GET api/v1/featureflags/Evaluate?featureNames={comma-separated list of feature names}

Headers

Header Value More Details
Authorization Bearer {token}. Required AAD bearer token for the configured Resource ID in your tenant
X-Application Name of the tenant. Required Read more
X-Environment Name of the environment. Required Read more
X-FlightContext Context information for evaluating the feature flag. Required Read more

HTTP Response

Key-Value pair of the feature flag names and the evaluation result

Status Codes

Header Value
200 Success
400 Error in user input. Verify all the required headers
401 Unauthorized (Issue with the bearer token)
500 Unhandled failure

Sample

Request

GET api/v1/featureflags/Evaluate?featureNames=Demo-1,Demo-2

Headers:

  • x-application: Demo_Tenant
  • x-environment: Dev
  • x-flightcontext: { "UserName": "pratik", "Location": "India" }

Response

{
    "Demo-1": false,
    "Demo-2": true
}

Evaluate All Flags API

Evaluates all the features configured in the given tenant against the given flighting context

HTTP Request

GET api/v1/featureflags/Evaluate

Headers

Header Value More Details
Authorization Bearer {token}. Required AAD bearer token for the configured Resource ID in your tenant
X-Application Name of the tenant. Required Read more
X-Environment Name of the environment. Required Read more
X-FlightContext Context information for evaluating the feature flag. Required Read more

HTTP Response

Key-Value pair of the feature flag names and the evaluation result

Status Codes

Header Value
200 Success
400 Error in user input. Verify all the required headers
401 Unauthorized (Issue with the bearer token)
500 Unhandled failure

Sample

Request

GET api/v1/featureflags/Evaluate

Headers:

  • x-application: Demo_Tenant
  • x-environment: Dev
  • x-flightcontext: { "UserName": "pratik", "Location": "India" }

Response

{
    "Demo-1": false,
    "Demo-2": true,
    "Demo-3": true,
    "Demo-4": false,
    "Demo-5": false,
    "Demo-6": true
}