← Back to team overview

dhis2-users team mailing list archive

Re: difficuties to obtain dataelements from oganisation units through the api....

 

For just a single type, in this case organisation unit, you can go straight
to the resource instead:

<server>/api/organisationUnit/vzw0YutAWos.json

To control which fields you want to display, you can use the *fields*
parameter,
e.g:

<server>/api/organisationUnit/vzw0YutAWos.json?fields=id,name,contactPerson

On Mon, Oct 13, 2014 at 3:05 PM, Knut Staring <knutst@xxxxxxxxx> wrote:

> Hi Stephane,
> You should not use the Analytics API to get metadata.
>
> Try this instead:
> https://www.dhis2.org/doc/snapshot/en/developer/html/ch01s05.html
>
> Knut
>
> On Mon, Oct 13, 2014 at 7:32 PM, Stéphane Delbeke <sdelbeke@xxxxxxxxxxxxxx
> > wrote:
>
>> Hi,
>>
>> I'm trying to use the API to get information on an organisation unit.
>> For instance i'm trying to extract the 'contact name'.
>> My request looks as follow:
>>
>>
>> ...dhis/api/analytics?dimension=dx:IBRoBwdUxkA&dimension=pe:2012&dimension=ou:vzw0YutAWos
>>
>> and i obtain an answer like this:
>>  {"headers":[{"name":"dx","column":"Data","type":"java.lang.String","hidden":false,"meta":true},{"name":"pe","column":"Period","type":"java.lang.String","hidden":false,"meta":true},{"name":"ou","column":"Organisation
>> unit","type":"java.lang.String","hidden":false,"meta":true},{"name":"value","column":"Value","type":"java.lang.Double","hidden":false,"meta":false}],"metaData":{"pe":["2012"],"co":[],"ou":["vzw0YutAWos"],"names":{"pe":"Period","ou":"Organisation
>> unit","dx":"Data","IBRoBwdUxkA":"Nom et prénoms
>> contact","2012":"2012","vzw0YutAWos":"MUTUELLE DE SANTE DE
>> BANIKOARA"}},"height":0,"rows":[],"width":0}
>>
>> with rows being empty...
>>
>> I can get dataelements with a numeric value. Is there something specific
>> with datalements that have to return strings ?
>> Any idea what i am doing wrong ?
>>
>> Thanks,
>>
>> Stephane
>>
>>
>>
>>
>>
>>
>> _______________________________________________
>> 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
>>
>>
>
>
> --
> Knut Staring
> Dept. of Informatics, University of Oslo
> +4791880522
> Skype: knutstar
> http://dhis2.org
>
> _______________________________________________
> 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
>
>

References