open-vault/website/source/api/secret/identity/entity.html.md

416 lines
9.6 KiB
Markdown
Raw Normal View History

---
layout: "api"
page_title: "Identity Secret Backend: Entity - HTTP API"
New Docs Website (#5535) * conversion stage 1 * correct image paths * add sidebar title to frontmatter * docs/concepts and docs/internals * configuration docs and multi-level nav corrections * commands docs, index file corrections, small item nav correction * secrets converted * auth * add enterprise and agent docs * add extra dividers * secret section, wip * correct sidebar nav title in front matter for apu section, start working on api items * auth and backend, a couple directory structure fixes * remove old docs * intro side nav converted * reset sidebar styles, add hashi-global-styles * basic styling for nav sidebar * folder collapse functionality * patch up border length on last list item * wip restructure for content component * taking middleman hacking to the extreme, but its working * small css fix * add new mega nav * fix a small mistake from the rebase * fix a content resolution issue with middleman * title a couple missing docs pages * update deps, remove temporary markup * community page * footer to layout, community page css adjustments * wip downloads page * deps updated, downloads page ready * fix community page * homepage progress * add components, adjust spacing * docs and api landing pages * a bunch of fixes, add docs and api landing pages * update deps, add deploy scripts * add readme note * update deploy command * overview page, index title * Update doc fields Note this still requires the link fields to be populated -- this is solely related to copy on the description fields * Update api_basic_categories.yml Updated API category descriptions. Like the document descriptions you'll still need to update the link headers to the proper target pages. * Add bottom hero, adjust CSS, responsive friendly * Add mega nav title * homepage adjustments, asset boosts * small fixes * docs page styling fixes * meganav title * some category link corrections * Update API categories page updated to reflect the second level headings for api categories * Update docs_detailed_categories.yml Updated to represent the existing docs structure * Update docs_detailed_categories.yml * docs page data fix, extra operator page remove * api data fix * fix makefile * update deps, add product subnav to docs and api landing pages * Rearrange non-hands-on guides to _docs_ Since there is no place for these on learn.hashicorp, we'll put them under _docs_. * WIP Redirects for guides to docs * content and component updates * font weight hotfix, redirects * fix guides and intro sidenavs * fix some redirects * small style tweaks * Redirects to learn and internally to docs * Remove redirect to `/vault` * Remove `.html` from destination on redirects * fix incorrect index redirect * final touchups * address feedback from michell for makefile and product downloads
2018-10-19 15:40:11 +00:00
sidebar_title: "Entity"
sidebar_current: "api-http-secret-identity-entity"
description: |-
This is the API documentation for managing entities in the identity store.
---
## Create an Entity
This endpoint creates or updates an Entity.
| Method | Path | Produces |
| :------- | :------------------ | :----------------------|
| `POST` | `/identity/entity` | `200 application/json` |
### Parameters
- `name` `(string: entity-<UUID>)` Name of the entity.
- `id` `(string: <optional>)` - ID of the entity. If set, updates the
corresponding existing entity.
- `metadata` `(key-value-map: {})` Metadata to be associated with the
entity.
- `policies` `(list of strings: [])` Policies to be tied to the entity.
- `disabled` `(bool: false)` Whether the entity is disabled. Disabled
entities' associated tokens cannot be used, but are not revoked.
### Sample Payload
```json
{
"metadata": {
"organization": "hashicorp",
"team": "vault"
},
"policies": ["eng-dev", "infra-dev"]
}
```
### Sample Request
```
$ curl \
--header "X-Vault-Token: ..." \
--request POST \
--data @payload.json \
2018-03-23 15:41:51 +00:00
http://127.0.0.1:8200/v1/identity/entity
```
### Sample Response
```json
{
"data": {
"id": "8d6a45e5-572f-8f13-d226-cd0d1ec57297",
"aliases": null
}
}
```
## Read Entity by ID
This endpoint queries the entity by its identifier.
| Method | Path | Produces |
| :------- | :--------------------------- | :--------------------- |
| `GET` | `/identity/entity/id/:id` | `200 application/json` |
### Parameters
- `id` `(string: <required>)` Identifier of the entity.
### Sample Request
```
$ curl \
--header "X-Vault-Token: ..." \
2018-03-23 15:41:51 +00:00
http://127.0.0.1:8200/v1/identity/entity/id/8d6a45e5-572f-8f13-d226-cd0d1ec57297
```
### Sample Response
```json
{
"data": {
"bucket_key_hash": "177553e4c58987f4cc5d7e530136c642",
"creation_time": "2017-07-25T20:29:22.614756844Z",
"disabled": false,
"id": "8d6a45e5-572f-8f13-d226-cd0d1ec57297",
"last_update_time": "2017-07-25T20:29:22.614756844Z",
"metadata": {
"organization": "hashicorp",
"team": "vault"
},
"name": "entity-c323de27-2ad2-5ded-dbf3-0c7ef98bc613",
"aliases": [],
"policies": [
"eng-dev",
"infra-dev"
]
}
}
```
## Update Entity by ID
This endpoint is used to update an existing entity.
| Method | Path | Produces |
| :------- | :--------------------------- | :--------------------- |
2018-04-01 16:59:57 +00:00
| `POST` | `/identity/entity/id/:id` | `200 application/json` |
### Parameters
- `id` `(string: <required>)` Identifier of the entity.
- `name` `(string: entity-<UUID>)` Name of the entity.
- `metadata` `(key-value-map: {})` Metadata to be associated with the entity.
- `policies` `(list of strings: [])` Policies to be tied to the entity.
- `disabled` `(bool: false)` Whether the entity is disabled. Disabled
entities' associated tokens cannot be used, but are not revoked.
### Sample Payload
```json
{
"name":"updatedEntityName",
"metadata": {
"organization": "hashi",
"team": "nomad"
},
"policies": ["eng-developers", "infra-developers"]
}
```
### Sample Request
```
$ curl \
--header "X-Vault-Token: ..." \
--request POST \
--data @payload.json \
2018-03-23 15:41:51 +00:00
http://127.0.0.1:8200/v1/identity/entity/id/8d6a45e5-572f-8f13-d226-cd0d1ec57297
```
### Sample Response
```json
{
"data": {
"id": "8d6a45e5-572f-8f13-d226-cd0d1ec57297",
"aliases": null
}
}
```
## Delete Entity by ID
This endpoint deletes an entity and all its associated aliases.
| Method | Path | Produces |
| :--------- | :-------------------------- | :----------------------|
| `DELETE` | `/identity/entity/id/:id` | `204 (empty body)` |
### Parameters
- `id` `(string: <required>)` Identifier of the entity.
### Sample Request
```
$ curl \
--header "X-Vault-Token: ..." \
--request DELETE \
2018-03-23 15:41:51 +00:00
http://127.0.0.1:8200/v1/identity/entity/id/8d6a45e5-572f-8f13-d226-cd0d1ec57297
```
## List Entities by ID
This endpoint returns a list of available entities by their identifiers.
| Method | Path | Produces |
| :------- | :------------------------------ | :--------------------- |
| `LIST` | `/identity/entity/id` | `200 application/json` |
| `GET` | `/identity/entity/id?list=true` | `200 application/json` |
### Sample Request
```
$ curl \
--header "X-Vault-Token: ..." \
--request LIST \
2018-03-23 15:41:51 +00:00
http://127.0.0.1:8200/v1/identity/entity/id
```
### Sample Response
```json
{
"data": {
"keys": [
"02fe5a88-912b-6794-62ed-db873ef86a95",
"3bf81bc9-44df-8138-57f9-724a9ae36d04",
"627fba68-98c9-c012-71ba-bfb349585ce1",
"6c4c805b-b384-3d0e-4d51-44d349887b96",
"70a72feb-35d1-c775-0813-8efaa8b4b9b5",
"f1092a67-ce34-48fd-161d-c13a367bc1cd",
"faedd89a-0d82-c197-c8f9-93a3e6cf0cd0"
]
}
}
```
2018-04-01 16:59:57 +00:00
## Create/Update Entity by Name
This endpoint is used to create or update an entity by a given name.
| Method | Path | Produces |
| :------- | :------------------------------- | :--------------------- |
| `POST` | `/identity/entity/name/:name` | `200 application/json` |
### Parameters
- `name` `(string: entity-<UUID>)` Name of the entity.
- `metadata` `(key-value-map: {})` Metadata to be associated with the entity.
- `policies` `(list of strings: [])` Policies to be tied to the entity.
- `disabled` `(bool: false)` Whether the entity is disabled. Disabled
entities' associated tokens cannot be used, but are not revoked.
### Sample Payload
```json
{
"metadata": {
"organization": "hashi",
"team": "nomad"
},
"policies": ["eng-developers", "infra-developers"]
}
```
### Sample Request
```
$ curl \
--header "X-Vault-Token: ..." \
--request POST \
--data @payload.json \
http://127.0.0.1:8200/v1/identity/entity/name/testentityname
```
### Sample Response
```json
{
"data": {
"aliases": null,
"id": "0826be06-577c-a076-3942-2f92da0310ce"
}
}
```
## Read Entity by Name
This endpoint queries the entity by its name.
| Method | Path | Produces |
| :------- | :------------------------------- | :--------------------- |
| `GET` | `/identity/entity/name/:name` | `200 application/json` |
### Parameters
- `name` `(string: <required>)` Name of the entity.
### Sample Request
```
$ curl \
--header "X-Vault-Token: ..." \
2018-09-28 14:23:46 +00:00
http://127.0.0.1:8200/v1/identity/entity/name/testentityname
```
### Sample Response
```json
{
"data": {
"aliases": [],
"creation_time": "2018-09-19T17:20:27.705389973Z",
"direct_group_ids": [],
"disabled": false,
"group_ids": [],
"id": "0826be06-577c-a076-3942-2f92da0310ce",
"inherited_group_ids": [],
"last_update_time": "2018-09-19T17:20:27.705389973Z",
"merged_entity_ids": null,
"metadata": {
"organization": "hashi",
"team": "nomad"
},
"name": "testentityname",
"policies": [
"eng-developers",
"infra-developers"
]
}
}
```
## Delete Entity by Name
This endpoint deletes an entity and all its associated aliases, given the
entity name.
| Method | Path | Produces |
| :--------- | :------------------------------ | :----------------------|
| `DELETE` | `/identity/entity/name/:name` | `204 (empty body)` |
### Parameters
- `name` `(string: <required>)` Name of the entity.
### Sample Request
```
$ curl \
--header "X-Vault-Token: ..." \
--request DELETE \
http://127.0.0.1:8200/v1/identity/entity/name/testentityname
```
## List Entities by Name
This endpoint returns a list of available entities by their names.
| Method | Path | Produces |
| :------- | :-------------------------------- | :--------------------- |
| `LIST` | `/identity/entity/name` | `200 application/json` |
| `GET` | `/identity/entity/name?list=true` | `200 application/json` |
### Sample Request
```
$ curl \
--header "X-Vault-Token: ..." \
--request LIST \
http://127.0.0.1:8200/v1/identity/entity/name
```
### Sample Response
```json
{
"data": {
"keys": [
"testentityname",
]
}
}
```
2018-04-01 16:59:57 +00:00
## Merge Entities
This endpoint merges many entities into one entity.
| Method | Path | Produces |
| :------- | :--------------------------- | :--------------------- |
| `POST` | `/identity/entity/merge` | `204 (empty body)` |
### Parameters
- `from_entity_ids` `(array: <required>)` - Entity IDs which needs to get
merged.
- `to_entity_id` `(string: <required>)` - Entity ID into which all the other
entities need to get merged.
- `force` `(bool: false)` - Setting this will follow the 'mine' strategy for
merging MFA secrets. If there are secrets of the same type both in entities
that are merged from and in entity into which all others are getting merged,
secrets in the destination will be unaltered. If not set, this API will throw
an error containing all the conflicts.
### Sample Payload
```json
{
"to_entity_id": "f2cdefbe-f510-a226-77fa-989a48ba6abc",
"from_entity_ids": ["1ade80ec-ba5c-8eed-91e2-b9dcd41d6fff", "270976d0-9bab-14a5-4b92-3861805ef73d"]
}
```
### Sample Request
```
$ curl \
--header "X-Vault-Token: ..." \
--request POST \
--data @payload.json \
http://127.0.0.1:8200/v1/identity/entity/id/8d6a45e5-572f-8f13-d226-cd0d1ec57297
```