Is it possible to create a Tracked Entity Instance and create an Event in the same request and payload? The web API documentation for version 2.29 indicates yes via the update strategy, but I am finding otherwise when testing…
1.67.5 Update strategies. Two update strategies for tracked entity instance are supported: enrollment and event creation.
In one HTTP post request via my command line, I am trying to (1) create a Tracked Entity Instance, (2) enroll the TEI, and (3) create a related Event. I am able to do 1 and 2 successfully using the below curl and this TEI payload – but not #3.
curl -X POST -H "Content-Type:application/json" -d @payload.json -u UN:PW https://dhis2servername.net/api/29/trackedEntityInstances?strategy=CREATE_AND_UPDATE
I receive a success message response for importing Events, but no Event record is actually created/imported:
When I copy/paste the same Event data into a new Event-only payload, and try to create an Event via the Events API endpoint, I am able to successfully create this event no issues.
curl -X POST -H "Content-Type:application/json" -d @EventPayload.json -u UN:PW https://dhis2servername.net/api/29/events
In sum, I am unable to create the Event at the same time as creating the Tracked Entity Instance using the CREATE_AND_UPDATE strategy. Is there something about my payload I need to modify? Or is the web api documentation not accurate?
Thanks for your support.