elasticsearch/docs/java-rest/high-level/security/create-service-account-toke...

43 lines
1.4 KiB
Plaintext

--
:api: create-service-account-token
:request: CreateServiceAccountTokenRequest
:response: CreateServiceAccountTokenResponse
--
[role="xpack"]
[id="{upid}-{api}"]
=== Create Service Account Token API
Index-based service account token can be created using this API.
[id="{upid}-{api}-request"]
==== Create Service Account Token Request
A +{request}+ contains the namespace and service-name of a
service account and an optional name for the service account token.
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request]
--------------------------------------------------
A token name will be auto generated if the +{request}+ does not specify it:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-auto-name]
--------------------------------------------------
include::../execution.asciidoc[]
[id="{upid}-{api}-response"]
==== Create Service Account Token Response
The returned +{response}+ contains the name and value of the service account token.
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-response]
--------------------------------------------------
<1> Name of the service account token
<2> Value of the service account token to be used as the bearer authentication header