JSON time format

I want to extract data from emoncms using the JSON feed http://emoncms.org/feed/data.json?id=0&start=&end=&interval=

I couldn't find any documentation that told me what format the start and end dates should be in, or what the interval value is (seconds, days, etc).

If I've just missed the documentation, could someone just point me in the right direction?

Thanks,

Allen

chaveiro's picture

Re: JSON time format

Start and End are milliseconds since unix epoh, interval in seconds, skipmissing and limitinterval is 0 or 1.

AllenConquest's picture

Re: JSON time format

Hi Chaverio,

I'm still having problems. I would have thought something like this would return data:

http://emoncms.org/feed/data.json?id=26295&start=1438584624&end=1438584676

but I'm just getting [] in the browser, when I expected a JSON output (that feed is Vrms).

Any thoughts?

Thanks,

Allen

AllenConquest's picture

Re: JSON time format

Okay, I wasn't using milliseconds. This now works:

http://emoncms.org/feed/data.json?id=26295&start=1438582461000&end=14385...

It would be nice to know if this is documented anywhere.

pb66's picture

Re: JSON time format

It might also be more intuitive to adapt emoncms to accept a value in seconds, it's a more widely used standard and I doubt very much any users actually need that level of granularity.

Paul

borpin123's picture

Re: JSON time format

I think milliseconds may be used as flot expects time in milliseconds.

Trying to use this on a local install.

192.168.x.x/emoncms/feed/data.json?id=4&start=1440546961000&end=1440546961000&dp=10

just returns false.  I have checked there is data there.  Running v8.4.0

Is there any API documentation outlining each element other than the examples?

borpin123's picture

Re: JSON time format

As a matter of interest, if I use http://192.168.x.x/emoncms/feed/list.json, the time is returned in seconds (10 digits).

pb66's picture

Re: JSON time format

192.168.x.x/emoncms/feed/data.json?id=4&start=1440546961000&end=1440546961000&dp=10

Is this a typo? the start and end times are the same, so there cannot be any datapoints between them.

Flot does use milliseconds, but that shouldn't mean the user needs to input in ms, the time format should be uniform thoughout emoncms, multiplying the number input by the user by 1000 should be simple enough to implement in the code to avoid confusion,

Paul

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.