← Back to team overview

dhis2-users team mailing list archive

Re: API - update dataElement definitions

 

Hi Uwe,

just to clarify, are you submitting data elements one by one or in bulk?

According to HTTP/REST principles, you need to use the PUT method when you
update (not POST). Also, when you PUT, you need to put to the location of
the resource. So:

POST to api/dataElements
PUT to api/dataElements/<uid-of-existing-dataelement>

Another approach is to submit everything in one payload to the api/metaData
endpoint. If using XML you must wrap your payload in <metaData> in that
case.

https://www.dhis2.org/doc/snapshot/en/developer/html/ch01s06.html

regards,

Lars







On Mon, Dec 7, 2015 at 8:24 AM, Uwe Wahser <uwe@xxxxxxxxx> wrote:

> Dear all,
>
> I am currently trying to change properties of existing DataElements via api
> (esp. zeroIsSignificant). From the documentation I understand that I have
> to
> read all significant metadata of the existing DataElement, change my
> property
> and then push everything back via POST or PUT methods on
> [/api/dataElements?strategy=UPDATE&mergeStrategy=MERGE] (Unfortunatly I
> can't
> use the PATCH-method with my ETL tool)
>
> Using this method, DHIS2 ignores the change, instead I get an
> importConflict
> "Object already exists." in the result set.
>
> Am I missing out on something?
>
> Regards,
>
> Uwe
>
> _______________________________________________
> Mailing list: https://launchpad.net/~dhis2-users
> Post to     : dhis2-users@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~dhis2-users
> More help   : https://help.launchpad.net/ListHelp
>



-- 
Lars Helge Øverland
Lead developer, DHIS 2
University of Oslo
Skype: larshelgeoverland
http://www.dhis2.org <https://www.dhis2.org>

Follow ups

References