Help - OpenClinic to DHIS2 2.41 Integration: Errors with dataValueSets and completeDate

OpenClinic to DHIS2 integration – Error when sending data to DHIS2 2.41

Hello everyone,

I am currently working on an integration between OpenClinic and DHIS2 2.41.

The objective is to send aggregated data from OpenClinic to DHIS2 using the DHIS2 Web API, specifically the dataValueSets endpoint.

The integration was working during our initial tests, but we are now encountering errors when OpenClinic sends the data to DHIS2.

One of the issues we noticed is related to the completeDate of the Data Set. For example:

text
completeDate = 2026-09-01

I would like to know whether the completeDate can prevent or interfere with importing data through the dataValueSets API in DHIS2 2.41.

I would also like to know the recommended way to mark a Data Set as incomplete (un-complete) in DHIS2 2.41, either through the user interface or through the Web API.

The error we are getting from OpenClinic is:

text
[PASTE THE EXACT ERROR HERE]

Has anyone experienced a similar issue when integrating OpenClinic with DHIS2 2.41?

Any guidance on the cause of the error and the correct API request would be greatly appreciated.

Thank you.

My senior, you are at the right place.
Your issue will be looked at and possible solution will be given. So be patient and hang tight. :victory_hand:

Hi Ansou,

Welcome to the DHIS2 Community!

Regarding your issue, I would first separate two things: importing data values and registering a Data Set as complete.

According to the DHIS2 Web API documentation, completeDate is a supported attribute of the POST /api/dataValueSets payload. For example:

{
  "dataSet": "DATASET_UID",
  "completeDate": "2026-09-01",
  "period": "202609",
  "orgUnit": "ORGUNIT_UID",
  "dataValues": [
    {
      "dataElement": "DE_UID",
      "categoryOptionCombo": "COC_UID",
      "value": "10"
    }
  ]
}

So, the presence of completeDate itself should not normally prevent the dataValueSets import. However, if the Data Set has already been registered as complete, there may be additional considerations depending on the configuration, user permissions, locking, or the exact request being sent.

For troubleshooting, I would recommend testing the integration in this order:

  1. Send the same payload without completeDate and check whether the data values are imported successfully.

  2. If that works, test again with:

"completeDate": "2026-09-01"

  1. Check whether the Data Set is already marked as complete for the given:

    • Data Set

    • Period

    • Organisation Unit

    • Attribute Option Combo, if applicable.

  2. If you need to mark the Data Set as complete, this is handled through:

POST /api/completeDataSetRegistrations

  1. To un-complete a Data Set, DHIS2 provides the DELETE operation on:
/api/completeDataSetRegistrations

The relevant parameters are:

ds = Data Set UID
pe = Period
ou = Organisation Unit UID

For example:

DELETE "https://YOUR-DHIS2-SERVER/api/completeDataSetRegistrations?ds=DATASET_UID&pe=202609&ou=ORGUNIT_UID"

I would also recommend checking the exact HTTP response returned by DHIS2. The most useful information would be:

  • HTTP status code (400, 401, 403, 409, etc.)

  • Response body from DHIS2

  • Exact JSON/XML payload sent by OpenClinic

  • Whether the Data Set is already complete

  • The user/API account permissions

  • Whether the same payload succeeds when sent directly with Postman or curl

For example:

curl -X POST "https://YOUR-DHIS2-SERVER/api/dataValueSets" \
  -H "Content-Type: application/json" \
  -u "USERNAME:PASSWORD" \
  -d @payload.json

Since the exact error is currently missing from the post ([PASTE THE EXACT ERROR HERE]), it would be difficult to identify the precise cause yet.

If you can provide the exact DHIS2 error response and the payload generated by OpenClinic (with credentials removed), the community should be able to narrow this down much more quickly.

DHIS2 documentation:

  • POST /api/dataValueSets is the endpoint used for importing data values.

  • completeDataSetRegistrations is used to register or un-register Data Set completeness.

Hope this helps!