Archives of Support Questions (Read Only)

This is an archived board for historical reference. Information and links may no longer be available or relevant
Announcements
This board is archived and read-only for historical reference. To ask a new question, please post a new topic on the appropriate active board.

Ranger 0.7 Rest API

avatar
New Member

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

avatar
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

avatar
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!!