You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ranger.apache.org by Don Bosco Durai <bd...@hortonworks.com> on 2015/01/08 18:30:54 UTC

Re: List of REST API calls which can be used fetch policies and their details

Harinder

Gautam has documented the REST APIs in the following wiki page:
https://cwiki.apache.org/confluence/display/RANGER/REST+APIs+for+Policy+Management

For any feedback, can you please give it in this JIRA?
https://issues.apache.org/jira/browse/RANGER-211

Thanks

Bosco


From: Harinder <ha...@dataguise.com>>
Reply-To: "user@ranger.incubator.apache.org<ma...@ranger.incubator.apache.org>" <us...@ranger.incubator.apache.org>>
Date: Monday, December 29, 2014 at 10:29 PM
To: "user@ranger.incubator.apache.org<ma...@ranger.incubator.apache.org>" <us...@ranger.incubator.apache.org>>
Subject: Re: List of REST API calls which can be used fetch policies and their details

Hi Hanish,

This is very helpful, thanks. Yes, you are right this should be documented.
Thanks again
Harinder

From: Hanish Bansal<ma...@impetus.co.in>
Sent: Monday, December 29, 2014 9:24 PM
To: user@ranger.incubator.apache.org<ma...@ranger.incubator.apache.org>
Subject: RE: List of REST API calls which can be used fetch policies and their details


Sorry, I missed method type of rest apis to put in last mail, please find updated details:



Method Type     URL     Description

POST    http://<IP>:6080/service/xusers/secure/users    Create a user
PUT     http://<IP>:6080/service/xusers/secure/users/{id}       To Update a user
DELETE  http://<IP>:6080/service/xusers/users/userName/{userName}       Delete a user  with user name
POST    http://<IP>:6080/service/xusers/secure/groups   Create a group
PUT     http://<IP>:6080/service/xusers/secure/groups/{id}      To update a group
DELETE  http://<IP>:6080/service/xusers/groups/groupName/{groupName}    Delete a group  with group name
GET     http://<IP>:6080/service/xusers/groups  Can be used for following purpose:
(1) Get List of all groups.

