2018-11-20 20:34:42 +01:00
|
|
|
---
|
|
|
|
id: features
|
|
|
|
title: /api/client/features
|
|
|
|
---
|
|
|
|
|
2016-09-06 21:23:56 +02:00
|
|
|
### Fetching Feature Toggles
|
|
|
|
|
2017-06-28 10:17:48 +02:00
|
|
|
`GET: http://unleash.host.com/api/client/features`
|
2016-09-06 21:23:56 +02:00
|
|
|
|
2016-11-09 12:41:11 +01:00
|
|
|
**HEADERS:**
|
|
|
|
|
|
|
|
* UNLEASH-APPNAME: appName
|
|
|
|
* UNLEASH-INSTANCEID: instanceId
|
|
|
|
|
2016-09-07 12:12:17 +02:00
|
|
|
This endpoint is the one all clients should use to fetch all available feature toggles
|
|
|
|
from the _unleash-server_. The response returns all active feature toggles and their
|
|
|
|
current strategy configuration. A feature toggle will have _at least_ one configured strategy.
|
|
|
|
A strategy will have a `name` and `parameters` map.
|
2016-09-06 21:23:56 +02:00
|
|
|
|
2018-07-12 16:15:02 +02:00
|
|
|
> _Note:_ Clients should prefer the `strategies` property.
|
2016-09-07 12:12:17 +02:00
|
|
|
> Legacy properties (`strategy` & `parameters`) will be kept until **version 2** of the format.
|
2016-09-06 21:23:56 +02:00
|
|
|
|
2016-09-07 12:12:17 +02:00
|
|
|
This endpoint should never return anything besides a valid *20X or 304-response*. It will also
|
2018-07-12 16:15:02 +02:00
|
|
|
include an `Etag`-header. The value of this header can be used by clients as the value of
|
|
|
|
the `If-None-Match`-header in the request to prevent a data transfer if the client already
|
2016-09-07 12:12:17 +02:00
|
|
|
has the latest response locally.
|
2016-09-06 21:23:56 +02:00
|
|
|
|
|
|
|
**Example response:**
|
|
|
|
```json
|
|
|
|
{
|
|
|
|
"version": 1,
|
|
|
|
"features": [
|
|
|
|
{
|
|
|
|
"name": "Feature.A",
|
|
|
|
"description": "lorem ipsum",
|
|
|
|
"enabled": false,
|
|
|
|
"strategies": [
|
|
|
|
{
|
|
|
|
"name": "default",
|
|
|
|
"parameters": {}
|
|
|
|
}
|
|
|
|
],
|
|
|
|
"strategy": "default",
|
|
|
|
"parameters": {}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"name": "Feature.B",
|
|
|
|
"description": "lorem ipsum",
|
|
|
|
"enabled": true,
|
|
|
|
"strategies": [
|
|
|
|
{
|
|
|
|
"name": "ActiveForUserWithId",
|
|
|
|
"parameters": {
|
|
|
|
"userIdList": "123,221,998"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"name": "GradualRolloutRandom",
|
|
|
|
"parameters": {
|
|
|
|
"percentage": "10"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
],
|
|
|
|
"strategy": "ActiveForUserWithId",
|
|
|
|
"parameters": {
|
|
|
|
"userIdList": "123,221,998"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
2018-11-16 15:56:14 +01:00
|
|
|
You may limit the response by sending a `namePrefix` query-parameter.
|
|
|
|
|
|
|
|
|
2017-06-28 10:17:48 +02:00
|
|
|
`GET: http://unleash.host.com/api/client/features/:featureName`
|
2016-09-06 21:23:56 +02:00
|
|
|
|
2018-07-12 16:15:02 +02:00
|
|
|
Used to fetch details about a specific feature toggle. This is mainly provided to make it easy to
|
2016-09-07 12:12:17 +02:00
|
|
|
debug the API and should not be used by the client implementations.
|
2016-09-06 21:23:56 +02:00
|
|
|
|
2016-09-07 12:12:17 +02:00
|
|
|
> _Notice_: You will not get a version property when fetching a specific feature toggle by name.
|
2016-09-06 21:23:56 +02:00
|
|
|
|
|
|
|
```json
|
|
|
|
{
|
|
|
|
"name": "Feature.A",
|
|
|
|
"description": "lorem ipsum..",
|
|
|
|
"enabled": false,
|
|
|
|
"strategies": [
|
|
|
|
{
|
|
|
|
"name": "default",
|
|
|
|
"parameters": {}
|
|
|
|
}
|
|
|
|
],
|
|
|
|
"strategy": "default",
|
|
|
|
"parameters": {}
|
|
|
|
}
|
|
|
|
```
|