Chris Walls

Importing Users With Custom FIelds

Discussion created by Chris Walls Administrator on Aug 5, 2015
The following scripts are provided by Samanage as examples and training purposes only and not designed to work in every use case without some modification to the script itself. These scripts are not supported by Samanage as part of your Samanage Master Subscription Agreement, however if you would like this script customized to support your use case, please contact us at API.Scripts@samanage.com for a personal quote.



Importing Users Script



The example script above utilizes the SamanageAPI to create new users based on a CSV file. In order to use this you will need Ruby version 2.0.0 or greater, the [SamanageAPI Link] and  the following gems: rest-client and xml-simple.



To use this script edit the the import_users.rb fileto match your Samanage user credentials:

 


Each row of the CSV will send a new user to Samanage as an XML object based on the template. In this example, each row has columns which are selected by row["Column Name"].



To run the script simply enter ruby import_users.rb users.csv. Any user creation that is not successful will be logged into a local error file.

Outcomes