Dhis 2 Web api Retrive User by username


Hello, is there an endpoint allowing to retrieve the information (displayName and orgunit) of a user from his username?
The following one return the displayName but not the orgUnit




Hi @didate,

I think there are two ways using that endPoint. The first is to use the ID. For example, [yourInstanceURL]/api/users/[userID]?fields=displayName,organisationUnits. And the second is to use filter. For example, [instanceURL]/api/users?fields=displayName,organisationUnits&filter=displayName:ilike:[username]. I used ilike here as a filter but you can use eq if you want a more specific result!

Hope this helps!

Happy coding times, didate! Thanks! (:

1 Like

Hello @Gassim ,

Yes the second one is working if I want to filter with displayName, but when I try to filter with the username like => &filter=username:eq:didate (I only have the username/login) I have the following error :


  • “httpStatus”: “Conflict”,
  • “httpStatusCode”: 409,
  • “status”: “ERROR”,
  • “message”: “Unknown path property: username”


The solution I found for the moment is to do it in 2 requests.

1 => api/userLookup/didate (this request will give me the uid of didate)

2 => api/users/uid (which will give me all the information on the user)

Thank you @Gassim .

Right sorry I forgot to filter by username. This should work 100%:


Thanks! Your question helped me solve some of the questions I was looking for too! :smiley: :pray:

1 Like

Work Perfectly.

Thank you @Gassim

1 Like