P.S. This is very important for us. Currently we have more than 500 users with Passwords we need to update. So we gonna use csv file (id,code) with Postmun Runer to loop PATCH request in Postman (for Bulk Password updating)
Hi
Since these are working on other instances and in an instance with the same version as yours, would you double check that the user making the update actually has the same authorities as the users in the other system?
Additionally, are you going to make the password value the same for all users? BTW, PM has a random function (random name, country, city, numberâŚetc)
Maybe thatâs why itâs not working in 2.37? Maybe track network requests in that version when you update a password and see if there are any changes? Are you able to update the password from the UI then maybe use DevTools â Network?
In UI I can update passwords easily.
But I want to LOOP Postman PATCH request (using CSV template with different passwords for each user ID) to be able to BULK update user passwords.
If there is more simple way to BULK update user passwords (with different passwords values) in DHIS2, I will appriciate if you be so kind to share it with meâŚ
Okay, what I meant is that you check the network request sent in the DevTools when you update the password using the UI and compare it with the network request being sent using PM.
I understand your situation. Maybe another approach would be to use the System Settings to force users to update their passwords:
But I understand that this needs to be done ânowâ rather than wait three months (the minimum period).
Another suggestion is to try using Pgadmin and change the passwords using SQL but the passwords need to be inserted the same way the system does (hashedâŚetc); however, I think your approach seems good and maybe a better idea rather than touching the database.
Does the API request work before âloopingâ i.e. one change at a time but not when looping? Whatâs the issue that you see when using PM Runner?
Hi! I solved the task. Maybe it will help somebody. (Big thanks to @Ulanbek for the ideas). Here are the steps I performed:
Got the list of users for a specific OU in Postman (users whose passwords I wanted to change):
GET https://{{URLPROD}}/api/users.json?fields=*&paging=false&filter=organisationUnits.path:like:{{OUID}}
Then I opened the JSON file in VS Code and replaced all âselfRegisteredâ: false with âpasswordâ: âyourPassword1â, âyourPassword2â, etc.
To avoid replacing it manually, I used a simple JS script that searched each string containing âselfRegisteredâ and replaced them with a random password from an array [âpassword1â, âpassword2â, âpassword3â] using the replace() method.
And finally I used the modified json file in the Import/Export APP to BULK update user passwords