Posting new users in Bulk
I'm currently trying to write a console app that will do all my user administration stuff automatically, but am having a hard time making a post to the bulk ad end point that includes a groups.
For instance:
[
{
"userName": "aadgreatest",
"groups": ["5ca61817c9e7612bb833d620"],
"ldapDomainId": "5bnotab629d4af14fblahblaha"
}
]
Gets me a user in that domain and sets him up as a viewer, but doesn't add him to that group which should be the "Cat Owners" group. Is this not how it works or should I be using something else?
-
Official comment
Hi Delsaran,
This is currently a limitation.
Possible workarounds:
You can either: use POST api/v1/users
and specifiy "activeDirectory": true,
like this:{
"email": "Ramatgan.user0094@ramatgan.int",
"groups": [
"5d4bfbe5bd3ef11b68180cef"
],
"activeDirectory": true,
"hash": null
}Or you can create the users using the regular /user/ad/bulk, and then go over the ID's you are getting and make a second call to PATCH users/{id} with the groups.
Both options tested and worked.Hope this helps.
Best,
Noam
Comment actions -
I'm using the /api/v1/users/ad/bulk endpoint, and yes that's the full payload or the desired payload.
[
{
"userName": "aadgreatest",
"ldapDomainId": "5bnotab629d4af14fblahblaha"
}
]^^^ Works
[
{
"userName": "aadgreatest",
"groups": ["5ca61817c9e7612bb833d620"],
"ldapDomainId": "5bnotab629d4af14fblahblaha"
}
]^^^ Doesn't work, even thought there is a key for it
This is the suggested/example that is on the api page in Sisense
[ { "userName": "string", "roleId": "string", "groups": [ "string" ], "objectSid": "string", "preferences": { "localeId": "Unknown Type: string,null" }, "uiSettings": {} } ]
-
Thanks Delsaran, that's helpful. I noticed that the groups property does work for regular (non-AD) bulk user insert, so I suspect this is might be an issue for Sisense Support to investigate. I'll open a support ticket for you, hope that's OK.
If you end up finding a solution of some sort (maybe a missing field or a mistake in field names in the documentation) please feel free to post it here for others to benefit from!
-
That would be great if you'd do that for me.
Being able to set the group as I add the users would help count down on the code I have to write, if not i'd have to add the users and make another function to update the users. I'd rather do it all in one go. Will I be CC on this ticket?
Please sign in to leave a comment.
Comments
5 comments