API for Patch dataSet and dataelement

Hi, try chanding the payload anf use dataSetElements instead of dataElements.

Also ensure you are using POST if you are adding dataElements to datasets.

Regards.

···

2018-04-27 20:23 GMT+00:00 Stephen Ocaya stephocay@hispuganda.org:

Hi, You might want to look at this documentation. This is a generic metadata update that you can make using the API for any metadata.

You will have to prepare your payload for dataElements as below:- where id is UID of existing dataElements and hit the endpoints using a comand like below

  1. Prepare the Payload
  {
"dataElements": [
{ "id": "ID1" },
{ "id": "ID2" },
{ "id": "ID3" }
]
}
  1. Make the Call to the Endpoints
curl -d @dataelements.json "[http://server/api/26/dataSets/UID/dataSetElements](http://server/api/26/dataSets/UID/dataSetElements)" -X POST -H "Content-Type: application/json" -u user:password

https://docs.dhis2.org/2.28/en/developer/html/dhis2_developer_manual_full.html#webapi_adding_removing_objects_collections

regards

Strategic Information Systems for Actions

Plot 36 Impala Avenue, Kololo

P.O. Box 4750, Kampala

On Fri, Apr 27, 2018 at 8:45 PM, Jean Habib habibjean18@gmail.com wrote:

Hi all,

Please there is a way to add dataeelement to dataset by API, like partial update ?

Best


Mailing list: https://launchpad.net/~dhis2-users

Post to : dhis2-users@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-users

More help : https://help.launchpad.net/ListHelp

Stephen Ocaya

Health Information Systems Advisor,

Mobile: +256774558980 | +256752712007

SkypeID: stephocay