List of all completed enrollments

Hi everyone,
I am using 2.37.9.1 version.
I know I can use UI to get the list of completed enrollments for each organization unit. But in my case we have over 100 OUs…
So I decided to use Postman App to GET all the enrolments which have “completed” enrolment status. I tried both urls for these resources( /api/enrollments and /api/33/enrollments) with different keys from the dhis2 documentation, but always got the following error message:
{
“httpStatus”: “Internal Server Error”,
“httpStatusCode”: 500,
“status”: “ERROR”,
“message”: “Cannot invoke "java.lang.Integer.intValue()" because the return value of "org.hisp.dhis.program.ProgramInstanceQueryParams.getPage()" is null”
}
I am very new to using API, so I will appriciate any hints or suggestions.

Hi @m.siusko

Welcome to the community! :tada:

I tried to do the same and got the result without errors, see the following request: instanceURL/api/enrollments?ou=g8upMTyEZGZ&paging=false

I added pading=false. Could you share the parameters in your request?

Thanks!

Hi @Gassim ,
Thank you for a prompt reply,
I can confirm that it works with Demo instances. Unfortunately the same approach does not work on our instance (actually it gives the same error that was described above).
My parameters are following:


Though I still can reach events and TEIs. The problem only with enrollments

Well, since it’s working in the demo instances, so maybe updating the version to one of the latest supported versions? Probably 2.38 and above?

Unfortunately, I have no such privileges yet. But when the update be done by our admin we will test it again. Anyway, thank you for your assistance.

1 Like