mirror of
https://github.com/Unleash/unleash.git
synced 2025-07-26 13:48:33 +02:00
chore: add docs for context api (#762)
This commit is contained in:
parent
ba959e41f8
commit
1152272ed6
89
docs/api/admin/context.md
Normal file
89
docs/api/admin/context.md
Normal file
@ -0,0 +1,89 @@
|
||||
---
|
||||
id: context
|
||||
title: /api/admin/context
|
||||
---
|
||||
|
||||
> The context feature is only available as part of Unleash Enterprise. In order to access the API programmatically you need to make sure you obtain a API token with admin permissions.
|
||||
|
||||
### List context fields defined in Unleash
|
||||
|
||||
`GET https://unleash.host.com/api/admin/context`
|
||||
|
||||
Returns a list of context fields defined in Unleash.
|
||||
|
||||
**Example response:**
|
||||
|
||||
```json
|
||||
[
|
||||
{
|
||||
"name": "appName",
|
||||
"description": "Allows you to constrain on application name",
|
||||
"stickiness": false,
|
||||
"sortOrder": 2,
|
||||
"createdAt": "2020-03-05T19:33:19.784Z"
|
||||
},
|
||||
{
|
||||
"name": "environment",
|
||||
"description": "Allows you to constrain on application environment",
|
||||
"stickiness": false,
|
||||
"sortOrder": 0,
|
||||
"legalValues": ["qa", "dev", "prod"],
|
||||
"createdAt": "2020-03-05T19:33:19.784Z"
|
||||
},
|
||||
{
|
||||
"name": "tenantId",
|
||||
"description": "Control rollout to your tenants",
|
||||
"stickiness": true,
|
||||
"sortOrder": 10,
|
||||
"legalValues": ["company-a, company-b"],
|
||||
"createdAt": "2020-03-05T19:33:19.784Z"
|
||||
},
|
||||
{
|
||||
"name": "userId",
|
||||
"description": "Allows you to constrain on userId",
|
||||
"stickiness": false,
|
||||
"sortOrder": 1,
|
||||
"createdAt": "2020-03-05T19:33:19.784Z"
|
||||
}
|
||||
]
|
||||
```
|
||||
|
||||
### Create a new context field
|
||||
|
||||
`POST https://unleash.host.com/api/admin/context`
|
||||
|
||||
Creates a new context field.
|
||||
|
||||
**Body**
|
||||
|
||||
```json
|
||||
{
|
||||
"name": "region",
|
||||
"description": "Control rollout based on region",
|
||||
"legalValues": ["asia", "eu", "europe"],
|
||||
"stickiness": true
|
||||
}
|
||||
```
|
||||
|
||||
### Update a context field
|
||||
|
||||
`PUT https://unleash.host.com/api/context/:name`
|
||||
|
||||
Updates a new context field
|
||||
|
||||
**Body**
|
||||
|
||||
```json
|
||||
{
|
||||
"name": "region",
|
||||
"description": "Control rollout based on region",
|
||||
"legalValues": ["asia", "eu"],
|
||||
"stickiness": true
|
||||
}
|
||||
```
|
||||
|
||||
### Delete a context field
|
||||
|
||||
`DELETE https://unleash.host.com/api/admin/context/:name`
|
||||
|
||||
Deletes the context field with name=`name`.
|
78
docs/api/admin/project.md
Normal file
78
docs/api/admin/project.md
Normal file
@ -0,0 +1,78 @@
|
||||
---
|
||||
id: projects
|
||||
title: /api/admin/projects
|
||||
---
|
||||
|
||||
> The projects feature is only available as part of Unleash Enterprise. In order to access the API programmatically you need to make sure you obtain a API token with admin permissions.
|
||||
|
||||
### List projects in Unleash
|
||||
|
||||
`GET https://unleash.host.com/api/admin/projects`
|
||||
|
||||
Returns a list of projects in Unleash.
|
||||
|
||||
**Example response:**
|
||||
|
||||
```json
|
||||
{
|
||||
"version": 1,
|
||||
"projects": [
|
||||
{
|
||||
"id": "default",
|
||||
"name": "Default",
|
||||
"description": "Default project",
|
||||
"createdAt": "2020-12-03T09:47:20.170Z"
|
||||
},
|
||||
{
|
||||
"id": "MyNewProject",
|
||||
"name": "MyNewProject",
|
||||
"description": "A test project",
|
||||
"createdAt": "2020-12-03T09:47:20.170Z"
|
||||
},
|
||||
{
|
||||
"id": "test",
|
||||
"name": "Test Project",
|
||||
"description": "Collection of test toggles",
|
||||
"createdAt": "2020-12-03T09:47:20.170Z"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
### Create a new project
|
||||
|
||||
`POST https://unleash.host.com/api/admin/projects`
|
||||
|
||||
Creates a new project.
|
||||
|
||||
**Body**
|
||||
|
||||
```json
|
||||
{
|
||||
"id": "someId",
|
||||
"name": "Test Project",
|
||||
"description": "Some description"
|
||||
}
|
||||
```
|
||||
|
||||
### Update a projects field
|
||||
|
||||
`PUT https://unleash.host.com/api/projects/:id`
|
||||
|
||||
Updates a project with id=`id`.
|
||||
|
||||
**Body**
|
||||
|
||||
```json
|
||||
{
|
||||
"id": "someId",
|
||||
"name": "Test Project",
|
||||
"description": "Some description"
|
||||
}
|
||||
```
|
||||
|
||||
### Delete a projects field
|
||||
|
||||
`DELETE https://unleash.host.com/api/admin/projects/:id`
|
||||
|
||||
Deletes the project with id=`id`.
|
@ -47,6 +47,9 @@
|
||||
"api/admin/addons": {
|
||||
"title": "/api/admin/addons"
|
||||
},
|
||||
"api/admin/context": {
|
||||
"title": "/api/admin/context"
|
||||
},
|
||||
"api/admin/events": {
|
||||
"title": "/api/admin/events"
|
||||
},
|
||||
@ -59,6 +62,9 @@
|
||||
"api/admin/metrics": {
|
||||
"title": "/api/admin/metrics"
|
||||
},
|
||||
"api/admin/projects": {
|
||||
"title": "/api/admin/projects"
|
||||
},
|
||||
"api/admin/state": {
|
||||
"title": "/api/admin/state"
|
||||
},
|
||||
@ -173,8 +179,8 @@
|
||||
"user_guide/create_feature_toggle": {
|
||||
"title": "Create a feature toggle"
|
||||
},
|
||||
"user_guide/discover-unknown-toggles": {
|
||||
"title": "user_guide/discover-unknown-toggles"
|
||||
"user_guide/discover_unkonwn_toggles": {
|
||||
"title": "Discover unknown toggles"
|
||||
},
|
||||
"user_guide/index": {
|
||||
"title": "Introduction"
|
||||
|
@ -50,7 +50,9 @@
|
||||
"api/admin/events",
|
||||
"api/admin/state",
|
||||
"api/admin/feature-types",
|
||||
"api/admin/addons"
|
||||
"api/admin/addons",
|
||||
"api/admin/context",
|
||||
"api/admin/projects"
|
||||
],
|
||||
"Internal": ["api/internal/internal", "api/internal/health"],
|
||||
"Specification": ["api/open_api"]
|
||||
|
Loading…
Reference in New Issue
Block a user