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

2017-11-26 Thread Morten Olav Hansen
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  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
>
>
>
> 
>  Virus-free.
> www.avast.com
> 
> <#m_-8384708315250723649_DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
>
> ___
> 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
>
>
___
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


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

2017-11-24 Thread Omer Butt
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



Virus-free.
www.avast.com

<#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
___
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


Re: [Dhis2-devs] DHIS-2 API's

2017-08-24 Thread Julhas Sujan
Hi Omer Butt,

You can parse/decode this json string by using JavaScript, PHP or Java or
any other languages.



*You can parse by JavaScript as below: *

var dhis2JSONObj, x;

dhis2JSONObj =
{"name":"Bannu","children":[{"id":"yvVnd97UiJN"},{"id":"cdlEAe4BMS2"}],"ancestors":[{"id":"osCztkmFYud"},{"id":"KH8VFLnpwWL"}]}
;

x = dhis2JSONObj.name;
document.getElementById("demo").innerHTML = x;



Result:

​
*You can decode by PHP as below: *

{'name'}; // Bannu
?>

​

*You can parse by Java as below: *

https://examples.javacodegeeks.com/core-java/json/java-json-parser-example/





*If you have any questions or concerns, don’t hesitate to let me know.*

*Best Regards*
*Julhas Sujan*
Senior Java Programmer
Management Science for Health(MSH)
Dhaka, Bangladesh
Cell: +8801989 442856
Skype: julhas08
​
www.msh.org http://siapsprogram.org/wherewework/bangladesh/

On Thu, Aug 24, 2017 at 11:29 AM, Omer Butt  wrote:

> Sir I used that API :
> *:/api/organisationUnits/OYfCChzZ1wx.json?fields=ancestors,children,name*
>
> *Response :*
> {"name":"Bannu","children":[{"id":"yvVnd97UiJN"},{"id":"
> cdlEAe4BMS2"}],"ancestors":[{"id":"osCztkmFYud"},{"id":"KH8VFLnpwWL"}]}
>
>
> *--*
> *How Can I get name of the children and ancestors. ??*
>
>
> ___
> 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
>
>
___
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


Re: [Dhis2-devs] DHIS-2 API's

2017-08-23 Thread Em Le Hong
Hi Omer,

You can try something like this:

?fields=children[name,id],ancestors[name,id]

On Thu, Aug 24, 2017 at 12:29 PM, Omer Butt  wrote:

> Sir I used that API :
> *:/api/organisationUnits/OYfCChzZ1wx.json?fields=ancestors,children,name*
>
> *Response :*
> {"name":"Bannu","children":[{"id":"yvVnd97UiJN"},{"id":"
> cdlEAe4BMS2"}],"ancestors":[{"id":"osCztkmFYud"},{"id":"KH8VFLnpwWL"}]}
>
>
> *--*
> *How Can I get name of the children and ancestors. ??*
>
>
> ___
> 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
>
>


-- 
*Em Le Hong*
DHIS2 Implementation| *HISP Vietnam *
em.hispviet...@gmail.com | *Skype:* em.hispviet...@gmail.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


[Dhis2-devs] DHIS-2 API's

2017-08-23 Thread Omer Butt
Sir,
Will there a API to get information about facilities attaced to orgunit
group.

Like BHU is a orgunit group.
will i access the names of facilities that under BHU.

Thanks.
___
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


[Dhis2-devs] DHIS-2 API's

2017-08-23 Thread Omer Butt
Sir I used that API :
*:/api/organisationUnits/OYfCChzZ1wx.json?fields=ancestors,children,name*

*Response :*
{"name":"Bannu","children":[{"id":"yvVnd97UiJN"},{"id":"cdlEAe4BMS2"}],"ancestors":[{"id":"osCztkmFYud"},{"id":"KH8VFLnpwWL"}]}


*--*
*How Can I get name of the children and ancestors. ??*
___
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