DHIS-2 API's : Updating the attributes values of a specific org Unit

Hi,

I am using that api with json format data to update specific attribute of an org unit . But its create a new orgunit rather than updating the existing org unit.

kindly explain or guide where i am wrong.

Below is the data format in json and api that iam using.

I have to update that orgunit with attribute value .

json string data : data.json

{“orgUnit”:“o6s4YOrMS1T”,“name”:“Muslim Medicose”,“shortName”:“Muslim Medicose”,“openingDate”:“2016-09-01”,“attributeValues”:[{“attribute”:{“id”:“Jn52d5llxAo”},“value”:“1”}]}

API :

curl -X PUT -d @data.json -H "Content-Type: application/json" -u user:password [http://server/api/26/organisationUnits/o6s4YOrMS1T](http://server/api/26/organisationUnits/o6s4YOrMS1T)


Virus-free. www.avast.com

Hi Omer

Instead of doing “orgUnit”: “YOUR-ID”, it should just be “id”: “YOUR-ID”

···

On Fri, Nov 24, 2017 at 5:31 PM, Omer Butt omerbutt2521@gmail.com wrote:

Hi,

I am using that api with json format data to update specific attribute of an org unit . But its create a new orgunit rather than updating the existing org unit.

kindly explain or guide where i am wrong.

Below is the data format in json and api that iam using.

I have to update that orgunit with attribute value .

json string data : data.json

{“orgUnit”:“o6s4YOrMS1T”,“name”:“Muslim Medicose”,“shortName”:“Muslim Medicose”,“openingDate”:“2016-09-01”,“attributeValues”:[{“attribute”:{“id”:“Jn52d5llxAo”},“value”:“1”}]}

API :

curl -X PUT -d @data.json -H "Content-Type: application/json" -u user:password [http://server/api/26/organisationUnits/o6s4YOrMS1T](http://server/api/26/organisationUnits/o6s4YOrMS1T)


Virus-free. www.avast.com


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

Morten Olav Hansen

Senior Engineer, DHIS 2

University of Oslo

http://www.dhis2.org