pageSize parameter not working in enrollments API

Hello DHIS,

We are facing an issue with using the Enrollments API in our custom app. We have found that the pageSize parameter is not working as expected. Instead of returning only the requested number of items, all items are returned. We have raised this issue in JIRA (see: https://jira.dhis2.org/browse/DHIS2-13512).

We were wondering if there might be another method or workaround for setting the page size available?

Thanks,
Kris

Welcome back @Kris_Reinhardt! :slight_smile:

Thank you for your post and for creating a Jira bug issue! This does seem like a bug. Triaging to the developers and asking for a workaround.

Thanks!

Awesome - thank you for such quick action @Gassim :smiley:

1 Like

@Kris_Reinhardt, you are welcome! :smiley:

Actually, I was still looking at it and it turns out that when &totalPages=true is removed from the request the correct pageSize is returned. Using the link you posted in the issue: https://play.dhis2.org/2.37.7.1/api/enrollments?fields=enrollment&ou=ImspTQPwCqd&ouMode=DESCENDANTS&page=1&pageSize=2&program=ur1Edk5Oe2n&programEndDate=2021-05-24&programStartDate=2021-05-02

Maybe request the totalPages separately for now? (edit: it seems that it will not work without the totalPages because it will only return the first items and there is no way to navigate?)

I hope this helps, and if it solves the issue please mark the post as solved. :smile: :+1:

Thanks!

Thanks again @Gassim - we’ll look into this workaround to see if it solves our issue and let you know.

1 Like