Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

Ranger Rest API to delete policy working only for admin account

Highlighted

Ranger Rest API to delete policy working only for admin account

New Contributor

I am facing an issue to delete a policy. I have created a policy using Ranger Rest API and i am trying to delete it by using the document's version

Request URL : "service/public/api/service/{id}"

and i am failing with the error 404.

"curl -iv -u 'D****:********' -X DELETE 'http://myserver.devfg.rbc.com:6080/service/public/api/policy/123'

HTTP/1.1 404 Not Found < Server: Apache-Coyote/1.1 Server: Apache-Coyote/1.1 < X-Frame-Options: DENY X-Frame-Options: DENY < Content-Length: 0 Content-Length: 0 < Date: Wed, 05 Apr 2017 16:58:36 GMT"

when i performed manual deletion from GUI with same user account i successfully deleted it and checked browser network and found the solution.

what worked for me is changing the url to

"curl -iv -u 'D****:********' -X DELETE 'http://myserver.devfg.rbc.com:6080/service/plugins/policies/123'

I tried above steps with an delegated administrator user account.

If i try the same deletion operation, using deletion URL provided in doc service/public/api/service/{id}, with one of our user accounts with admin access It works perfectly fine.

Strange, but this needs an investigation.

2 REPLIES 2

Re: Ranger Rest API to delete policy working only for admin account

User needs to have ADMIN role for deleting policies.

Re: Ranger Rest API to delete policy working only for admin account

New Contributor

Hello I am trying to create policy using rest api, but I am always getting 404 Not Found error.

curl -iv -X POST -H "Content-type:application/json" -H "Accept:application/json" -u '********' https://<hostname of the edge>:6080/service/plugins/policies -d test.json

I enter the password, but after that I am getting the above error.