← Back to team overview

dhis2-devs team mailing list archive

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

 

Hi Omer

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

-- 
Morten Olav Hansen
Senior Engineer, DHIS 2
University of Oslo
http://www.dhis2.org

On Fri, Nov 24, 2017 at 5:31 PM, Omer Butt <omerbutt2521@xxxxxxxxx> 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
>
>
>
> <https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail&utm_term=icon> Virus-free.
> www.avast.com
> <https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail&utm_term=link>
> <#m_-8384708315250723649_DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
>
> _______________________________________________
> Mailing list: https://launchpad.net/~dhis2-devs
> Post to     : dhis2-devs@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~dhis2-devs
> More help   : https://help.launchpad.net/ListHelp
>
>

References