Skip to main content

GO Feature Flag relay proxy endpoints

Download OpenAPI specification:Download

GO feature flag relay proxy: contact@gofeatureflag.org URL: https://gofeatureflag.org License: MIT

Introduction

This API is documented in OpenAPI format and describe the REST API of the GO Feature Flag relay proxy.

The relay proxy is a component to evaluate your feature flags remotely when using GO Feature Flag.
This API is mostly used by all the OpenFeature providers.

Admin API to manage GO Feature Flag

This endpoint is used to force the refresh of the flags in the cache.

This endpoint is used to force the refresh of the flags in the cache. This endpoint is used when you know explicitly that a flag has changed, and you want to trigger the collection of the new versions.

Authorizations:
ApiKeyAuth

Responses

Response samples

Content type
application/json
{
  • "refreshed": true
}

Profiling

pprof endpoint

This endpoint is provided by the echo pprof middleware. To know more please check this blogpost from the GO team https://go.dev/blog/pprof. Visit the page /debug/pprof/ to see the available endpoints, all endpoint are not in the swagger documentation because they are standard pprof endpoints. This endpoint is only available in debug mode.

Responses

Monitoring

Health

Making a GET request to the URL path /health will tell you if the relay proxy is ready to serve traffic.

This is useful especially for loadbalancer to know that they can send traffic to the service.

Responses

Response samples

Content type
application/json
{
  • "initialized": true
}

Info

Making a GET request to the URL path /info will give you information about the actual state of the relay proxy.

As of Today the level of information is small be we can improve this endpoint to returns more information.

Responses

Response samples

Content type
application/json
{
  • "cacheRefresh": "2022-06-13T11:22:55.941628+02:00"
}

Prometheus endpoint

This endpoint is providing metrics about the relay proxy in the prometheus format.

Responses

OpenFeature Remote Evaluation Protocol (OFREP)

OFREP provider configuration

OFREP configuration to provide information about the remote flag management system, to configure the OpenFeature SDK providers.

This endpoint will be called during the initialization of the provider.

Authorizations:
ApiKeyAuth
header Parameters
If-None-Match
string

The request will be processed only if ETag doesn't match.

Responses

Response samples

Content type
application/json
{
  • "capabilities": {
    • "cacheInvalidation": {
      • "polling": {
        • "enabled": true,
        • "minPollingInterval": 0
        }
      },
    • "flagEvaluation": {
      • "unsupportedTypes": [
        • "string"
        ]
      }
    },
  • "name": "string"
}

Open-Feature Remote Evaluation Protocol bulk evaluation API.

Making a POST request to the URL /ofrep/v1/evaluate/flags will give you the value of the list of feature flags for this evaluation context.

If no flags are provided, the API will evaluate all available flags in the configuration.

Authorizations:
ApiKeyAuth
header Parameters
If-None-Match
string

The request will be processed only if ETag doesn't match.

Request Body schema: application/json
required

Evaluation Context and list of flag for this API call

object

Responses

Request samples

Content type
application/json
{
  • "context": {
    • "company": "GO Feature Flag",
    • "firstname": "John",
    • "lastname": "Doe",
    • "targetingKey": "4f433951-4c8c-42b3-9f18-8c9a5ed8e9eb"
    }
}

Response samples

Content type
application/json
{
  • "flags": [
    • {
      • "errorCode": "string",
      • "errorDetails": "string",
      • "key": "string",
      • "metadata": {
        • "property1": null,
        • "property2": null
        },
      • "reason": "string",
      • "value": null,
      • "variant": "string"
      }
    ]
}

Evaluate a feature flag using the OpenFeature Remote Evaluation Protocol

Making a POST request to the URL /ofrep/v1/evaluate/flags/{your_flag_name} will give you the value of the flag for this evaluation context

Authorizations:
ApiKeyAuth
path Parameters
flag_key
required
string

Name of your feature flag

Request Body schema: application/json
required

Evaluation Context for this API call

object

Responses

Request samples

Content type
application/json
{
  • "context": {
    • "company": "GO Feature Flag",
    • "firstname": "John",
    • "lastname": "Doe",
    • "targetingKey": "4f433951-4c8c-42b3-9f18-8c9a5ed8e9eb"
    }
}

Response samples

Content type
application/json
{
  • "key": "string",
  • "metadata": {
    • "property1": null,
    • "property2": null
    },
  • "reason": "string",
  • "value": null,
  • "variant": "string"
}

GO Feature Flag Evaluation API

All flags variations for a user

Making a POST request to the URL /v1/allflags will give you the values of all the flags for this user.

To get a variation you should provide information about the user. For that you should provide some user information in JSON in the request body.

Authorizations:
ApiKeyAuth
Request Body schema: application/json
required

Payload of the user we want to challenge against the flag.

object

EvaluationContext The representation of a EvaluationContext for your feature flag system.

Responses

Request samples

