How to sort property by name in API

Hello,

I am trying to sort the API by name by adding the order=name:asc to the API. However, the result that I got is not sorted. Please advice on how to get the desire output.

/api/29/organisationUnits/UzOk2ito9aI.json?node=UzOk2ito9aI&fields=children%5Bid%2CdisplayName~rename(name)%2Cchildren%3A%3AisNotEmpty~rename(hasChildren)%26paging%3Dfalse?order=name:asc

Regards
Sam

Hi @Samnang_Sao

The organisation units received from the backend are already sorted alphabetically. However, if they are not sorted, you can use below end pint.
/api/organisationUnits.json?&fields=id,name&order=name

Thanks

1 Like