elasticsearch/docs/java-rest/high-level/security/create-api-key.asciidoc
Yang Wang 431aca0a46
CreateApiKey response now returns the base64 encoded credentials (#77351) (#77670)
This PR adds a new "encoded" field to the response of CreateApiKey API.
It is the base64 encoded value of "id:api_key". The field is added for
the convenience of the API consumers so that no extra
computation/encoding is needed. Sometimes the extra computation/encoding
can be error prone or not feasible for simple clients.

Resolves: #50235
2021-09-14 01:38:34 -04:00

40 lines
1.2 KiB
Text

--
:api: create-api-key
:request: CreateApiKeyRequest
:response: CreateApiKeyResponse
--
[role="xpack"]
[id="{upid}-{api}"]
=== Create API Key API
API Key can be created using this API.
[id="{upid}-{api}-request"]
==== Create API Key Request
A +{request}+ contains an optional name for the API key,
an optional list of role descriptors to define permissions and
optional expiration for the generated API key.
If expiration is not provided then by default the API
keys do not expire.
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request]
--------------------------------------------------
include::../execution.asciidoc[]
[id="{upid}-{api}-response"]
==== Create API Key Response
The returned +{response}+ contains an id,
API key, name for the API key and optional
expiration.
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-response]
--------------------------------------------------
<1> the API key credentials that can be used to authenticate to Elasticsearch.
<2> expiration if the API keys expire