← Back to team overview

dhis2-devs team mailing list archive

Response differences between /api/metadata and /api/23/metadata



I am working on updating our applications to DHIS 2 v 2.23 specifically in
regards to upgrading to using the /api/23/metadata api call. I am testing
against revision 23053.

We have a few issues:

   1. Is there any documentation outlining the response structure from all
   API calls, including when there are errors or any other scenarios? We have
   been upgrading our response parser on a trial and error basis attempting to
   mimic all possible scenarios which is not ideal.
   2. When submitting an identical post containing
   {"programTrackedEntityAttributes" [...], "program" [...]}, where there is
   an error in the Program being posted, the call to /api/metadata responds
   with success for "programTrackedEntityAttributes" with the correct
   "importCount" counts, but the call to /api/23/metadata responds for
   "programTrackedEntityAttributes" with "stats" counts containing all zeros,
   and no "objectReports". It is like the first item being posted is
   completely ignored if the second item posted has errors. Is this the
   intended behaviour? And should there be "objectReports" regardless? Please
   see attached examples.
   3. There is no longer a "lastImported" field. Is this now deprecated?
   4. The /api/23/metadata response with "errorReports" within
   "objectReports" appears to have replaced the /api/metadata
   "importConflicts". In /api/metadata, the "importConflicts" "object" field
   contains the actual name of the object that has the error (eg: the Program
   short name in our case). However, in /api/23/metadata there is only the
   index which makes it more work to debug. Is it possible to also include the
   name of the object in the error report like the prior API version does?



Attachment: metadata23PostResponse.json
Description: application/json

Attachment: metadataDefaultPostResponse.json
Description: application/json

Attachment: metadataPostBody.json
Description: application/json

Follow ups