Support Questions

Find answers, ask questions, and share your expertise
Announcements
Celebrating as our community reaches 100,000 members! Thank you!

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.