Relationship of enrollments to other metadata in API

Hi there,

I thought I’d check in here with the DHIS2 devs first before raising this as a bug in JIRA.

It seems like when querying the API for trackedEntityInstances, the ‘enrollments’ field is always empty, even if that TEI might have enrollments.

i.e. When asking for the following TEI, enrollments is []
https://play.dhis2.org/2.29/api/trackedEntityInstances/d6mEi2pSJlZ

But an enrollment for this TEI clearly exists here:
https://play.dhis2.org/2.29/api/enrollments/gopBaFzOdkt

This isn’t a rare case, it happens for all TEIs:
https://play.dhis2.org/2.29/api/trackedEntityInstances?ou=DiszpKrYNg8&paging=false

It seems to be present in all versions as well, hence my reason for asking if this is expected somehow.

Thanks

1 Like

As I didn’t get a response from any dev saying this was a known issue I went ahead and created it as a JIRA issue to investigate further: [DHIS2-7111] - Jira

1 Like

Hi @Jasper_Timm,

sorry for the late reply. By default, we try to avoid including extra data in our tracker payloads (It can get huge if you want everything). So by default, we don’t include, for example, enrollments. You can however add the following parameter to your url to include them:

?fields=all (Includes all data)
?fields=enrollments

Thanks @Stian. I discussed this in the JIRA issue with Gintare.

I can understand not fully listing the enrollments for performance, but I think the confusing part is that the enrollments field is returned as an empty array at the moment, implying it has none. I think the better option would be either not returning the field at all or returning it only with the enrollment’s UID.

1 Like