Support Questions
Find answers, ask questions, and share your expertise

Add Users to Ranger via RESTAPI

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

Rising Star

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

Rising Star

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

; ;