1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-10-18 20:09:08 +02:00
unleash.unleash/docs/api/admin/tags-api.md
Alexis Degrugillier 0f60fd075a
chore: Fix documentation typos (#758)
Co-authored-by: Alexis Degrugillier <alexis.degrugillier@duproprio.com>
2021-03-09 21:44:45 +01:00

180 lines
3.8 KiB
Markdown

---
id: tags
title: /api/admin/tags
---
> In order to access the admin API endpoints you need to identify yourself. If you are using the `insecure` authentication method, you may use [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) to identify yourself.
### Create a new tag
`POST https://unleash.host.com/api/admin/tags`
Creates a new tag without connecting it to any other object, can be helpful to build an autocomplete list.
**Body**
```json
{
"value": "MyTag",
"type": "simple"
}
```
### Notes
- `type` must exist in tag-types
### List tags
`GET https://unleash.host.com/api/admin/tags`
This endpoint is the one all admin UIs should use to fetch all available tags from the _unleash_server_. The response returns all tags.
**Example response:**
```json
{
"version": 1,
"tags": [
{
"value": "Team-Red",
"type": "simple"
},
{
"value": "Team-Green",
"type": "simple"
},
{
"value": "DecemberExperiment",
"type": "simple"
},
{
"value": "#team-alert-channel",
"type": "slack"
}
]
}
```
### List tags by type
`GET: https://unleash.host.com/api/admin/tags/:type`
Lists all tags of `:type`. If none exist, returns the empty list
**Example response to query for https://unleash.host.com/api/admin/tags/simple**
```json
{
"version": 1,
"tags": [
{
"value": "Team-Red",
"type": "simple"
},
{
"value": "Team-Green",
"type": "simple"
},
{
"value": "DecemberExperiment",
"type": "simple"
}
]
}
```
### Get a single tag
`GET https://unleash.host.com/api/admin/tags/:type/:value`
Gets the tag defined by the `type, value` tuple
### Delete a tag
`DELETE https://unleash.host.com/api/admin/tags/:type/:value`
Deletes the tag defined by the `type, value` tuple; all features tagged with this tag will lose the tag.
### Fetching Tag types
`GET: https://unleash.host.com/api/admin/tag-types`
Used to fetch all types the server knows about. This endpoint is the one all admin UI should use to fetch all available tag types from the _unleash-server_. The response returns all tag types. Any server will have _at least_ one configured tag type (the `simple` type). A tag type will be a map of `type`, `description`, `icon`
**Example response:**
```json
{
"version": 1,
"tagTypes": [
{
"name": "simple",
"description": "Arbitrary tags. Used to simplify filtering of features",
"icon": "#"
}
]
}
```
### Get a single tag type
`GET: https://unleash.host.com/api/admin/tag-types/simple`
Used to fetch details about a specific tag-type. This is mostly provided to make it easy to debug the API and should not be used by the client implementations.
**Example response:**
```json
{
"version": 1,
"tagType": {
"name": "simple",
"description": "Some description",
"icon": "Some icon",
"createdAt": "2021-01-07T10:00:00Z"
}
}
```
### Create a new tag type
`POST: https://unleash.host.com/api/admin/tag-types`
Used to register a new tag type. This endpoint should be used to inform the server about a new type of tags.
**Body:**
```json
{
"name": "tagtype",
"description": "Purpose of tag type",
"icon": "Either an URL to icon or a simple prefix string for tag"
}
```
**Notes:**
- if `name` is not unique, will return 409 CONFLICT, if you'd like to update an existing tag through admin-api look at [Update tag type](#Update-tag-type).
Returns 201-CREATED if the tag type was created successfully
### Update tag type
`PUT: https://unleash.host.com/api/admin/tag-types/:typeName`
**Body:**
```json
{
"description": "New description",
"icon": "New icon"
}
```
### Deleting a tag type
`DELETE: https://unleash.host.com/api/admin/tag-types/:typeName`
Returns 200 if the type was not in use and the type was deleted. If the type was in use, will return a _409 CONFLICT_