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.
Sent from my HTC
----- Reply message -----
From: "Jean Habib" <habibjea...@gmail.com>
To: "Stephen Ocaya" <stepho...@hispuganda.org>
Cc: "DHIS 2 Users list" <dhis2-us...@lists.launchpad.net>, "DHIS 2 Developers
list" <dhis2-devs@lists.launchpad.net>
Subject: [Dhis2-users] API for Patch dataSet and dataelement
Date: Sat, Apr 28, 2018 01:09
HI Ocaya for your reply.
But I got this error
{
"httpStatus": "Conflict",
"httpStatusCode": 409,
"status": "ERROR",
"message": "Only identifiable object collections can be removed from."
}
What can be issue ?
2018-04-27 20:23 GMT+00:00 Stephen Ocaya <stepho...@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" }
]
}
2. Make the Call to the Endpoints
curl -d @dataelements.json "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
On Fri, Apr 27, 2018 at 8:45 PM, Jean Habib <habibjea...@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-us...@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
Strategic Information Systems for Actions
Plot 36 Impala Avenue, Kololo
P.O. Box 4750, Kampala
_______________________________________________
Mailing list: https://launchpad.net/~dhis2-devs
Post to : dhis2-devs@lists.launchpad.net
Unsubscribe : https://launchpad.net/~dhis2-devs
More help : https://help.launchpad.net/ListHelp