We’ve made some enhancements to the Mergin Maps Python API to give admins more control over user management. The new features let you create new users, customise usernames, manage roles of members and guests and much more!
Improve user management with Python API
The new tools offer greater flexibility to users who want to create scripts to automate user creation for their organisation or integrate user management with their own internal processes. If you need to invite a large number of users to your project or Workspace, you can also use the API tool instead of having to send individual invites through the dashboard. You can also use the API client to manage projects, generate status reports and push or pull project changes.
User creation example python script
The example script below is the format for creating a new user with the Pyton API
import mergin
#generate Mergin client
client = mergin.MerginClient(login='john', password='T0p_secret')
#create user substitute values in <> with actual user values [username] and [notify_user] are optional
client.create_user(<email>, <password>, <workspace_id>, <workspace_role>, [username], [notify_user])
For example, if I wanted to create a new user ‘jdoe@surveyor.com’ and add them as an admin on the workspace ‘1234’, I would use the following script:
import mergin
client = mergin.MerginClient(login='myusername', password='P@asswd')
client.create_user("jdoe@surveyor.com", "T0p_$ecret!", 1234, "admin", notify_user=True)
Conclusion
The Mergin Maps Python API is available to all users on Premium and Enterprise plans. To learn more about these new features, you can read about them and other features of the Mergin Maps API in our documentation.