Complete the code to create an API key with a name.
POST /_security/api_key
{
"name": "[1]"
}The name field sets the API key's name. Here, my-api-key is a valid name.
Complete the code to specify the role descriptors for the API key.
POST /_security/api_key
{
"name": "my-api-key",
"role_descriptors": {
"[1]": {
"cluster": ["all"]
}
}
}role_descriptors.The role_descriptors object requires a role name key. role1 is a valid role name here.
Fix the error in the code to delete an API key by its ID.
DELETE /_security/api_key/[1]The API key ID must be placed directly in the URL path. id is the correct placeholder here.
Fill both blanks to create an API key with limited privileges.
POST /_security/api_key
{
"name": "limited-key",
"role_descriptors": {
"[1]": {
"cluster": ["[2]"]
}
}
}The role name is limited_role and the cluster privilege is monitor to limit access.
Fill all three blanks to create an API key with a name, role, and expiration.
POST /_security/api_key
{
"name": "[1]",
"role_descriptors": {
"[2]": {
"cluster": ["all"]
}
},
"expiration": "[3]"
}The API key is named temp-key, uses role temp_role, and expires after 1d (one day).
