Copy Users to Portal with ArcGIS Python API

1824
4
03-14-2017 03:08 PM
deleted-user-RAnIQZ9vH9z7
New Contributor II

Has anyone utilized the new ArcGIS Python API? We have a Portal we're trying to add users into with a CSV file. The sample notebook copies directly from the source Portal to the target Portal. I currently was able to write a script to export the user data to a CSV and need some help importing the user info into the portal.

I think I need to convert the CSV file data into a dot notation file to call each data for the particular user. Any help would be great.

ArcGIS Python API Sample Notebook

0 Kudos
4 Replies
by Anonymous User
Not applicable

Philip have you checked out these scripts in the SDK github repo arcgis-python-api/samples/03_org_administrators/AdminCreatePortal at master · Esri/arcgis-python-api... 

Take a look at create_users.py and users.csv files. It might have what you are looking for, if not, we will work toward adding it.

deleted-user-RAnIQZ9vH9z7
New Contributor II

Hi Atma,

Thanks for replying with the resources. It was very helpful in seeing how to import users through a CSV. I'm running into an issue with trying to add users to our portal when using your code. The problem is the portal that I'm connecting to does not have all the fields the default portals use. For instance, we do not have the password, firstname, and lastname. We use these fields 'username, fullname, email, group, role, idp_username, description'. Is there a way to add those or do we have to follow the Create method from the API?

I also readjusted my CSV file to follow your exact headers and get an Error Code: 500. Any suggestions with that?

Thanks for your time!

Error message from Portal

0 Kudos
by Anonymous User
Not applicable

Philip,

You are welcome. Is your Portal for ArcGIS of version older than 10.4? If that is the case, you would have a `fullname` instead of separate first and last names. If that is the case the current version of Python API cannot create users.

Alternately, if your Portal for ArcGIS is relatively newer, it may be using an authentication mechanism where users are created based on a domain (inferring from your idp_username and absence of password). You can modify the CSV and the Python script such that it only has the columns you mention. Work with your IT personnel to get the exact values for username and idp_username, as an example they may resemble the format username@domain and domain\username respectively.

deleted-user-RAnIQZ9vH9z7
New Contributor II

Hi Atma,

Thanks for the quick response. Yes, the Portal version is older than 10.4. I will have to look for an alternative method in creating the users then.

Thanks for your time and help!

0 Kudos