How do I set the payload of a json file if I want to bulk upload data values?

I want to use Import/Export app to bulk upload data values that were captured before we setup DHIS2.

The data values come from different organization units, periods, data elements, COC and AOC.

How do I set the payload of a json file if I want to bulk upload the data values? Will it work like the example for sending bulk data values in /api/dataValueSets?

The example in the doc does not include COC and AOC.

{
    "dataValues": [
        {
            "dataElement": "f7n9E0hX8qk",
            "period": "201401",
            "orgUnit": "DiszpKrYNg8",
            "value": "12"
        },
        {
            "dataElement": "f7n9E0hX8qk",
            "period": "201401",
            "orgUnit": "FNnj3jKGS7i",
            "value": "14"
        },
        {
            "dataElement": "f7n9E0hX8qk",
            "period": "201402",
            "orgUnit": "DiszpKrYNg8",
            "value": "16"
        },
        {
            "dataElement": "f7n9E0hX8qk",
            "period": "201402",
            "orgUnit": "Jkhdsf8sdf4",
            "value": "18"
        }
    ]
}

Hi
This should work for you

{
  "dataValues": [
    {
      "dataElement": "BXgDHhPdFVU",
      "period": "202201",
      "orgUnit": "Vth0fbpFcsO",
      "categoryOptionCombo": "J2Qf1jtZuj8",
      "attributeOptionCombo": "HllvX50cXC0",
      "value": "20",
      "storedBy": "someusername",
      "created": "2023-05-08",
      "lastUpdated": "2023-05-08",
      "comment": "optional comment"
    },
    {
      "dataElement": "Dkapzovo8Ll",
      "period": "202201",
      "orgUnit": "bL4ooGhyHRQ",
      "categoryOptionCombo": "J2Qf1jtZuj8",
      "attributeOptionCombo": "HllvX50cXC0",
      "value": "40",
      "storedBy": "someusername",
      "created": "2023-05-08",
      "lastUpdated": "2023-05-08",
      "comment": "optional comment"
    }
  ]
}
2 Likes

Thank you more like what I am looking for. I will test it and revert.

1 Like