delete-roles.asciidoc 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. [role="xpack"]
  2. [[security-api-delete-role]]
  3. === Delete roles API
  4. ++++
  5. <titleabbrev>Delete roles</titleabbrev>
  6. ++++
  7. .New API reference
  8. [sidebar]
  9. --
  10. For the most up-to-date API details, refer to {api-es}/group/endpoint-security[Security APIs].
  11. --
  12. Removes roles in the native realm.
  13. [[security-api-delete-role-request]]
  14. ==== {api-request-title}
  15. `DELETE /_security/role/<name>`
  16. [[security-api-delete-role-prereqs]]
  17. ==== {api-prereq-title}
  18. * To use this API, you must have at least the `manage_security` cluster privilege.
  19. [[security-api-delete-role-desc]]
  20. ==== {api-description-title}
  21. The role management APIs are generally the preferred way to manage roles, rather than using
  22. <<roles-management-file,file-based role management>>. The delete roles API cannot remove roles that are defined in roles files.
  23. [[security-api-delete-role-path-params]]
  24. ==== {api-path-parms-title}
  25. `name`::
  26. (string) The name of the role.
  27. [[security-api-delete-role-example]]
  28. ==== {api-examples-title}
  29. The following example deletes a `my_admin_role` role:
  30. [source,console]
  31. --------------------------------------------------
  32. DELETE /_security/role/my_admin_role
  33. --------------------------------------------------
  34. // TEST[setup:admin_role]
  35. If the role is successfully deleted, the request returns `{"found": true}`.
  36. Otherwise, `found` is set to false.
  37. [source,console-result]
  38. --------------------------------------------------
  39. {
  40. "found" : true
  41. }
  42. --------------------------------------------------