web api

Hi Alice

Copying to developer list ...

Hi Bob,

I'm not sure you'll know an answer to this, if you don't I'll be happy to
send it to the developers' list. My project is to build a health portal for
the state of Tamil Nadu, but with coding that is generic so that it can be
reused to make portals for other Indian states. The idea is to develop an
interface to allow a user to choose the organisation unit, indicator, and
period and then display data from the DHIS2 Web API according to these
specifications. I'm using cURL to get lists of orgUnits and indicators, but
I would like to be able to take advantage of the orgUnit hierarchy in the
API to allow the user to choose state>>district>>block>>facility, and I'm
not sure how to do that when all of the orgUnits are listed together. Is
there some way that I can specify which level of the hierarchy I would like
to use?

I'm not sure if this is the correct answer but perhaps Morten or Lars
will chip in if they have time. As far as I can see you are right ..
there is no parent field in the listed orgunits at
api/organisationUnits which you would need to construct the hierarchy.

You can get this information however by querying the metadata as a
more complete collection: eg
http://apps.dhis2.org/demo/api/metaData.xml

This will give you the list of orgunits with parent field and also
conveniently in order from top of the tree down to the base (a
breadth-wise traversal). You should be able to construct your
javascript or html UI with this data.

There are also some options to restrict whether *only* orgunits are
shown but I can't remember them offhand. Once I've looked up I'll let
you know.

Cheers
Bob

···

On 28 June 2012 07:01, Alice E Tessen <aet289@nyu.edu> wrote:

Thanks,
Alice

On Wed, Jun 27, 2012 at 5:02 PM, Bob Jolliffe <bobjolliffe@gmail.com> wrote:

Sure. Alice I don't know what you are going to ask or if I have the
answer, but in case I don't. I presume you won't have a problem if I
direct to the dhis2 developers list?

On 27 June 2012 12:27, Sundeep Sahay <sundeep.sahay@yahoo.com> wrote:
> bob,
> alice had some queries on the WebAPI
> can i direct her to you?
> thanks

I'm not sure if this is the correct answer but perhaps Morten or Lars
will chip in if they have time. As far as I can see you are right ..
there is no parent field in the listed orgunits at
api/organisationUnits which you would need to construct the hierarchy.

