Mapping tracked entity instances (attributes) to corresponding events (data values)

In previous versions of DHIS, it was possible to use trackedEntityInstance field to map attributes from api/trackedEntityInstances.json to data values from api/events.json.

With version 2.37, I can’t find anything in the api response to help me achieve that.

Any recommendations?

/api/33/trackedEntityInstances.json

            "created": "xx",
            "orgUnit": "xxx",
            "createdAtClient": "xxx",
            "trackedEntityInstance": "xxx",
            "lastUpdated": "xxx",
            "trackedEntityType": "xxx",
            "lastUpdatedAtClient": "xxx",
            "potentialDuplicate": xx,
            "inactive": xx,
            "deleted": xx,
            "featureType": "xx",
            "programOwners": [],
            "enrollments": [],
            "relationships": [],
            "attributes": []

/api/tracker/events.json

"instances": [
        {
            "event": "xxx",
            "status": "xxx",
            "program": "xxx",
            "programStage": "xxx",
            "enrollment": "xxx",
            "orgUnit": "xxx",
            "orgUnitName": "xx",
            "relationships": [],
            "occurredAt": "xxx",
            "scheduledAt": "xxx",
            "storedBy": "xxx",
            "followup": xxx,
            "deleted": xxx,
            "createdAt": "xxx",
            "updatedAt": "xxx",
            "attributeOptionCombo": "xxx",
            "attributeCategoryOptions": "xxx",
            "completedAt": "xxx",
            "createdBy": "xxx",
            "updatedBy": "xxx",
            "dataValues": []

Hi @1000_Hills,
Welcome to the community! :tada::tada: Thank you for your question and patience!

As you see in the screenshot below I can get all the info from the trackedEntityInstances. If you want to see all the fields that are available use the parameter fields=* (and then instead of the * it’s recommended to be specific).
This is the URL I tried in the 2.37 instance on play: /api/trackedEntityInstances?program=[programID]&ou=[OrganisationUnitID]&fields=*

Thanks @Gassim. This solves my query.

1 Like

You’re welcome! :+1::+1:

1 Like