Skip to content

Tutorial

The Featuren is a software for you managing your features in production. In this tutorial you’ll learn how can get and update the features using only service token.

# Setup#

# Use Featuren#

Each service has a unique token. Use this token to get the feature information.

Example

Get feature#

Information

Use the service token you created before to access the resource. However, you only will be access to get and update feature information.

If you want full access to feature resource, see more details here.

GET /features/{id}

Request#

1
2
GET /features/search-button HTTP/1.1
Authorization: Token _Ld_k_26y7H-Ar9og6cEz54rkNZEDkW1BIrkgSAFFg
1
2
curl "http://0.0.0.0:8000/features/search-button" \
     -H 'Authorization: Token _Ld_k_26y7H-Ar9og6cEz54rkNZEDkW1BIrkgSAFFg'
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
# Install the Python Requests library:
# `pip install requests`

import requests

host = "http://0.0.0.0:8000"
token = "_Ld_k_26y7H-Ar9og6cEz54rkNZEDkW1BIrkgSAFFg"

headers = {"Authorization": f"Token {token}"}
response = requests.get(f"{host}/features/search-button", headers=headers)

print(response.json())

Response#

1
{"id":"search-button","version":"1.0.0"}
1
{"message":"Unauthorized"}
1
{"message":"Access denied to resource"}
1
{"message": "Feature not found"}

Update feature#

Tip

For more details about feature attributes see here.

PUT /features/{id}

Request#

1
2
3
4
5
6
PUT /features/search-button HTTP/1.1
Authorization: Token _Ld_k_26y7H-Ar9og6cEz54rkNZEDkW1BIrkgSAFFg
Content-Type: application/json; charset=utf-8
Host: 0.0.0.0:8000

{"enabled":true,"deny":false,"version":"1.0.0"]}
1
2
3
4
5
6
7
8
curl -X "PUT" "http://0.0.0.0:8000/features/search-button" \
     -H 'Authorization: Token _Ld_k_26y7H-Ar9og6cEz54rkNZEDkW1BIrkgSAFFg' \
     -H 'Content-Type: application/json; charset=utf-8' \
     -d '{
            "enabled": true,
            "deny": false,
            "version": "1.0.0"
         }'
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
# Install the Python Requests library:
# `pip install requests`

import requests

host = "http://0.0.0.0:8000"
token = "_Ld_k_26y7H-Ar9og6cEz54rkNZEDkW1BIrkgSAFFg"

feature = {"enabled":True,"deny":False,"version":"1.0.1"}

headers = {"Authorization": f"Token {token}"}
response = requests.put(f"{host}/features/search-button", feature, headers=headers)

print(response.json())

Response#

1
{"message": "Feature update successfully."}
1
{"message": "Unauthorized."}
1
{"message":"Access denied to resource."}
1
{"message": "Feature not found."}

You finished! Congratulations!

If you have any questions or found a bug, please open an issue here