Assign User Category with Python API

161
3
Jump to solution
2 weeks ago
zrobinson_agolpublic
New Contributor II

I am attempting to set member categories for individual members using the ArcGIS API for Python in Notebook Server for Portal. 

The API docs and posts in the community state that it should be possible to use the "update" method to assign categories to a member. arcgis.gis module | ArcGIS API for Python

The update method has an argument for "categories" as shown in the highlight below. 

zrobinson_agolpublic_0-1713817348385.png

But, when attempting to assign a property to the argument using the code below, I get the following error. 

 

users = gis.users.search('zrobinson')
users[0].update(categories=['/Categories/ITS'])
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
/tmp/ipykernel_188/103280399.py in <module>
----> 1 users[0].update(categories=['/Categories/ITS'])

TypeError: update() got an unexpected keyword argument 'categories'

 

However, I can use the same code to update other properties for the user such as description, name, etc. So the update method is recognized but for some reason does not recognize the "categories" argument. 

Has anyone had success updating the categories for a user? Someone claimed success in this related post: Solved: Python Assign User Category - Esri Community

Tags (2)
0 Kudos
1 Solution

Accepted Solutions
JakeSkinner
Esri Esteemed Contributor

Hi @zrobinson_agolpublic ,

What version of the API are you running?

JakeSkinner_0-1713818695923.png

 

View solution in original post

0 Kudos
3 Replies
JakeSkinner
Esri Esteemed Contributor

Hi @zrobinson_agolpublic ,

What version of the API are you running?

JakeSkinner_0-1713818695923.png

 

0 Kudos
zrobinson_agolpublic
New Contributor II

Thanks, Jake. You seem to have found the problem. I'm running the script from our Enterprise Notebook Server and the API version is 1.9.1. I assumed it was using the latest API. Do you know how to ensure Notebook Server is using the latest API?

 

0 Kudos
zrobinson_agolpublic
New Contributor II

You can disregard. I spoke with our GIS Admin. We just need to upgrade our Notebook Server. Thanks for pointing me in the right direction!

0 Kudos