Content type
application/json
{
  • "evaluationContext": {
    • "custom": {
      • "company": "GO Feature Flag",
      • "email": "contact@gofeatureflag.org",
      • "firstname": "John",
      • "lastname": "Doe"
      },
    • "key": "08b5ffb7-7109-42f4-a6f2-b85560fbd20f"
    }
}

Response samples

Content type
application/json
{
  • "flags": {
    • "property1": {
      • "timestamp": 1652113076,
      • "trackEvents": false,
      • "value": null,
      • "variationType": "variation-A"
      },
    • "property2": {
      • "timestamp": 1652113076,
      • "trackEvents": false,
      • "value": null,
      • "variationType": "variation-A"
      }
    },
  • "valid": false
}

Endpoint to send usage of your flags to be collected

This endpoint is receiving the events of your flags usage to send them in the data collector.

It is used by the different Open Feature providers to send in bulk all the cached events to avoid to lose track of what happen when a cached flag is used.

Authorizations:
ApiKeyAuth
Request Body schema: application/json
required

List of flag evaluation that be passed to the data exporter

Array of objects (exporter.FeatureEvent)

Events is the list of the event we send in the payload

object

Meta are the extra information added during the configuration

Responses

Request samples

Content type
application/json
{
  • "events": [
    • {
      • "contextKind": "user",
      • "creationDate": 1680246000011,
      • "default": false,
      • "key": "my-feature-flag",
      • "kind": "feature",
      • "metadata": { },
      • "source": "SERVER",
      • "userKey": "94a25909-20d8-40cc-8500-fee99b569345",
      • "value": null,
      • "variation": "admin-variation",
      • "version": "v1.0.0"
      }
    ],
  • "meta": { }
}

Response samples

Content type
application/json
{
  • "ingestedContentCount": 0
}

Evaluate a feature flag

Making a POST request to the URL /v1/feature/<your_flag_name>/eval will give you the value of the flag for this user.

To get a variation you should provide information about the user:

  • User information in JSON in the request body.
  • A default value in case there is an error while evaluating the flag.

Note that you will always have a usable value in the response, you can use the field failed to know if an issue has occurred during the validation of the flag, in that case the value returned will be the default value.

Authorizations:
ApiKeyAuth
path Parameters
flag_key
required
string

Name of your feature flag

Request Body schema: application/json
required

Payload of the user we want to get all the flags from.

defaultValue
any

The value will we use if we are not able to get the variation of the flag.

object

EvaluationContext The representation of a EvaluationContext for your feature flag system.

Responses

Request samples

Content type
application/json
{
  • "defaultValue": null,
  • "evaluationContext": {
    • "custom": {
      • "company": "GO Feature Flag",
      • "email": "contact@gofeatureflag.org",
      • "firstname": "John",
      • "lastname": "Doe"
      },
    • "key": "08b5ffb7-7109-42f4-a6f2-b85560fbd20f"
    }
}

Response samples

Content type
application/json
{
  • "errorCode": "",
  • "failed": false,
  • "metadata": { },
  • "reason": "TARGETING_MATCH",
  • "trackEvents": true,
  • "value": null,
  • "variationType": "variation-A",
  • "version": "1.0"
}

Endpoint to poll if you want to know if there is a configuration change in the flags

Making a GET request to the URL /v1/flag/change will give you the hash of the current configuration, you can use this hash to know if the configuration has changed.

Authorizations:
ApiKeyAuth
header Parameters
If-None-Match
string

The request will be processed only if ETag doesn't match.

Responses

Response samples

Content type
application/json
{
  • "flags": {
    • "property1": 0,
    • "property2": 0
    },
  • "hash": 0
}

GO Feature Flag Evaluation Websocket API

Websocket endpoint to be notified about flag changes

This endpoint is a websocket endpoint to be notified about flag changes, every change will send a request to the client with a model.DiffCache format.

query Parameters
apiKey
string

apiKey use authorize the connection to the relay proxy

Responses

Response samples

Content type
application/json
{
  • "added": {
    • "property1": {
      • "defValue": "string",
      • "name": "string",
      • "usage": "string",
      • "value": null
      },
    • "property2": {
      • "defValue": "string",
      • "name": "string",
      • "usage": "string",
      • "value": null
      }
    },
  • "deleted": {
    • "property1": {
      • "defValue": "string",
      • "name": "string",
      • "usage": "string",
      • "value": null
      },
    • "property2": {
      • "defValue": "string",
      • "name": "string",
      • "usage": "string",
      • "value": null
      }
    },
  • "updated": {
    • "property1": {
      • "new_value": {
        • "defValue": "string",
        • "name": "string",
        • "usage": "string",
        • "value": null
        },
      • "old_value": {
        • "defValue": "string",
        • "name": "string",
        • "usage": "string",
        • "value": null
        }
      },
    • "property2": {
      • "new_value": {
        • "defValue": "string",
        • "name": "string",
        • "usage": "string",
        • "value": null
        },
      • "old_value": {
        • "defValue": "string",
        • "name": "string",
        • "usage": "string",
        • "value": null
        }
      }
    }
}

Get the latest GO Feature Flag updates