OrganisationUnit API: Ordering by level seems to not work on 2.36.4

Hi there

In versions below 2.36 this /api/organisationUnits.json?fields=id,name,parent,level&order=level:asc used to work and results will be ordered in ascending order given the level. But now same api brings error in 2.36 will the following message

{
“httpStatus”: “Internal Server Error”,
“httpStatusCode”: 500,
“status”: “ERROR”,
“message”: “Unable to locate Attribute with the the given name [null] on this ManagedType [org.hisp.dhis.organisationunit.OrganisationUnit]”
}

Apparently the this error can also be replicated in https://play.dhis2.org/2.36.4/api/organisationUnits.json?fields=id,name,parent,level&order=level:asc, and error is only on ordering by level (other attributes work as expected)

Has anything changed on 2.36? Or is there anything that I am missing here?

2 Likes

Hi @rajab_mkomwa,
Thank you for your post! Please try &order=organisationUnit[level]:asc instead of using directly level. I hope this works. :smiling_face:

Hi @Gassim,

Unfortunately the suggested solution still does not order organisation units by level, it is like there is no effect on the result with or without it.

1 Like

Hi @rajab_mkomwa,
Thank you for your patience! Would you like to create a Jira bug issue in jira.dhis2.org? You’d need to have a Jira account to create an issue.

Thanks!