I am trying to import users from one dhis2 instance to another using the web API. However using /api/26/users or /api/26/userCredentials endpoint I am not able to get the passwords in my resulting payload. All other user details can be exported.
Hi Philip,
You can think of exploring the use of a SQL query to update the User details in the database direclty based on the UID’s as described here by Emma: Migrate User Credentials to new Production Server.
Let us know if this works best for you.
Regards,
James.
Thank you @jomutsani for the quick response. I will try this option out. Does this then mean that the WebAPI does not support export of the passwords via these endpoints? The documentation indicates so.
Hi @paleu256
DHIS2 does not expose passwords out of the API for security reasons and also from the way the passwords are hashed (bcrypt). You can however copy the usernames/passwords over to another instance with SQL.
Best,
James.
Thanks James. The SQL way did it for me. We also need to update the documentation to communicate this critical feature.
Philip
Nice to know you are sorted @paleu256
I will definitely check the documentation then share this with the team.
Best,
James.
This is really great information, thank you all for following up and recommending changes to the documentation.