Error importing an event

Hi all,
I’m trying to register an event in the Dhis2 program from Angular. This is the form I send it but I always get a “message”: “Import was successful.”, but nothing is created in Dhis2. Any idea what is missing?
Thanks in advance.

const eventoData1 = {
  "program": "RWGqus8n2x3",
  "trackedEntityInstance": id,
  "trackedEntityType": "Jch8VTnxDSU",
  "orgUnit": "C7UVYRGE2d1",
  "programStage": "MxxHo6ujEZB",
  "eventDate": "2023-11-18",
  “storedBy”: “admin”,
  "events": [
    {
      "orgUnit": "C7UVYRGE2d1",

      "status": "COMPLETED",

      "dataValues": [
        { "dataElement": "UvMje2XrsYw", "value": new Date(this.registroForm.get('fechaToma')?.value) },
        { "dataElement": "ygC1kbHF8zW", "value": Number(this.registroForm.get('sistolica')?.value) },
        { "dataElement": "lR5x7vkSpwN", "value": Number(this.registroForm.get('diastolica')?.value) }
      ]
    }
  ]
};

PD: the id of the trackedEntityInstance corresponds to the patient I want to create the event for.

Hi @Alba

Welcome to the community! :tada:

What version of DHIS2 are you connecting to? And what endpoint are you using (Tracker - DHIS2 Documentation)?

Could you share the API request you are using?

Thanks!

Hii,
Thank you very much!

I have already solved it, I had the endpoint spelled wrong and I was missing the eventDate within the event. Thank you very much for the tip! :slight_smile:

1 Like

Glad it worked… Sharing the solution is very helpful, thank you!