Looks like there is an undocumented endpoint /portals/self/updateUserLicenseType
.
I had to dig deep... Eventually, I came across with this page:
This page mentions updateUserLicenseType
and updateUserRole
. There is also also a presentation about webhooks.
So I thought I give it a try (there was nothing to loose :)):
/portals/self/updateUserLicenseType
And it works (as of June 1, 2022, ArcGIS Enterprise 10.9.1 Base Deployment).
Finding the parameter names required some try and error:
Parameter Name | Parameter Value |
---|---|
users |
array of strings |
userLicenseType |
a string (as documented here) |
f |
json (I don't know if other formats works?) |
token |
your token |
The return value seems to be:
{"results": [{"username": "joe", "status": true}]}
Assuming status
is false
if not successful.
Warning: Esri may have a reason why they did not add it to their REST API documentation (yet?), they may plan changes in the future or remove the endpoint altogether. Although, I assume they just did not update their documentation but it's an assumption.
However, it looks like the response diverges from the pattern seen in /portals/self/updateUserLevel
and /portals/self/updateUserRole
which is {"success": true}
.
By the way, it looks like ArcGIS API for Python has a function arcgis.gis.User.update_license_type
. It's the only documented way I found providing the functionality needed. Ideal for those writing Python scripts.
So I went verifying my findings by testing and logging ArcGIS API for Python:
import logging
import arcgis.gis
logging.basicConfig(format="%(message)s")
logging.getLogger().setLevel(logging.DEBUG)
gis = arcgis.gis.GIS("http://servername.com/portal", "foo", "bar")
user = arcgis.gis.User(gis, "joe")
user.update_license_type("GISProfessionalAdvUT")
And here is a part of the log confirming that the endpoint exists:
To be able to perform this, doesn't the user executing this snippet need to be an admin? Running this with a service account returns a
403
error: