Support Questions
Find answers, ask questions, and share your expertise

Ranger 0.7 Rest API

Contributor

I am able to create a policy with the below command;

curl -iv -u username:password -H "content-type:application/json" -X POST http://hostname:6080/service/public/api/policy/ -d '{ "policyName": "api-Test", "resourceName": "/data", "description": "Testing", "repositoryName": "HDPPRD01_hadoop", "repositoryType": "hdfs", "isEnabled": "true", "isRecursive": "true", "isAuditEnabled": "true", "permMapList": [{ "userList":["sudheer"],"groupList":["hadoop_group"], "permList": ["Read","Execute", "Write", "Admin"] }] }'

But I want to update that policy with the Rest APi:

Tried with this command but throwing some error: (The specified HTTP method is not allowed for the requested resource.)

curl -iv -u username:password -H "content-type:application/json" -X PUT http://hostname:6080/service/public/api/policy/ -d '{ "policyName": "api-Test", "resourceName": "/tmp", "description": "Testing", "repositoryName": "HDPPRD01_hadoop", "repositoryType": "hdfs", "isEnabled": "true", "isRecursive": "true", "isAuditEnabled": "true", "permMapList": [{ "userList":["velagapudi"],"groupList":["hadoop_user"], "permList": ["Read","Execute", "Write", "Admin"] }] }'
1 ACCEPTED SOLUTION

Accepted Solutions

Super Collaborator

hi @Sudheer Velagapudi,

To update the policy you need to specify the policy ID(At the end of the URL) where as in creation time, it automatically increment the policy Id.

ex: http://hostname:6080/service/public/api/policy/{id}

Hope this helps!!

View solution in original post

1 REPLY 1

Super Collaborator

hi @Sudheer Velagapudi,

To update the policy you need to specify the policy ID(At the end of the URL) where as in creation time, it automatically increment the policy Id.

ex: http://hostname:6080/service/public/api/policy/{id}

Hope this helps!!

View solution in original post