Web API: Unable to create Event when inserting Tracked Entity Instance

api
tracker
(Aleksa Krolls) #1

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:
"events":{"responseType":"ImportSummaries","status":**"SUCCESS","imported":0**,"updated":0,"deleted":0,"ignored":0}

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.

3 Likes
(James Omutsani) #2

Hi @aleksa_krolls,

I am tagging @Emma_Kassy to have a look at this and advise while other community members also look into it.

Bet,
James.

1 Like