get-role-mappings.asciidoc 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. [role="xpack"]
  2. [[security-api-get-role-mapping]]
  3. === Get role mappings API
  4. ++++
  5. <titleabbrev>Get role mappings</titleabbrev>
  6. ++++
  7. Retrieves role mappings.
  8. [[security-api-get-role-mapping-request]]
  9. ==== {api-request-title}
  10. `GET /_security/role_mapping` +
  11. `GET /_security/role_mapping/<name>`
  12. [[security-api-get-role-mapping-prereqs]]
  13. ==== {api-prereq-title}
  14. * To use this API, you must have at least the `manage_security` cluster privilege.
  15. [[security-api-get-role-mapping-desc]]
  16. ==== {api-description-title}
  17. Role mappings define which roles are assigned to each user. For more information,
  18. see {stack-ov}/mapping-roles.html[Mapping users and groups to roles].
  19. [[security-api-get-role-mapping-path-params]]
  20. ==== {api-path-parms-title}
  21. `name`::
  22. (Optional, string) The distinct name that identifies the role mapping. The name
  23. is used solely as an identifier to facilitate interaction via the API; it does
  24. not affect the behavior of the mapping in any way. You can specify multiple
  25. mapping names as a comma-separated list. If you do not specify this
  26. parameter, the API returns information about all role mappings.
  27. [[security-api-get-role-mapping-response-body]]
  28. ==== {api-response-body-title}
  29. A successful call retrieves an object, where the keys are the
  30. names of the request mappings, and the values are the JSON representation of
  31. those mappings. For more information, see
  32. <<role-mapping-resources>>.
  33. [[security-api-get-role-mapping-response-codes]]
  34. ==== {api-response-codes-title}
  35. If there is no mapping with the requested name, the
  36. response will have status code `404`.
  37. [[security-api-get-role-mapping-example]]
  38. ==== {api-examples-title}
  39. The following example retrieves information about the `mapping1` role mapping:
  40. [source,js]
  41. --------------------------------------------------
  42. GET /_security/role_mapping/mapping1
  43. --------------------------------------------------
  44. // CONSOLE
  45. // TEST[setup:role_mapping]
  46. [source,js]
  47. --------------------------------------------------
  48. {
  49. "mapping1": {
  50. "enabled": true,
  51. "roles": [
  52. "user"
  53. ],
  54. "rules": {
  55. "field": {
  56. "username": "*"
  57. }
  58. },
  59. "metadata": {}
  60. }
  61. }
  62. --------------------------------------------------
  63. // TESTRESPONSE