How to retrieve list of all superuser and admin using API in DHIS2

Dear Developer

How to retrieve list of all superuser and admin using API in DHIS2


User extended App can also do the magic

@Tedson add more details, which app are you talking about

@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


This is an example of a working API using the 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.

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


You can query the data and thereafter parse it to excel via the script you are writing @Shapr0019

@MiltonIsaya thank you very much

Hi @Shapr0019

You can filter within multiple user groups as a collection of users, as in here:[wl5cDMuUhmF,lFHP5lLkzVr]&fields=name,userCredentials[lastLogin],userRoles[id,name],userGroups[id,name]

This should get you the fields you require. Replace[wl5cDMuUhmF,lFHP5lLkzVr] with the UIDs of your super user and admin userGroups.

The same applies for userRoles

1 Like