Dear Developer
How to retrieve list of all superuser and admin using API in DHIS2
Regards
Dear Developer
How to retrieve list of all superuser and admin using API in DHIS2
Regards
User extended App can also do the magic
@Shapr0019 If you have super user rights of your instance go to app management and install an application called User extended app. You are able to export users by User role and user group
Hi there! I think you can list users belonging to a certain group by using the userGroups API. Please use the API sample below to see how to get the user ids of a group. Kindly note that you will have to know the group ID of the super user group
http://YOUR_SERVER_URL/api/userGroups/GROUP_ID.json
This is an example of a working API using the play.dhis2.org instance
DHIS 2 Demo - Sierra Leone
Hie @Tedson
Thank you very much for providing a very straight forward answer. The App is excellent. However, I wanted to use API to download all names, last log in, user roles and user group. I am developing a code script to retrieve such information.
Regards
Hie @MiltonIsaya
This is very useful. In this case super user is not belonging to any user group. And also how to download that information vie excel file
Regards
You can query the data and thereafter parse it to excel via the script you are writing @Shapr0019
Hi @Shapr0019
You can filter within multiple user groups as a collection of users, as in here:
https://play.dhis2.org/2.39.0.1/api/users.json?filter=userGroups.id:in:[wl5cDMuUhmF,lFHP5lLkzVr]&fields=name,userCredentials[lastLogin],userRoles[id,name],userGroups[id,name]
This should get you the fields you require. Replace
userGroups.id:in:[wl5cDMuUhmF,lFHP5lLkzVr]
with the UIDs of your super user and admin userGroups.
The same applies for userRoles