How can I change the User License Type using the REST API? I searched unsuccessful for an endpoint, I suspect there should be something similar like these endpoints:
Solved! Go to Solution.
Thank you @JohnPlunkett but I was looking for this:
and it looks like it exists but it is undocumented.
Here my findings in case someone else has a similar use case:
Is this what you are after?
portal/sharing/rest/portals/0123456789ABCDEF/updateUserRole
Thank you @JohnPlunkett but I was looking for this:
and it looks like it exists but it is undocumented.
Here my findings in case someone else has a similar use case:
Thanks so much for updating this thread with what you found. 😀
Hi there @Thomas_Z2
I saw your posting on the updateUserLicenseType Rest API call, and was wondering if you would mind sharing a code snippet of sorts to help me out here. I've been trying to find the way to update a user on the fly via the back-end, and this seems to be the way to do it - and as you've mentioned, Esri have not really documented anything about it!
I've tinkered with the url request ../arcgis/sharing/rest/portals/self/updateUserLicenseType?... but I'm yet to find a valid url that actually works.
I'll also take a look at the Python approach you've mentioned, but I'd rather hit it with a Rest call to be honest.
Any help truly appreciated (in either Rest, or Python cases)
thanks in advance
Gareth
Hi Gareth,
I have created a workflow in FME that allows users to "check out" or "return" a license without having to ask an administrator. The workflow requires us to update the role and the license type in two steps. there are two options - if the user checks out a license I set their named user to fieldWorkerUT and the corresponding custom role and if the user returns a license I set them to viewerUT and the corresponding custom viewer role.
First update License Type:
Request URL: $(arcgis_portal_url)/$(arcgis_portal_webadaptor_context)/sharing/rest/portals/0123456789ABCDEF/updateUserLicenseType
Method: POST
Parameters:
new_user_type = fieldWorkerUT or viewerUT
Second update User Role:
URL: $(arcgis_portal_url)/$(arcgis_portal_webadaptor_context)/sharing/rest/portals/0123456789ABCDEF/updateUserRole
Method: POST
Parameters:
new_role = 7Wqt2kdDEMSska9w or 3Fg8KwpdZknhNZE6 depending upon which one matches the license type that was selected first.
I hope this helps,
Marc
Hi Marc,
thanks for the speedy reply - much appreciated. I'll give it a try, but I'm actually starting to think I may need to update the portal, from 10.7.x I can't see the /updateUserLicenseType method on the /arcgis/sharing/rest/portals/self endpoint. Can you please confirm this, if running a newer version of Portal?
thanks again
Gareth
EDIT: Oh I see that is a slightly different endpoint in the documentation. I still confirmed it is there at 10.7 in our old portal:
It should be there - according to the docs it was introduced at 10.7: https://developers.arcgis.com/rest/users-groups-and-items/user-license-types.htm
I can confirm that on our deprecated 10.7 portal it is there.
it doesn't appear to be documented anywhere except for in relation to webhooks:
https://developers.arcgis.com/rest/users-groups-and-items/create-webhooks.htm
yeah cool.. I see it now - just needed to scroll down to the bottom of the page - doh!
thanks for your help on this, much appreciated