open-vault/website/content/api-docs/system/version-history.mdx
Chris Capurso f9e9b4d327
Add sys/version-history endpoint and associated command (#13766)
* store version history as utc; add self-heal logic

* add sys/version-history endpoint

* change version history from GET to LIST, require auth

* add "vault version-history" CLI command

* add vault-version CLI error message for version string parsing

* adding version-history API and CLI docs

* add changelog entry

* some version-history command fixes

* remove extraneous cmd args

* fix version-history command help text

* specify in docs that endpoint was added in 1.10.0

Co-authored-by: Nick Cabatoff <ncabatoff@hashicorp.com>

* enforce UTC within storeVersionTimestamp directly

* fix improper use of %w in logger.Warn

* remove extra err check and erroneous return from loadVersionTimestamps

* add >= 1.10.0 warning to version-history cmd

* move sys/version-history tests

Co-authored-by: Nick Cabatoff <ncabatoff@hashicorp.com>
2022-02-14 15:26:57 -05:00

56 lines
1.6 KiB
Plaintext

---
layout: api
page_title: /sys/version-history - HTTP API
description: The `/sys/version-history` endpoint is used to retrieve the version history of a Vault.
---
# `/sys/version-history`
~> **NOTE**: Tracking Vault version history was added in Vault version 1.9.0. Entries for versions installed prior to version 1.9.0 will not be available via this API.
This API was added in 1.10.0.
The `/sys/version-history` endpoint is used to retrieve the version history of a Vault.
## Read Version History
This endpoint returns the version history of the Vault. The response will contain the following keys:
- `keys`: a list of installed versions in chronological order based on the time installed
- `key_info`: a map indexed by the versions found in the `keys` list containing the following subkeys:
- `previous_version`: the version installed prior to this version or `null` if no prior version exists
- `timestamp_installed`: the time (in UTC) at which the version was installed
| Method | Path |
| :----- | :--------------------- |
| `GET` | `/sys/version-history` |
### Sample Request
```shell-session
$ curl \
--header "X-Vault-Token: ..." \
http://127.0.0.1:8200/v1/sys/version-history
```
### Sample Response
```json
{
"keys": ["1.9.0", "1.9.1", "1.9.2"],
"key_info": {
"1.9.0": {
"previous_version": null,
"timestamp_installed": "2021-11-18T10:23:16Z"
},
"1.9.1": {
"previous_version": "1.9.0",
"timestamp_installed": "2021-12-13T11:09:52Z"
},
"1.9.2": {
"previous_version": "1.9.1",
"timestamp_installed": "2021-12-23T10:56:37Z"
}
}
}
```