Skip to content

Admin API Reference

Akreddy123 edited this page Dec 21, 2021 · 14 revisions

In this section we will talk about APIs required for managing Feature Flags

Permissions

The AAD Object ID (app context) or User UPN (user context) must be added as Administrator for the tenant in App Configuration.

Create Flag

Creates a feature toggle/flag

HTTP Request

POST api/v1/featureflags

Headers

Header Value More Details
Content-Type application/json
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

Request Body

Flag resource

{
    "name": "Name of the feature flag",
    "description": "Some description about the feature flag",
    "enabled": true | false,
    "environment": "Environment Name",
    "incrementalRingsEnabled": true | false (To keep all rings 1-n enabled when ring-n is enabled),
    "conditions": {
        "client_filters": [
            {
                "name": "Name of the filter",
                "parameters": {
                    "operator": "Operator to be used for evaluating the flight context value and the configured value",
                    "value": "Configured Value against which evaluation will be done",
                    "isActive": "true | false",
                    "stageId": "ID of the stage/ring",
                    "stageName": "Name of the stage/ring",
                    "flightContextKey": "Key to be used from the flighting context object for matching against the configured value"
                }
            }
        ]
    }
}

HTTP Response

201 Status Code

Status Codes

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

Sample

POST api/v1/featureflags

Headers:

  • x-application: Demo_Tenant
  • x-environment: Dev

Body

{
    "name": "Demo-PB-Test-004-Refactored-Code",
    "description": "FunctionalTestingflagDescription",
    "enabled": true,
    "environment": "dev",
    "conditions": {
        "client_filters": [
            {
                "name": "Country",
                "parameters": {
                    "operator": "In",
                    "value": "India,UK,USA",
                    "isActive": "true",
                    "stageId": "0",
                    "stageName": "stg1",
                    "flightContextKey": "Country"
                }
            }
        ]
    }
}

Response

201

Update Flag

Updates an existing feature flag/toggle

HTTP Request

PUT api/v1/featureflags

Headers

Header Value More Details
Content-Type application/json
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

Request Body

Updated flag resource

{
    "name": "Name of the feature flag",
    "description": "Some description about the feature flag",
    "enabled": true | false,
    "environment": "Environment Name",
    "incrementalRingsEnabled": true | false (To keep all rings 1-n enabled when ring-n is enabled),
    "conditions": {
        "client_filters": [
            {
                "name": "Name of the filter",
                "parameters": {
                    "operator": "Operator to be used for evaluating the flight context value and the configured value",
                    "value": "Configured Value against which evaluation will be done",
                    "isActive": "true | false",
                    "stageId": "ID of the stage/ring",
                    "stageName": "Name of the stage/ring",
                    "flightContextKey": "Key to be used from the flighting context object for matching against the configured value"
                }
            }
        ]
    }
}

HTTP Response

200 Status Code

Status Codes

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

Sample

PUT api/v1/featureflags

Headers:

  • x-application: Demo_Tenant
  • x-environment: Dev

Body

{
    "name": "Demo-PB-Test-004-Refactored-Code",
    "description": "FunctionalTestingflagDescription",
    "enabled": true,
    "environment": "dev",
    "conditions": {
        "client_filters": [
            {
                "name": "Country",
                "parameters": {
                    "operator": "In",
                    "value": "India,UK,USA",
                    "isActive": "true",
                    "stageId": "0",
                    "stageName": "stg1",
                    "flightContextKey": "Country"
                }
            }
        ]
    }
}

Response

200

Enable Flag

Enables a disabled feature flag/toggle

HTTP Request

PATCH api/v1/featureflags/{feature-flag-name}/enable

Headers

Header Value More Details
Content-Type application/json
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

HTTP Response

204 Status Code

Status Codes

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

Sample

PATCH api/v1/featureflags/demo-feature-toggle/enable

Headers:

  • x-application: Demo_Tenant
  • x-environment: Dev

Response

204

Disable Flag

Disabled an enabled feature flag/toggle

HTTP Request

PATCH api/v1/featureflags/{feature-flag-name}/disable

Headers

Header Value More Details
Content-Type application/json
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

HTTP Response

204 Status Code

Status Codes

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

Sample

PATCH api/v1/featureflags/demo-feature-toggle/disable

Headers:

  • x-application: Demo_Tenant
  • x-environment: Dev

Response

204

Activate stage

Activates the stage of a flag. All stages in the feature flag will be de-activated except the stage name passed in the route parameter. This API is used for promoting and rolling back rings.

HTTP Request

PATCH api/v1/featureflags/{feature-flag-name}/activatestage/{stage-name}

Headers

Header Value More Details
Content-Type application/json
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

HTTP Response

204 Status Code

Status Codes

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

Sample

PATCH api/v1/featureflags/demo-feature-toggle/activatestage/ring-2

Headers:

  • x-application: Demo_Tenant
  • x-environment: Dev

Response

204

Delete Flag

