cht create-users to bulk create users in CHT where there already exists a list of users.
To tackle the issue of duplicate usernames, I first downloaded a list of existing users and then used it to validate the new list of users in csv to ensure that there are no duplicate usernames. I’m curious to know if there is a more efficient approach to solving this challenge.?
We’re working on a feature release for bulk user creation which is being tracked by the GitHub issues #7503 and #7611. It has a
POST /api/v2/users route which accepts a csv body and it will create users from that csv. This route is consumed by the admin app that has a new button to access this feature.
While this is only available on the branch
3.15.0-FR-bulk-user-upload for now, we’re planning to release it with CHT 4.0.
If the instance you’re using is on CHT v3.14.2 or higher, it already has a route that will bulk create users from a JSON array.
cht-conf hasn’t been updated to leverage this change yet but the route’s documentation is available here.
Here is an example response where a duplicate user is skipped and a second one is created successfully:
"message": "Username \"duplicate-user\" already taken.",
I will explore this on a local instance… This looks so much more efficient.