← Back to team overview

dhis2-devs team mailing list archive

Re: Hello, can you help me with a query with web api.

 

Hi Sushil,

The API does not have extensive support for daily data yet. There are no
relative periods for days, so you have to list them each explicitly, using
the yyyyMMdd format:
http://www.dhis2.org/doc/snapshot/en/user/html/ch25s03.html

Unfortunately, I think this means you cannot get daily data for a whole
year in one query, because the URL would be more than 9*365 (over 3000)
characters long. So you would probably have to split it.

I agree that for daily data (what is the use case?), start and end date
would be much more convenient. But you could build that logic in the
javascript that constructs the query URL.

Knut




On Tue, Oct 1, 2013 at 12:20 PM, Lars Helge Øverland <larshelge@xxxxxxxxx>wrote:

> Thanks Namrata for the good explanation.
>
> Sushil, you cannot use start and end dates for the /analytics resource,
> you must use the standard period types (frequencies) as described here<http://www.dhis2.org/doc/snapshot/en/user/html/ch25s03.html>.
> Note that you can define fixed and relative periods in your query. Docs
> here:
>
> http://www.dhis2.org/doc/snapshot/en/user/html/ch25s21.html
>
> Lars
>
>
> On Mon, Sep 30, 2013 at 6:52 PM, Namrata Nehete <n.nehete@xxxxxxxxx>wrote:
>
>> Hi,
>>
>> To get data for relative period (last week, last month etc) we use,
>>
>> http://
>> <serverURL>/api/analytics.json?dimension=dx:Uvn6LCg7dVU&dimension=pe:LAST_WEEK&filter=ou:ImspTQPwCqd
>>
>> To get data by specifying period we use,
>>
>> http://
>> <serverURL>/api/analytics.json?dimension=dx:Uvn6LCg7dVU&dimension=pe:20130924;20130930&filter=ou:ImspTQPwCqd
>>
>> I am not sure how to get data for indicator by specifying start date and
>> end date.
>>
>> You should ask on dev list for that.
>>
>> ---
>> Regards,
>> Namrata Nehete.
>>
>>
>> On Mon, Sep 30, 2013 at 3:54 PM, Knut Staring <knutst@xxxxxxxxx> wrote:
>>
>>> Hi Sushil,
>>>
>>> Remember you can also ask such questions on the dev list (are you a
>>> member)?
>>>
>>> DHIS 2 developers <dhis2-devs@xxxxxxxxxxxxxxxxxxx>
>>>
>>> Knut
>>>
>>>
>>>
>>>
>>> On Mon, Sep 30, 2013 at 11:32 AM, Sushil Chitrakar <
>>> sushilchitr@xxxxxxxxx> wrote:
>>>
>>>> Hello Namrata, I hope you are all doing well.
>>>>
>>>> I was going though a issue in api checking if you know the solution.
>>>>
>>>>
>>>> I was trying to get data for couple of indicators on the daily basis
>>>> from a startdate to a enddate or say a yearly data for a whole year daily
>>>> basis.
>>>>
>>>> I tried putting StartDate and enddate and chekced the daily parameter
>>>> as well.
>>>>
>>>> But was not help, can you give a example for this if you have one or
>>>> suggest me a solution.
>>>>
>>>> Let me know.
>>>>
>>>> Regards,
>>>> Sushil
>>>>
>>>
>>>
>>>
>>> --
>>> Knut Staring
>>> Dept. of Informatics, University of Oslo
>>> +4791880522
>>> http://dhis2.org
>>>
>>
>>
>> _______________________________________________
>> 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
>>
>>
>


-- 
Knut Staring
Dept. of Informatics, University of Oslo
+4791880522
http://dhis2.org

Follow ups

References