PUT /users/{subjectId}/roles with specific division per role?

Hey there, Platform team!

I was wondering if there was a way to utilize the PUT /users/{subjectId}/roles endpoint to include division for the roles? I am currently utilizing POST /authorization/subjects/{subjectId}/bulkadd to add roles since I need them to be division specific. We're provisioning new users programmatically, but in our case we don't want the default employee role on these users, just the one specific to their division/role. I could make two separate API requests (POST followed by a DELETE /authorization/subjects/{subjectId}/division/{divisionId}/roles/{roleId}), but the PUT request seems to be the best fit to reduce API calls. However, I can't see to tell if I can associate a role to a specific division, or if that's even possible.

Thank you!

Hello,

Unfortunately, the PUT /api/v2/users/{subjectId}/roles endpoint does not allow to set the division for a role.
As far as I remember, the ability to assign the division came in the /api/v2/authorization/subjects/.. or the /api/v2/authorization/roles/{roleId}/... endpoints.

Regards,

Thanks Jerome. Our goal is to be able to provision agents straight from ServiceNow requests, hence why we're using the API instead of just the bulk import feature of the UI, so that's why we're trying to reduce API calls as much as possible. We have plenty in our fair usage, but of course we want to be good stewards of our available usage limits :slight_smile:

If it's not possible currently with the PUT endpoint, we'll just do multiple POST requests to the Authorization API's subjects endpoints for now. Thanks!

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.