There should be a parent field there, if not, there is something wrong
(demo is old, so I don't know about that). In general I would suggest
using 2.9 (trunk) for WebAPI development since it contains so many
improvements.

You can get this information however by querying the metadata as a
more complete collection: eg
http://apps.dhis2.org/demo/api/metaData.xml

The same information should be available at:
/api/organisationUnits?viewClass=export
and
/api/metaData?assumeTrue=false&organisationUnits=true

(but not on demo, try dev. Sorry, I can't access the UiO network from
where I am now)

···

--
Morten

This will give you the list of orgunits with parent field and also
conveniently in order from top of the tree down to the base (a
breadth-wise traversal). You should be able to construct your
javascript or html UI with this data.

There are also some options to restrict whether *only* orgunits are
shown but I can't remember them offhand. Once I've looked up I'll let
you know.

Cheers
Bob

Thanks,
Alice

On Wed, Jun 27, 2012 at 5:02 PM, Bob Jolliffe <bobjolliffe@gmail.com> wrote:

Sure. Alice I don't know what you are going to ask or if I have the
answer, but in case I don't. I presume you won't have a problem if I
direct to the dhis2 developers list?

On 27 June 2012 12:27, Sundeep Sahay <sundeep.sahay@yahoo.com> wrote:
> bob,
> alice had some queries on the WebAPI
> can i direct her to you?
> 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

I'm not sure if this is the correct answer but perhaps Morten or Lars
will chip in if they have time. As far as I can see you are right ..
there is no parent field in the listed orgunits at
api/organisationUnits which you would need to construct the hierarchy.

There should be a parent field there, if not, there is something wrong
(demo is old, so I don't know about that). In general I would suggest
using 2.9 (trunk) for WebAPI development since it contains so many
improvements.

demo is old .. there are no parenets. Morten is right. the api is a
bit fast moving at the moment so best to try and follow trunk.

You can get this information however by querying the metadata as a
more complete collection: eg
http://apps.dhis2.org/demo/api/metaData.xml

The same information should be available at:
/api/organisationUnits?viewClass=export
and
/api/metaData?assumeTrue=false&organisationUnits=true

I can confirm this works on dev:
http://apps.dhis2.org/dev/api/organisationUnits.xml?viewClass=export

though I am not seeing any effect of
"assumeTrue=false&organisationUnits=true" on the metaData url.
Probably in trunk. I'll test myself later.

Alice I think viewClass=export might solve your problem. Or is there
something else you are getting at with your question?

Regards
Bob

···

On 28 June 2012 11:10, Morten Olav Hansen <mortenoh@gmail.com> wrote:

(but not on demo, try dev. Sorry, I can't access the UiO network from
where I am now)

--
Morten

This will give you the list of orgunits with parent field and also
conveniently in order from top of the tree down to the base (a
breadth-wise traversal). You should be able to construct your
javascript or html UI with this data.

There are also some options to restrict whether *only* orgunits are
shown but I can't remember them offhand. Once I've looked up I'll let
you know.

Cheers
Bob

Thanks,
Alice

On Wed, Jun 27, 2012 at 5:02 PM, Bob Jolliffe <bobjolliffe@gmail.com> wrote:

Sure. Alice I don't know what you are going to ask or if I have the
answer, but in case I don't. I presume you won't have a problem if I
direct to the dhis2 developers list?

On 27 June 2012 12:27, Sundeep Sahay <sundeep.sahay@yahoo.com> wrote:
> bob,
> alice had some queries on the WebAPI
> can i direct her to you?
> 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

though I am not seeing any effect of
"assumeTrue=false&organisationUnits=true" on the metaData url.
Probably in trunk. I'll test myself later.

Strange, that works fine here locally.. test it out, and let me know

···

--
Morten

Alice I think viewClass=export might solve your problem. Or is there
something else you are getting at with your question?

Regards
Bob

(but not on demo, try dev. Sorry, I can't access the UiO network from
where I am now)

--
Morten

This will give you the list of orgunits with parent field and also
conveniently in order from top of the tree down to the base (a
breadth-wise traversal). You should be able to construct your
javascript or html UI with this data.

There are also some options to restrict whether *only* orgunits are
shown but I can't remember them offhand. Once I've looked up I'll let
you know.

Cheers
Bob

Thanks,
Alice

On Wed, Jun 27, 2012 at 5:02 PM, Bob Jolliffe <bobjolliffe@gmail.com> wrote:

Sure. Alice I don't know what you are going to ask or if I have the
answer, but in case I don't. I presume you won't have a problem if I
direct to the dhis2 developers list?

On 27 June 2012 12:27, Sundeep Sahay <sundeep.sahay@yahoo.com> wrote:
> bob,
> alice had some queries on the WebAPI
> can i direct her to you?
> 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

though I am not seeing any effect of
"assumeTrue=false&organisationUnits=true" on the metaData url.
Probably in trunk. I'll test myself later.

Strange, that works fine here locally.. test it out, and let me know

OK that is fine in trunk, I'm not sure how up to date the war file
is on the dev server.

One small question: before the orgunits were being listed in order
(breadth first tree traversal). This seems to be no longer the case.

Bob

···

On 28 June 2012 11:40, Morten Olav Hansen <mortenoh@gmail.com> wrote:

--
Morten

Alice I think viewClass=export might solve your problem. Or is there
something else you are getting at with your question?

Regards
Bob

(but not on demo, try dev. Sorry, I can't access the UiO network from
where I am now)

--
Morten

This will give you the list of orgunits with parent field and also
conveniently in order from top of the tree down to the base (a
breadth-wise traversal). You should be able to construct your
javascript or html UI with this data.

There are also some options to restrict whether *only* orgunits are
shown but I can't remember them offhand. Once I've looked up I'll let
you know.

Cheers
Bob

Thanks,
Alice

On Wed, Jun 27, 2012 at 5:02 PM, Bob Jolliffe <bobjolliffe@gmail.com> wrote:

Sure. Alice I don't know what you are going to ask or if I have the
answer, but in case I don't. I presume you won't have a problem if I
direct to the dhis2 developers list?

On 27 June 2012 12:27, Sundeep Sahay <sundeep.sahay@yahoo.com> wrote:
> bob,
> alice had some queries on the WebAPI
> can i direct her to you?
> 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

One small question: before the orgunits were being listed in order
(breadth first tree traversal). This seems to be no longer the case.

Ah, yes... I think its only sorted on the way in right now, it got
lost when I did my total rewrite.. will add it soon

···

--
Morten

Bob

--
Morten

Alice I think viewClass=export might solve your problem. Or is there
something else you are getting at with your question?

Regards
Bob

(but not on demo, try dev. Sorry, I can't access the UiO network from
where I am now)

--
Morten

This will give you the list of orgunits with parent field and also
conveniently in order from top of the tree down to the base (a
breadth-wise traversal). You should be able to construct your
javascript or html UI with this data.

There are also some options to restrict whether *only* orgunits are
shown but I can't remember them offhand. Once I've looked up I'll let
you know.

Cheers
Bob

Thanks,
Alice

On Wed, Jun 27, 2012 at 5:02 PM, Bob Jolliffe <bobjolliffe@gmail.com> wrote:

Sure. Alice I don't know what you are going to ask or if I have the
answer, but in case I don't. I presume you won't have a problem if I
direct to the dhis2 developers list?

On 27 June 2012 12:27, Sundeep Sahay <sundeep.sahay@yahoo.com> wrote:
> bob,
> alice had some queries on the WebAPI
> can i direct her to you?
> 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

Hi all,

Thank you for the advice–I think I will use the api/metaData.xml data for my purposes. I get an error with “api/metaData?assumeTrue=false&organisationUnits=true”, and “api/organisationUnits.xml?viewClass=export” seems to only list facilities, and without parent fields. But the metadata file, while massive, looks like it has everything I need. Thanks again!

–Alice

···

On Thu, Jun 28, 2012 at 4:32 PM, Morten Olav Hansen mortenoh@gmail.com wrote:

One small question: before the orgunits were being listed in order

(breadth first tree traversal). This seems to be no longer the case.

Ah, yes… I think its only sorted on the way in right now, it got

lost when I did my total rewrite… will add it soon

Morten

Bob

Morten

Alice I think viewClass=export might solve your problem. Or is there

something else you are getting at with your question?

Regards

Bob

(but not on demo, try dev. Sorry, I can’t access the UiO network from

where I am now)

Morten

This will give you the list of orgunits with parent field and also

conveniently in order from top of the tree down to the base (a

breadth-wise traversal). You should be able to construct your

javascript or html UI with this data.

There are also some options to restrict whether only orgunits are

shown but I can’t remember them offhand. Once I’ve looked up I’ll let

you know.

Cheers

Bob

Thanks,

Alice

On Wed, Jun 27, 2012 at 5:02 PM, Bob Jolliffe bobjolliffe@gmail.com wrote:

Sure. Alice I don’t know what you are going to ask or if I have the

answer, but in case I don’t. I presume you won’t have a problem if I

direct to the dhis2 developers list?

On 27 June 2012 12:27, Sundeep Sahay sundeep.sahay@yahoo.com wrote:

bob,

alice had some queries on the WebAPI

can i direct her to you?

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

Alice it seems (from the symptoms) you are probably working with a
dhis2.8 war file. In which case you are probably correct. You can
get everything from metadata.xml but it is a lot :slight_smile: Though probably
mostly its orgunits which are what you need anyway.

To start using the more refined features you really need to work with
a 2.9 snapshot, which you can either build yourself or download
whatever is latest build from

http://apps.dhis2.org/ci/job/dhis-web-trunk/lastSuccessfulBuild/artifact/dhis-2/dhis-web/dhis-web-portal/target/dhis.war

Note this gets rebuilt frequently.

···

On 29 June 2012 10:36, Alice E Tessen <aet289@nyu.edu> wrote:

Hi all,

Thank you for the advice--I think I will use the api/metaData.xml data for
my purposes. I get an error with
"api/metaData?assumeTrue=false&organisationUnits=true", and
"api/organisationUnits.xml?viewClass=export" seems to only list facilities,
and without parent fields. But the metadata file, while massive, looks like
it has everything I need. Thanks again!

--Alice

On Thu, Jun 28, 2012 at 4:32 PM, Morten Olav Hansen <mortenoh@gmail.com> > wrote:

> One small question: before the orgunits were being listed in order
> (breadth first tree traversal). This seems to be no longer the case.

Ah, yes... I think its only sorted on the way in right now, it got
lost when I did my total rewrite.. will add it soon

--
Morten

> Bob
>
>>
>> --
>> Morten
>>
>>> Alice I think viewClass=export might solve your problem. Or is there
>>> something else you are getting at with your question?
>>>
>>> Regards
>>> Bob
>>>
>>>
>>>> (but not on demo, try dev. Sorry, I can't access the UiO network from
>>>> where I am now)
>>>>
>>>> --
>>>> Morten
>>>>
>>>>> This will give you the list of orgunits with parent field and also
>>>>> conveniently in order from top of the tree down to the base (a
>>>>> breadth-wise traversal). You should be able to construct your
>>>>> javascript or html UI with this data.
>>>>>
>>>>> There are also some options to restrict whether *only* orgunits are
>>>>> shown but I can't remember them offhand. Once I've looked up I'll
>>>>> let
>>>>> you know.
>>>>>
>>>>> Cheers
>>>>> Bob
>>>>>
>>>>>>
>>>>>> Thanks,
>>>>>> Alice
>>>>>>
>>>>>>
>>>>>> On Wed, Jun 27, 2012 at 5:02 PM, Bob Jolliffe >> >>>>>> <bobjolliffe@gmail.com> wrote:
>>>>>>>
>>>>>>> Sure. Alice I don't know what you are going to ask or if I have
>>>>>>> the
>>>>>>> answer, but in case I don't. I presume you won't have a problem if
>>>>>>> I
>>>>>>> direct to the dhis2 developers list?
>>>>>>>
>>>>>>> On 27 June 2012 12:27, Sundeep Sahay <sundeep.sahay@yahoo.com> >> >>>>>>> wrote:
>>>>>>> > bob,
>>>>>>> > alice had some queries on the WebAPI
>>>>>>> > can i direct her to you?
>>>>>>> > 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

_______________________________________________
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

If my memory serves me right, we also supports turning off certains
objects in 2.8, so.. there is no assumeTrue=false, but you can do
organisationUnits=false, dataElements=false, etc..

But as Bob says, unless 2.8 is a requirement, i would stick with trunk / 2.9.

···

--
Morten

On Fri, Jun 29, 2012 at 12:57 PM, Bob Jolliffe <bobjolliffe@gmail.com> wrote:

Alice it seems (from the symptoms) you are probably working with a
dhis2.8 war file. In which case you are probably correct. You can
get everything from metadata.xml but it is a lot :slight_smile: Though probably
mostly its orgunits which are what you need anyway.

To start using the more refined features you really need to work with
a 2.9 snapshot, which you can either build yourself or download
whatever is latest build from

http://apps.dhis2.org/ci/job/dhis-web-trunk/lastSuccessfulBuild/artifact/dhis-2/dhis-web/dhis-web-portal/target/dhis.war

Note this gets rebuilt frequently.

On 29 June 2012 10:36, Alice E Tessen <aet289@nyu.edu> wrote:

Hi all,

Thank you for the advice--I think I will use the api/metaData.xml data for
my purposes. I get an error with
"api/metaData?assumeTrue=false&organisationUnits=true", and
"api/organisationUnits.xml?viewClass=export" seems to only list facilities,
and without parent fields. But the metadata file, while massive, looks like
it has everything I need. Thanks again!

--Alice

On Thu, Jun 28, 2012 at 4:32 PM, Morten Olav Hansen <mortenoh@gmail.com> >> wrote:

> One small question: before the orgunits were being listed in order
> (breadth first tree traversal). This seems to be no longer the case.

Ah, yes... I think its only sorted on the way in right now, it got
lost when I did my total rewrite.. will add it soon

--
Morten

> Bob
>
>>
>> --
>> Morten
>>
>>> Alice I think viewClass=export might solve your problem. Or is there
>>> something else you are getting at with your question?
>>>
>>> Regards
>>> Bob
>>>
>>>
>>>> (but not on demo, try dev. Sorry, I can't access the UiO network from
>>>> where I am now)
>>>>
>>>> --
>>>> Morten
>>>>
>>>>> This will give you the list of orgunits with parent field and also
>>>>> conveniently in order from top of the tree down to the base (a
>>>>> breadth-wise traversal). You should be able to construct your
>>>>> javascript or html UI with this data.
>>>>>
>>>>> There are also some options to restrict whether *only* orgunits are
>>>>> shown but I can't remember them offhand. Once I've looked up I'll
>>>>> let
>>>>> you know.
>>>>>
>>>>> Cheers
>>>>> Bob
>>>>>
>>>>>>
>>>>>> Thanks,
>>>>>> Alice
>>>>>>
>>>>>>
>>>>>> On Wed, Jun 27, 2012 at 5:02 PM, Bob Jolliffe >>> >>>>>> <bobjolliffe@gmail.com> wrote:
>>>>>>>
>>>>>>> Sure. Alice I don't know what you are going to ask or if I have
>>>>>>> the
>>>>>>> answer, but in case I don't. I presume you won't have a problem if
>>>>>>> I
>>>>>>> direct to the dhis2 developers list?
>>>>>>>
>>>>>>> On 27 June 2012 12:27, Sundeep Sahay <sundeep.sahay@yahoo.com> >>> >>>>>>> wrote:
>>>>>>> > bob,
>>>>>>> > alice had some queries on the WebAPI
>>>>>>> > can i direct her to you?
>>>>>>> > 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

_______________________________________________
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