| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 | 
--:api: get-roles:request: GetRolesRequest:response: GetRolesResponse--[role="xpack"][id="{upid}-{api}"]=== Get Roles API[id="{upid}-{api}-request"]==== Get Roles RequestRetrieving a role can be performed using the `security().getRoles()`method and by setting the role name on +{request}+:["source","java",subs="attributes,callouts,macros"]--------------------------------------------------include-tagged::{doc-tests-file}[{api}-request]--------------------------------------------------Retrieving multiple roles can be performed using the `security().getRoles()`method and by setting multiple role names on +{request}+:["source","java",subs="attributes,callouts,macros"]--------------------------------------------------include-tagged::{doc-tests-file}[{api}-list-request]--------------------------------------------------Retrieving all roles can be performed using the `security().getRoles()`method without specifying any role names on +{request}+:["source","java",subs="attributes,callouts,macros"]--------------------------------------------------include-tagged::{doc-tests-file}[{api}-all-request]--------------------------------------------------include::../execution.asciidoc[][id="{upid}-{api}-response"]==== Get Roles ResponseThe returned +{response}+ allows getting information about the retrieved roles as follows.["source","java",subs="attributes,callouts,macros"]--------------------------------------------------include-tagged::{doc-tests-file}[{api}-response]--------------------------------------------------
 |