So recently I wrote a script that would change a user's custom role. Initially it was working, but recently it's broken and I'm not sure how to fix it. The error message I'm getting is a RuntimeError (400) "Unable to update user role. 'user' parameter required or invalid." Has anyone else been having this issue? A rough breakdown of the script is below.
from arcgis.gis import GIS
gis = GIS("https://www.arcgis.com","Admin Username,"Admin Password")
Username = "A user from my organization"
UserRole = "Custom user role id for role I want to change my user to"
testUser = gis.users.get(Username)
testUser.update_role(role = UserRole)
According to my script the break always happens at the update_role line and it's always that same RuntimeError. I've checked the documentation for the command and I don't see what I'm doing wrong, especially since it used to work just fine. The Admin account does have permissions to change account roles as well. You can still successfully change roles manually, just not through python.
Any suggestions? Thanks much!