1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-10-18 20:09:08 +02:00
unleash.unleash/website/docs/reference/api/legacy/unleash/admin/tags.md
Thomas Heartman d5fbd0b743
refactor: move docs into new structure / fix links for SEO (#2416)
## What

This (admittedly massive) PR updates the "physical" documentation
structure and fixes url inconsistencies and SEO problems reported by
marketing. The main points are:

- remove or move directories : advanced, user_guide, deploy, api
- move the files contained within to the appropriate one of topics,
how-to, tutorials, or reference
- update internal doc links and product links to the content
- create client-side redirects for all the urls that have changed.

A number of the files have been renamed in small ways to better match
their url and to make them easier to find. Additionally, the top-level
api directory has been moved to /reference/api/legacy/unleash (see the
discussion points section for more on this).

## Why

When moving our doc structure to diataxis a while back, we left the
"physical' files lying where they were, because it didn't matter much to
the new structure. However, that did introduce some inconsistencies with
where you place docs and how we organize them.

There's also the discrepancies in whether urls us underscores or hyphens
(which isn't necessarily the same as their file name), which has been
annoying me for a while, but now has also been raised by marketing as an
issue in terms of SEO.

## Discussion points

The old, hand-written API docs have been moved from /api to
/reference/api/legacy/unleash. There _is_ a /reference/api/unleash
directory, but this is being populated by the OpenAPI plugin, and mixing
those could only cause trouble. However, I'm unsure about putting
/legacy/ in the title, because the API isn't legacy, the docs are. Maybe
we could use another path? Like /old-docs/ or something? I'd appreciate
some input on this.
2022-11-22 09:05:30 +00:00

4.1 KiB

id title
tags /api/admin/tags

In order to access the admin API endpoints you need to identify yourself. Unless you're using the none authentication method, you'll need to create an ADMIN token and add an Authorization header using the token.

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

{
  "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:

{
  "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

{
  "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:

{
  "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:

{
  "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:

{
  "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.

Returns 201-CREATED if the tag type was created successfully

Update tag type

PUT: https://unleash.host.com/api/admin/tag-types/:typeName

Body:

{
  "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