Yes the dataValue is updated but the other dataValues are erased. How can i update the value of just two or three data elements without affecting the other values?
NB: I am importing the data manually from a JSON file.
HI @Micah, The best and easiest way to do that would be to add the values that you don’t want to change in the payload itself. Meaning that if you have for example DE2 and you don’t want it’s value to change, you sould send this payload.
{
"events": [
{
"event": "ZwwuwNp6gVd",
"dataValues": [
{
"dataElement": "bx6fsa0t90x",
"value": "true"
},{
"dataElement": "DE2_ID",
"value": "oldValue"//The value you want to remain the same.
}
],
"orgUnit": "y77LiPqLMoq",
"program": "IpHINAT79UW",
"programStage": "A03MvHHogjR",
"status": "ACTIVE"
}
]
}```
To update a single data element value in an event, use the following JSON payload and send a PUT request to the /api/events/eventUID/dataelementUID endpoint, such as https://server/api/events/TCE3pafFg6C/TDFD3lBiG6c.
Thanks @Melaeke This one works. the problem is that i have over 100 data elements for each event and the work involved would be much. i was trying to avoid this
Okay thanks. I tried to manually import a JSON file with "providedElsewhere": false but still the other dataElement values were “erased”. I will try to write code for this because it can allow me to add the PUT command and let let you know. But at least, i see some light now.
I see what you are looking sounds similar to the API improvements, but these partial updates are for the metadata… maybe in the future! Would you care to create a feature request? See voting tool: ideas
There’s another option proposed by @paleu256 which is to write a paleu256 so that might be an option.