Our Community is getting an upgrade! To get everything ready for the relaunch, we’ll be placing the site in read-only mode starting September 21st.
We really appreciate your understanding while we get things set up behind the scenes. Catch up on all the exciting details about the move here.
Need help or have questions? Drop us a line at [email protected]

Support Questions

Find answers, ask questions, and share your expertise
Announcements
Share your experience with Cloudera on G2 and get a $25 Amazon Gift card.
Hi, I'm CLEO! Something exciting is coming to the Community. Stay Tuned!

Add Users to Ranger via RESTAPI

avatar
Contributor

Hello.

I'm trying to add users to Ranger via RESTAPI, but I could only add one singular user at a time.

This is the command I'm using with a json file

 

curl -u admin:$PASSWORD -i -X POST -H "Accept: application/json" -H "Content-Type: application/json" https://$RANGER_URL:6182/service/xusers/secure/users -d @users_RESTAPI.json -vvv

 

And the json file as the following

{ "name":"user_1",

  "firstName":"",

  "lastName": "",

  "loginId": "user_1",

  "emailAddress" : "",

  "description" : "",

  "password" : "pass123",

  "groupIdList":[3],

  "status":1,

  "isVisible":1,

  "userRoleList": [ "ROLE_USER" ],

  "userSource": 0

},

{ "name":"user_2",

  "firstName":"",

  "lastName": "",

  "loginId": "user_1",

  "emailAddress" : "",

  "description" : "",

  "password" : "pass123",

  "groupIdList":[3],

  "status":1,

  "isVisible":1,

  "userRoleList": [ "ROLE_USER" ],

  "userSource": 0

}

 

Only the first user is added, the following entries are ignored.

Do the users need to be added one by one via RESTAPI?

Thanks

1 ACCEPTED SOLUTION

avatar
Expert Contributor

Yes, you need to add one user at a time, You cannot add multiple users in a single JSON file.

View solution in original post

1 REPLY 1

avatar
Expert Contributor

Yes, you need to add one user at a time, You cannot add multiple users in a single JSON file.