Reputation: 925
As in the title, how to manually add a user to Apache Ranger via REST API.
Could you post an example of curl call?
Could you post in addiction an url where i can find the docs for:
http:<ip>:6080/service/xusers/???
Upvotes: 1
Views: 6799
Reputation: 267
I would like to add to @lisztomania's answer that this page from the mailing list archive of Apache Ranger gives a lot of available API calls and their description. You can find there the API calls to add / delete a user / group :
https://www.mail-archive.com/[email protected]/msg00064.html
Hope it will help !
Upvotes: 1
Reputation: 1526
Get a User
curl -u admin:admin -v -i -s -X GET http://xxx:6080/service/xusers/secure/users/$ID_USER
Replace $ID_USER by your userId
Get all User
curl -u admin:admin -v -i -s -X GET http://xxx:6080/service/xusers/secure/users
Delete a User
curl -u admin:admin -v -i -s -X DELETE http://xxx:6080/service/xusers/secure/users/$ID_USER
Replace $ID_USER by your userId
Add/POST a User
curl -u admin:admin -v -i -s -X POST -H "Accept: application/json" -H "Content-Type: application/json" http://xxx:6080/service/xusers/secure/users -d @userfile.json
Note: Sometimes you have to remove /secure
Note 2: userfile.json should be like this:
{ "name":"user1",
"firstName":"user1",
"lastName": "user1",
"loginId": "user1",
"emailAddress" : null,
"description" : "user1 desc",
"password" : "user1pass",
"groupIdList":[2,12],
"status":1,
"isVisible":1,
"userRoleList": [ "ROLE_SYS_ADMIN" ],
"userSource": 0
}
Upvotes: 6