Hello,
I am posting lots of data to the DHIS2 API (around 4,000 records).
I figured the best way to do this was to use ?async=true
but there’s no way to get references to the newly created trackedEntityInstances
this way.
The other problem is… when I import them without async=true
the ID’s are all jumbled (not in the same order as I sent them). So there’s no way to associate the new DHIS2 ID (reference) against my local record.
How do I associate a DHIS2 reference against a local record efficiently?
Thanks!
It would be useful if there was a way to send metadata with a trackedEntityInstance that DHIS2 would just return with the newly created / updated reference.
Something like the following:-
Request:
{
"events": [
{
"state": "a",
"trackedEntityInstance": "TSd4aaIwKxp",
"program": "nxjqfpbOWnQ",
"orgUnit": "rAezDUboCwI",
"event": null,
"meta": {
"id": 1
},
"eventDate": "2020-05-25",
"status": "ACTIVE",
"storedBy": "admin",
"programStage": "d7kL0IMGO6r",
"dataValues": [
{
"dataElement": "av3YgLRbobM",
"value": "Health & Medication History"
}
]
}
]
}
Response:
{
"responseType": "ImportSummary",
"status": "SUCCESS",
"importCount": {
"imported": 1,
"updated": 0,
"ignored": 0,
"deleted": 0
},
"reference": "EgcV93ZFpJu",
"meta": {
"id": 1
},
"enrollments": {
"responseType": "ImportSummaries",
"status": "SUCCESS",
"imported": 0,
"updated": 0,
"deleted": 0,
"ignored": 0,
"total": 0
}
}