Pheature Flags API
Scroll down for code samples, example requests and responses. Select a language for code samples from the tabs above or the mobile navigation menu.
This is the documentation of the Pheature Flags APIs. It documents 2 API:
- Client API: Used by clients to discover their associated features and its current status
- CRUD API: Used by admins to create, read, update and delete features
Client API
This API allows to check for features' status.
Retrieves the list of features for the given identity.
Code samples
GET /features HTTP/1.1
Accept: application/json
Identity: eyJpZGVudGl0eV9pZCI6ICJzdHJpbmciLCJwYXlsb2FkIjoge319Cg==
<?php
require 'vendor/autoload.php';
$headers = array(
'Accept' => 'application/json',
'Identity' => 'eyJpZGVudGl0eV9pZCI6ICJzdHJpbmciLCJwYXlsb2FkIjoge319Cg==',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
$request_body = array();
try {
$response = $client->request('GET','/features', array(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
import requests
headers = {
'Accept': 'application/json',
'Identity': 'eyJpZGVudGl0eV9pZCI6ICJzdHJpbmciLCJwYXlsb2FkIjoge319Cg=='
}
r = requests.get('/features', headers = headers)
print(r.json())
const headers = {
'Accept':'application/json',
'Identity':'eyJpZGVudGl0eV9pZCI6ICJzdHJpbmciLCJwYXlsb2FkIjoge319Cg=='
};
fetch('/features',
{
method: 'GET',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Accept": []string{"application/json"},
"Identity": []string{"eyJpZGVudGl0eV9pZCI6ICJzdHJpbmciLCJwYXlsb2FkIjoge319Cg=="},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("GET", "/features", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
# You can also use wget
curl -X GET /features \
-H 'Accept: application/json' \
-H 'Identity: eyJpZGVudGl0eV9pZCI6ICJzdHJpbmciLCJwYXlsb2FkIjoge319Cg=='
GET /features
Retrieves the list of features for the given identity.
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
identity | header | Identity | true | Identifier of the Request |
Example responses
200 Response
[
{
"feature_id": "string",
"enabled": true
}
]
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | Retrieves the list of features for the given identity. | FeatureCollection |
404 | Not Found | The specified resource was not found. | None |
Retrieves a feature for the given feture id and identity.
Code samples
GET /features/{feature_id} HTTP/1.1
Accept: application/json
Identity: eyJpZGVudGl0eV9pZCI6ICJzdHJpbmciLCJwYXlsb2FkIjoge319Cg==
<?php
require 'vendor/autoload.php';
$headers = array(
'Accept' => 'application/json',
'Identity' => 'eyJpZGVudGl0eV9pZCI6ICJzdHJpbmciLCJwYXlsb2FkIjoge319Cg==',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
$request_body = array();
try {
$response = $client->request('GET','/features/{feature_id}', array(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
import requests
headers = {
'Accept': 'application/json',
'Identity': 'eyJpZGVudGl0eV9pZCI6ICJzdHJpbmciLCJwYXlsb2FkIjoge319Cg=='
}
r = requests.get('/features/{feature_id}', headers = headers)
print(r.json())
const headers = {
'Accept':'application/json',
'Identity':'eyJpZGVudGl0eV9pZCI6ICJzdHJpbmciLCJwYXlsb2FkIjoge319Cg=='
};
fetch('/features/{feature_id}',
{
method: 'GET',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Accept": []string{"application/json"},
"Identity": []string{"eyJpZGVudGl0eV9pZCI6ICJzdHJpbmciLCJwYXlsb2FkIjoge319Cg=="},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("GET", "/features/{feature_id}", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
# You can also use wget
curl -X GET /features/{feature_id} \
-H 'Accept: application/json' \
-H 'Identity: eyJpZGVudGl0eV9pZCI6ICJzdHJpbmciLCJwYXlsb2FkIjoge319Cg=='
GET /features/{feature_id}
Retrieves a feature for the given feture id and identity.
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
identity | header | Identity | true | Identifier of the Request |
feature_id | path | string | true | Identifier of the Feature |
Example responses
200 Response
{
"feature_id": "string",
"enabled": true
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | Retrieves a feature for the given feture id and identity. | Feature |
404 | Not Found | The specified resource was not found. | None |
Schemas
Feature
{
"feature_id": "string",
"enabled": true
}
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
feature_id | string | false | none | none |
enabled | boolean | false | none | none |
FeatureCollection
[
{
"feature_id": "string",
"enabled": true
}
]
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
anonymous | [Feature] | false | none | none |
Identity
{
"identity_id": "string",
"payload": {}
}
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
identity_id | string | true | none | none |
payload | object | false | none | none |
CRUD API
This API allows to Create, Read, Update and Delete features.
Retrieves a specific feature
Code samples
GET /features/{feature_id} HTTP/1.1
Accept: application/json
<?php
require 'vendor/autoload.php';
$headers = array(
'Accept' => 'application/json',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
$request_body = array();
try {
$response = $client->request('GET','/features/{feature_id}', array(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
import requests
headers = {
'Accept': 'application/json'
}
r = requests.get('/features/{feature_id}', headers = headers)
print(r.json())
const headers = {
'Accept':'application/json'
};
fetch('/features/{feature_id}',
{
method: 'GET',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Accept": []string{"application/json"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("GET", "/features/{feature_id}", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
# You can also use wget
curl -X GET /features/{feature_id} \
-H 'Accept: application/json'
GET /features/{feature_id}
Retrieves a specific feature
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
feature_id | path | string | true | Identifier of the Feature |
Example responses
200 Response
{
"id": "string",
"strategies": [
{
"id": "string",
"payload": {}
}
],
"isEnabled": true
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | Retrieves a specific feature | Feature |
404 | Not Found | The specified resource was not found. | None |
Creates a feature
Code samples
POST /features/{feature_id} HTTP/1.1
<?php
require 'vendor/autoload.php';
$client = new \GuzzleHttp\Client();
// Define array of request body.
$request_body = array();
try {
$response = $client->request('POST','/features/{feature_id}', array(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
import requests
r = requests.post('/features/{feature_id}')
print(r.json())
fetch('/features/{feature_id}',
{
method: 'POST'
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
package main
import (
"bytes"
"net/http"
)
func main() {
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("POST", "/features/{feature_id}", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
# You can also use wget
curl -X POST /features/{feature_id}
POST /features/{feature_id}
Creates a feature
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
feature_id | path | string | true | Identifier of the Feature |
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
201 | Created | The specified feature was created. | None |
Modifies a specific feature
Code samples
PATCH /features/{feature_id} HTTP/1.1
Content-Type: application/json
<?php
require 'vendor/autoload.php';
$headers = array(
'Content-Type' => 'application/json',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
$request_body = array();
try {
$response = $client->request('PATCH','/features/{feature_id}', array(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
import requests
headers = {
'Content-Type': 'application/json'
}
r = requests.patch('/features/{feature_id}', headers = headers)
print(r.json())
const inputBody = '{
"action": "enable_feature",
"value": "strategy_id"
}';
const headers = {
'Content-Type':'application/json'
};
fetch('/features/{feature_id}',
{
method: 'PATCH',
body: inputBody,
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Content-Type": []string{"application/json"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("PATCH", "/features/{feature_id}", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
# You can also use wget
curl -X PATCH /features/{feature_id} \
-H 'Content-Type: application/json'
PATCH /features/{feature_id}
Modifies a specific feature
Body parameter
{
"action": "enable_feature",
"value": "strategy_id"
}
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
feature_id | path | string | true | Identifier of the Feature |
body | body | object | true | none |
» action | body | string | false | none |
» value | body | string | false | none |
Enumerated Values
Parameter | Value |
---|---|
» action | enable_feature |
» action | disable_feature |
» action | add_strategy |
» action | remove_strategy |
» value | strategy_id |
» value | strategy_type |
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
202 | Accepted | The specified feature's patch was processed. | None |
Deletes a specific feature
Code samples
DELETE /features/{feature_id} HTTP/1.1
<?php
require 'vendor/autoload.php';
$client = new \GuzzleHttp\Client();
// Define array of request body.
$request_body = array();
try {
$response = $client->request('DELETE','/features/{feature_id}', array(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
import requests
r = requests.delete('/features/{feature_id}')
print(r.json())
fetch('/features/{feature_id}',
{
method: 'DELETE'
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
package main
import (
"bytes"
"net/http"
)
func main() {
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("DELETE", "/features/{feature_id}", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
# You can also use wget
curl -X DELETE /features/{feature_id}
DELETE /features/{feature_id}
Deletes a specific feature
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
feature_id | path | string | true | Identifier of the Feature |
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
204 | No Content | The specified feature was deleted. | None |
Retrieves the list of features
Code samples
GET /features HTTP/1.1
Accept: application/json
<?php
require 'vendor/autoload.php';
$headers = array(
'Accept' => 'application/json',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
$request_body = array();
try {
$response = $client->request('GET','/features', array(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
import requests
headers = {
'Accept': 'application/json'
}
r = requests.get('/features', headers = headers)
print(r.json())
const headers = {
'Accept':'application/json'
};
fetch('/features',
{
method: 'GET',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Accept": []string{"application/json"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("GET", "/features", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
# You can also use wget
curl -X GET /features \
-H 'Accept: application/json'
GET /features
Retrieves the list of features
Example responses
200 Response
[
{
"id": "string",
"strategies": [
{
"id": "string",
"payload": {}
}
],
"isEnabled": true
}
]
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | Retrieves the list of features. | Inline |
404 | Not Found | The specified resource was not found. | None |
Response Schema
Status Code 200
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
anonymous | [Feature] | false | none | none |
» id | string | false | none | none |
» strategies | [Strategy] | false | none | none |
»» id | string | false | none | none |
»» payload | object | false | none | none |
» isEnabled | boolean | false | none | none |
Schemas
Feature
{
"id": "string",
"strategies": [
{
"id": "string",
"payload": {}
}
],
"isEnabled": true
}
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
id | string | false | none | none |
strategies | [Strategy] | false | none | none |
isEnabled | boolean | false | none | none |
Strategy
{
"id": "string",
"payload": {}
}
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
id | string | false | none | none |
payload | object | false | none | none |