(2) Get a particular group with searching by group name (url example: htt p://<IP>:6080/service/xusers/groups?name=ha )

(3) Get a particular group with searching by group source (url example: htt p://<IP>:6080/service/xusers/groups?groupSource=0 )
GET     http://<IP>:6080/service/xusers/groups/{id}     Get a particular group details
GET     http://<IP>:6080/service/xusers/secure/groups/{id}      Get a particular group details with additional information like owner and who updated the group
POST    http://<IP>:6080/service/xusers/groups
PUT     http://<IP>:6080/service/xusers/groups
DELETE  http://<IP>:6080/service/xusers/groups/{id}     Delete a specific group with id
GET     http://<IP>:6080/service/xusers/groups/count    Get Count of all groups
GET     http://<IP>:6080/service/xusers/users/{id}      Get a particular user details
GET     http://<IP>:6080/service/xusers/secure/users/{id}       Get a particular user details with additional information like owner and who updated the user
POST    http://<IP>:6080/service/xusers/users   Create a simple user without any mapping with group
PUT     http://<IP>:6080/service/xusers/users   To update a user
DELETE  http://<IP>:6080/service/xusers/users/{id}      Delete a specific user with id
GET     http://<IP>:6080/service/xusers/users   Get List of all users
GET     http://<IP>:6080/service/xusers/users/count     Get Count of all users
GET     http://<IP>:6080/service/xusers/groupusers/{id} Get a particular group-users mapping with id
GET     http://<IP>:6080/service/xusers/groupusers      Get list of group-users mapping
POST    http://<IP>:6080/service/xusers/groupusers      To create user-group mapping
PUT     http://<IP>:6080/service/xusers/groupusers      To update user-group mapping
DELETE  http://<IP>:6080/service/xusers/groupusers/{id} To delete a particular user-group mapping
GET     http://<IP>:6080/service/xusers/groupusers/count        Get count of all group-users mapping
GET     http://<IP>:6080/service/xusers/groupgroups/{id}
POST    http://<IP>:6080/service/xusers/groupgroups
PUT     http://<IP>:6080/service/xusers/groupgroups
DELETE  http://<IP>:6080/service/xusers/groupgroups/{id}
GET     http://<IP>:6080/service/xusers/groupgroups
GET     http://<IP>:6080/service/xusers/groupgroups/count
DELETE  http://<IP>:6080/service/xusers/permmaps/{id}   Delete a particular policy
POST    http://<IP>:6080/service/xusers/permmaps        Create policy
PUT     http://<IP>:6080/service/xusers/permmaps        update policy
GET     http://<IP>:6080/service/xusers/permmaps        Get List of all policies (permission related information)
GET     http://<IP>:6080/service/xusers/permmaps/{id}   Get List of particular policy with id
GET     http://<IP>:6080/service/xusers/permmaps/count  Get count of all policies
GET     http://<IP>:6080/service/xusers/auditmaps/{id}  Get a particular audit details
GET     http://<IP>:6080/service/xusers/auditmaps       Get List of all audits
POST    http://<IP>:6080/service/xusers/auditmaps       Create audits
PUT     http://<IP>:6080/service/xusers/auditmaps       update audits
DELETE  http://<IP>:6080/service/xusers/auditmaps/{id}  Delete a particular audit details
GET     http://<IP>:6080/service/xusers/auditmaps/count Get count of all audits
GET     http://<IP>:6080/service/xusers/users/userName/{userName}       Get a user information with user name
GET     http://<IP>:6080/service/xusers/groups/groupName/{groupName}    Get a group information with group name
DELETE  http://<IP>:6080/service/xusers/group/{groupName}/user/{userName}       To delete a particular user-group mapping with user name and group name
GET     http://<IP>:6080/service/xusers/{userId}/groups Get details of all group of particular user with user-id. (Note: Here user id is not username. It is id (long data type) of a user)
GET     http://<IP>:6080/service/xusers/{groupId}/users Get details of all users of particular group with group-id.
GET     http://<IP>:6080/service/xusers/authSessions    Get details of login sessions. On ranger UI: Audit -> Login Sessions
GET     http://<IP>:6080/service/xusers/authSessions/info       Get a particular session details. Input parameter: extSessionId
GET     http://<IP>:6080/service/users  Get list of all users with role information
GET     http://<IP>:6080/service/users/{userId} Get list of a particular user with role information by id
POST    http://<IP>:6080/service/users
POST    http://<IP>:6080/service/users/default  API to add user with default account
PUT     http://<IP>:6080/service/users
PUT     http://<IP>:6080/service/users/{userId}/roles
POST    http://<IP>:6080/service/users/{userId}/deactivate
GET     http://<IP>:6080/service/users/profile  Get profile of logged in user
GET     http://<IP>:6080/service/users/firstnames       Request Hangs
POST    http://<IP>:6080/service/users/{userId}/passwordchange
POST    http://<IP>:6080/service/users/{userId}/emailchange
GET     http://<IP>:6080/service/public/api/repository/{id}     Get a particular repository(asset i.e hdfs, hive etc.) with id
PUT     http://<IP>:6080/service/public/api/repository/{id}     Update a particular repository(asset i.e hdfs, hive etc.) with id
DELETE  http://<IP>:6080/service/public/api/repository/{id}     Delete a particular repository(asset i.e hdfs, hive etc.) with id
POST    http://<IP>:6080/service/public/api/repository/ Create a repository
GET     http://<IP>:6080/service/public/api/repository/ Get all repositories
GET     http://<IP>:6080/service/public/api/repository/count    Get count of all repositories
GET     http://<IP>:6080/service/public/api/policy/{id} Get a particular policy with id
POST    http://<IP>:6080/service/public/api/policy/     Create a policy
GET     http://<IP>:6080/service/public/api/policy/     Get all policies
PUT     http://<IP>:6080/service/public/api/policy/{id} Update a policy
DELETE  http://<IP>:6080/service/public/api/repository/ Delete a repository
GET     http://<IP>:6080/service/public/api/policy/count        Get count of all policies
GET     http://<IP>:6080/service/assets/assets/{id}     Get a particular repository(asset i.e hdfs, hive etc.) with id
PUT     http://<IP>:6080/service/assets/assets/{id}     Update a particular repository(asset i.e hdfs, hive etc.) with id
DELETE  http://<IP>:6080/service/assets/assets/{id}
POST    http://<IP>:6080/service/assets/assets  Create a repository
POST    http://<IP>:6080/service/assets/assets/testConfig
GET     http://<IP>:6080/service/assets/assets  Get list of all assets
GET     http://<IP>:6080/service/assets/assets/count    Get count of all assets
GET     http://<IP>:6080/service/assets/resources/{id}  Get a particular resource
POST    http://<IP>:6080/service/assets/resources       Get all resources
PUT     http://<IP>:6080/service/assets/resources/{id}  To update a resource
DELETE  http://<IP>:6080/service/assets/resources/{id}  Get a resource
GET     http://<IP>:6080/service/assets/resources       Get list of all resources
GET     http://<IP>:6080/service/assets/hdfs/resources  Get list of hdfs resources
GET     http://<IP>:6080/service/assets/hive/resources  Get list of hive resources
GET     http://<IP>:6080/service/assets/hbase/resources Get list of hbase resources
GET     http://<IP>:6080/service/assets/knox/resources  Get list of knox resources
GET     http://<IP>:6080/service/assets/storm/resources Get list of storm resources
GET     http://<IP>:6080/service/assets/resources/count Get count of all resources
GET     http://<IP>:6080/service/assets/credstores/{id}
POST    http://<IP>:6080/service/assets/credstores
PUT     http://<IP>:6080/service/assets/credstores
GET     http://<IP>:6080/service/assets/credstores
DELETE  http://<IP>:6080/service/assets/credstores/{id}
GET     http://<IP>:6080/service/assets/credstores/count
GET     http://<IP>:6080/service/assets/resource/{id}
GET     http://<IP>:6080/service/assets/policyList/{repository}
GET     http://<IP>:6080/service/assets/exportAudit     On ranger UI: Audit ->Agents
GET     http://<IP>:6080/service/assets/report  Get list of all asset reports. On ranger UI: Audit -> Admin
GET     http://<IP>:6080/service/assets/report/{transactionId}  Get an  asset report of a particular transaction with transaction id
GET     http://<IP>:6080/service/assets/accessAudit     Get list of all asset audits. On ranger UI: Audit -> Big Data
POST    http://<IP>:6080/service/assets/resources/grant
POST    http://<IP>:6080/service/assets/resources/revoke





​





​

-------
Thanks & Regards,
Hanish Bansal

________________________________
From: Hanish Bansal <ha...@impetus.co.in>>
Sent: Monday, December 29, 2014 8:21 PM
To: user@ranger.incubator.apache.org<ma...@ranger.incubator.apache.org>
Subject: RE: List of REST API calls which can be used fetch policies and their details


Hi Harinder,



I was also facing same issue and was not able to find the rest apis details of ranger. So finally I collected some details by exploring source code of ranger, I hope it would help you.



Please find the following details of all rest apis of ranger. It would be helpful if this could be documented on ranger guide as well.





URL     Description
http://<IP>:6080/service/xusers/secure/users    Create a user
http://<IP>:6080/service/xusers/secure/users/{id}       To Update a user
http://<IP>:6080/service/xusers/users/userName/{userName}       Delete a user with user name
http://<IP>:6080/service/xusers/secure/groups   Create a group
http://<IP>:6080/service/xusers/secure/groups/{id}      To update a group
http://<IP>:6080/service/xusers/groups/groupName/{groupName}    Delete a group with group name
http://<IP>:6080/service/xusers/groups  Can be used for following purpose:
(1) Get List of all groups.

(2) Get a particular group with searching by group name (url example: htt p://<IP>:6080/service/xusers/groups?name=ha )

(3) Get a particular group with searching by group source (url example: htt p://<IP>:6080/service/xusers/groups?groupSource=0 )
http://<IP>:6080/service/xusers/groups/{id}     Get a particular group details
http://<IP>:6080/service/xusers/secure/groups/{id}      Get a particular group details with additional information like owner and who updated the group
http://<IP>:6080/service/xusers/groups

http://<IP>:6080/service/xusers/groups

http://<IP>:6080/service/xusers/groups/{id}     Delete a specific group with id
http://<IP>:6080/service/xusers/groups/count    Get Count of all groups
http://<IP>:6080/service/xusers/users/{id}      Get a particular user details
http://<IP>:6080/service/xusers/secure/users/{id}       Get a particular user details with additional information like owner and who updated the user
http://<IP>:6080/service/xusers/users   Create a simple user without any mapping with group
http://<IP>:6080/service/xusers/users   To update a user
http://<IP>:6080/service/xusers/users/{id}      Delete a specific user with id
http://<IP>:6080/service/xusers/users   Get List of all users
http://<IP>:6080/service/xusers/users/count     Get Count of all users
http://<IP>:6080/service/xusers/groupusers/{id} Get a particular group-users mapping with id
http://<IP>:6080/service/xusers/groupusers      Get list of group-users mapping
http://<IP>:6080/service/xusers/groupusers      To create user-group mapping
http://<IP>:6080/service/xusers/groupusers      To update user-group mapping
http://<IP>:6080/service/xusers/groupusers/{id} To delete a particular user-group mapping
http://<IP>:6080/service/xusers/groupusers/count        Get count of all group-users mapping
http://<IP>:6080/service/xusers/groupgroups/{id}

http://<IP>:6080/service/xusers/groupgroups

http://<IP>:6080/service/xusers/groupgroups

http://<IP>:6080/service/xusers/groupgroups/{id}

http://<IP>:6080/service/xusers/groupgroups

http://<IP>:6080/service/xusers/groupgroups/count

http://<IP>:6080/service/xusers/permmaps/{id}   Delete a particular policy
http://<IP>:6080/service/xusers/permmaps        Create policy
http://<IP>:6080/service/xusers/permmaps        update policy
http://<IP>:6080/service/xusers/permmaps        Get List of all policies (permission related information)
http://<IP>:6080/service/xusers/permmaps/{id}   Get List of particular policy with id
http://<IP>:6080/service/xusers/permmaps/count  Get count of all policies
http://<IP>:6080/service/xusers/auditmaps/{id}  Get a particular audit details
http://<IP>:6080/service/xusers/auditmaps       Get List of all audits
http://<IP>:6080/service/xusers/auditmaps       Create audits
http://<IP>:6080/service/xusers/auditmaps       update audits
http://<IP>:6080/service/xusers/auditmaps/{id}  Delete a particular audit details
http://<IP>:6080/service/xusers/auditmaps/count Get count of all audits
http://<IP>:6080/service/xusers/users/userName/{userName}       Get a user information with user name
http://<IP>:6080/service/xusers/groups/groupName/{groupName}    Get a group information with group name
http://<IP>:6080/service/xusers/group/{groupName}/user/{userName}       To delete a particular user-group mapping with user name and group name
http://<IP>:6080/service/xusers/{userId}/groups Get details of all group of particular user with user-id. (Note: Here user id is not username. It is id (long data type) of a user)
http://<IP>:6080/service/xusers/{groupId}/users Get details of all users of particular group with group-id.
http://<IP>:6080/service/xusers/authSessions    Get details of login sessions. On ranger UI: Audit -> Login Sessions
http://<IP>:6080/service/xusers/authSessions/info       Get a particular session details. Input parameter: extSessionId
http://<IP>:6080/service/users  Get list of all users with role information
http://<IP>:6080/service/users/{userId} Get list of a particular user with role information by id
http://<IP>:6080/service/users

http://<IP>:6080/service/users/default  API to add user with default account
http://<IP>:6080/service/users

http://<IP>:6080/service/users/{userId}/roles

http://<IP>:6080/service/users/{userId}/deactivate

http://<IP>:6080/service/users/profile  Get profile of logged in user
http://<IP>:6080/service/users/firstnames       Request Hangs
http://<IP>:6080/service/users/{userId}/passwordchange

http://<IP>:6080/service/users/{userId}/emailchange

http://<IP>:6080/service/public/api/repository/{id}     Get a particular repository(asset i.e hdfs, hive etc.) with id
http://<IP>:6080/service/public/api/repository/{id}     Update a particular repository(asset i.e hdfs, hive etc.) with id
http://<IP>:6080/service/public/api/repository/{id}     Delete a particular repository(asset i.e hdfs, hive etc.) with id
http://<IP>:6080/service/public/api/repository/ Create a repository
http://<IP>:6080/service/public/api/repository/ Get all repositories
http://<IP>:6080/service/public/api/repository/count    Get count of all repositories
http://<IP>:6080/service/public/api/policy/{id} Get a particular policy with id
http://<IP>:6080/service/public/api/policy/     Create a policy
http://<IP>:6080/service/public/api/policy/     Get all policies
http://<IP>:6080/service/public/api/policy/{id} Update a policy
http://<IP>:6080/service/public/api/repository/ Delete a repository
http://<IP>:6080/service/public/api/policy/count        Get count of all policies
http://<IP>:6080/service/assets/assets/{id}     Get a particular repository(asset i.e hdfs, hive etc.) with id
http://<IP>:6080/service/assets/assets/{id}     Update a particular repository(asset i.e hdfs, hive etc.) with id
http://<IP>:6080/service/assets/assets/{id}

http://<IP>:6080/service/assets/assets  Create a repository
http://<IP>:6080/service/assets/assets/testConfig

http://<IP>:6080/service/assets/assets  Get list of all assets
http://<IP>:6080/service/assets/assets/count    Get count of all assets
http://<IP>:6080/service/assets/resources/{id}  Get a particular resource
http://<IP>:6080/service/assets/resources       Get all resources
http://<IP>:6080/service/assets/resources/{id}  To update a resource
http://<IP>:6080/service/assets/resources/{id}  Get a resource
http://<IP>:6080/service/assets/resources       Get list of all resources
http://<IP>:6080/service/assets/hdfs/resources  Get list of hdfs resources
http://<IP>:6080/service/assets/hive/resources  Get list of hive resources
http://<IP>:6080/service/assets/hbase/resources Get list of hbase resources
http://<IP>:6080/service/assets/knox/resources  Get list of knox resources
http://<IP>:6080/service/assets/storm/resources Get list of storm resources
http://<IP>:6080/service/assets/resources/count Get count of all resources
http://<IP>:6080/service/assets/credstores/{id}

http://<IP>:6080/service/assets/credstores

http://<IP>:6080/service/assets/credstores

http://<IP>:6080/service/assets/credstores

http://<IP>:6080/service/assets/credstores/{id}

http://<IP>:6080/service/assets/credstores/count

http://<IP>:6080/service/assets/resource/{id}

http://<IP>:6080/service/assets/policyList/{repository}

http://<IP>:6080/service/assets/exportAudit     On ranger UI: Audit ->Agents
http://<IP>:6080/service/assets/report  Get list of all asset reports. On ranger UI: Audit -> Admin
http://<IP>:6080/service/assets/report/{transactionId}  Get an asset report of a particular transaction with transaction id
http://<IP>:6080/service/assets/accessAudit     Get list of all asset audits. On ranger UI: Audit -> Big Data
http://<IP>:6080/service/assets/resources/grant

http://<IP>:6080/service/assets/resources/revoke








-------
Thanks & Regards,
Hanish Bansal​
________________________________

Hi,​

Can anyone share the link where i can find the list of REST API calls which can be used fetch policies and their details for different components like Hive, HDFS etc. I couldn't find a link googling it. I know there is a UI available but i need the REST calls detail.


Thanks
Harinder





--
Thanks & Regards
Hanish Bansal

________________________________






NOTE: This message may contain information that is confidential, proprietary, privileged or otherwise protected by law. The message is intended solely for the named addressee. If received in error, please destroy and notify the sender. Any use of this email is prohibited when received in error. Impetus does not represent, warrant and/or guarantee, that the integrity of this communication has been maintained nor that the communication is free of errors, virus, interception or interference.

________________________________






NOTE: This message may contain information that is confidential, proprietary, privileged or otherwise protected by law. The message is intended solely for the named addressee. If received in error, please destroy and notify the sender. Any use of this email is prohibited when received in error. Impetus does not represent, warrant and/or guarantee, that the integrity of this communication has been maintained nor that the communication is free of errors, virus, interception or interference.