Deletes an existing feature flag/toggle

HTTP Request

DELETE api/v1/featureflags/{feature-flag-name}

Headers

Header Value More Details
Content-Type application/json
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

HTTP Response

204 Status Code

Status Codes

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

Sample

DELETE api/v1/featureflags/demo-feature-toggle

Headers:

  • x-application: Demo_Tenant
  • x-environment: Dev

Response

204

Get Feature Flag

Gets a feature flag by name

HTTP Request

GET api/v1/featureflags/{feature-name}

Headers

Header Value More Details
Content-Type application/json
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

HTTP Response

Flag resource

{
    "name": "Name of the feature flag",
    "description": "Some description about the feature flag",
    "enabled": true | false,
    "environment": "Environment Name",
    "conditions": {
        "client_filters": [
            {
                "name": "Name of the filter",
                "parameters": {
                    "operator": "Operator to be used for evaluating the flight context value and the configured value",
                    "value": "Configured Value against which evaluation will be done",
                    "isActive": "true | false",
                    "stageId": "ID of the stage/ring",
                    "stageName": "Name of the stage/ring",
                    "flightContextKey": "Key to be used from the flighting context object for matching against the configured value"
                }
            }
        ]
    }
}

Status Codes

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

Sample

api/v1/featureflags/Demo-1

Headers:

  • x-application: Demo_Tenant
  • x-environment: Dev

Response

{
    "name": "Demo-PB-Test-004-Refactored-Code",
    "description": "FunctionalTestingflagDescription",
    "enabled": true,
    "environment": "dev",
    "conditions": {
        "client_filters": [
            {
                "name": "Country",
                "parameters": {
                    "operator": "In",
                    "value": "India,UK,USA",
                    "isActive": "true",
                    "stageId": "0",
                    "stageName": "stg1",
                    "flightContextKey": "Country"
                }
            }
        ]
    }
}

Get all Feature Flags

Gets all the feature flags/toggles for the given tenant

HTTP Request

GET api/v1/featureflags

Headers

Header Value More Details
Content-Type application/json
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

HTTP Response

Flag collection

Status Codes

Header Value
200 Success
401 Unauthorized (Issue with the bearer token)
500 Unhandled failure

Get Filters

Gets all the filters configured for a tenant

HTTP Request

GET api/v1/configuration/filters

Headers

Header Value More Details
Content-Type application/json
Authorization Bearer {token}. Required AAD bearer token for the configured Resource ID in your tenant
X-Application Name of the tenant. Required Read more

HTTP Response

List of filter names

Status Codes

Header Value
200 Success
401 Unauthorized (Issue with the bearer token)
500 Unhandled failure

Sample

GET api/v1/configuration/filters

Headers:

  • x-application: Demo_Tenant

Response

[
    "Alias",
    "RoleGroup",
    "Date",
    "Country",
    "Region",
    "Role",
    "UserUpn",
    "Generic",
    "RulesEngine"
]

Get Filter-Operator Mapping

Gets the list of filters and operators allowed to operate on them

HTTP Request

GET api/v1/configuration/filters/operators/map

Headers

Header Value More Details
Content-Type application/json
Authorization Bearer {token}. Required AAD bearer token for the configured Resource ID in your tenant
X-Application Name of the tenant. Required Read more

HTTP Response

Filters and the list of operators for each filter

Status Codes

Header Value
200 Success
401 Unauthorized (Issue with the bearer token)
500 Unhandled failure

Sample

GET api/v1/configuration/filters/operators/map

Headers:

  • x-application: Demo_Tenant

Response

{
    "Alias": [
        "Equals",
        "NotEquals",
        "In",
        "NotIn",
        "LessThan",
        "GreaterThan",
        "MemberOfSecurityGroup",
        "NotMemberOfSecurityGroup"
    ],
    "RoleGroup": [
        "Equals",
        "NotEquals",
        "In",
        "NotIn",
        "LessThan",
        "GreaterThan"
    ],
    "Date": [
        "LessThan",
        "GreaterThan"
    ],
    "Country": [
        "Equals",
        "NotEquals",
        "In",
        "NotIn",
        "LessThan",
        "GreaterThan"
    ],
    "Region": [
        "Equals",
        "NotEquals",
        "In",
        "NotIn",
        "LessThan",
        "GreaterThan"
    ],
    "Role": [
        "Equals",
        "NotEquals",
        "In",
        "NotIn",
        "LessThan",
        "GreaterThan"
    ],
    "UserUpn": [
        "Equals",
        "NotEquals",
        "In",
        "NotIn",
        "LessThan",
        "GreaterThan",
        "MemberOfSecurityGroup",
        "NotMemberOfSecurityGroup"
    ],
    "Generic": [
        "Equals",
        "NotEquals",
        "In",
        "NotIn",
        "LessThan",
        "GreaterThan"
    ],
    "RulesEngine": [
        "Evaluates",
        "NotEvaluates"
    ]
}
Clone this wiki locally