delete-roles.asciidoc 1.3 KB

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