I am trying to pull data using this string

https://jada/api/historicdata.xml?id=2325&avg=86400&sdate=2011-04-12-00-00-00&edate=2011-04-12-23-59-00

and I get this

  <?xml version="1.0" encoding="UTF-8" ?> 
- <histdata>
  <prtg-version>8.3.0.2022</prtg-version> 
- <item>
  <datetime>4/11/2011 12:00:00 AM</datetime> 
  <datetime_raw>40645.1666666667</datetime_raw> 
  <coverage>0 %</coverage> 
  <coverage_raw>0000000000</coverage_raw> 
  </item>
  </histdata>

Which does note match up if I use the web interface

  <?xml version="1.0" encoding="UTF-8" ?> 
- <histdata>
  <prtg-version>8.3.0.2022</prtg-version> 
- <item>
  <datetime>04/12/2011</datetime> 
  <datetime_raw>40646.1666666667</datetime_raw> 
  <value>9,993,296 KByte</value> 
  <value_raw>10233135437.0000</value_raw> 
  <value>948 kbit/s</value> 
  <value_raw>118448.4996</value_raw> 
  <value>3,398,224 KByte</value> 
  <value_raw>3479781826.0000</value_raw> 
  <value>322 kbit/s</value> 
  <value_raw>40278.4600</value_raw> 
  <value>6,595,072 KByte</value> 
  <value_raw>6753353611.0000</value_raw> 
  <value>625 kbit/s</value> 
  <value_raw>78170.0396</value_raw> 
  <value>0 %</value> 
  <value_raw>0.0000</value_raw> 
  <coverage>100 %</coverage> 
  <coverage_raw>0000009999</coverage_raw> 
  </item>
  </histdata>

Looked at the API documents and I am not sure what the problem is.


Article Comments

Hello,

which URL is used when you "produce" the historic data with the Webinterface? There should be a difference.

best regards.


Apr, 2011 - Permalink

From the menu sensors -> View historical data. I expect that these should produce the same data set. My objective is to get the xml of the device for the day specified.

Thanks


Apr, 2011 - Permalink

Do you get the same data when using a smaller average (1 hour) for example?


Apr, 2011 - Permalink

When I use a smaller range the data is as expected. The output matches. If I offset the the start date by 1 hour and the end date by 1 hour I get the data that is close to what I expect.

https://jada/api/historicdata.xml?id=2325&avg=86400&sdate=2011-04-12-01-00-00&edate=2011-04-13-00-00-00-00

Using the web page I get 100% of the data compared to using the url which gives me 96% of the data.


Apr, 2011 - Permalink

Please make sure you use the right time notation. To include an entire day (until midnight) into the query, please use 24-00-00 as hour definition in your date range.

For example, try

https://jada/api/historicdata.xml?id=2325&avg=86400&sdate=2011-04-12-01-00-00&edate=2011-04-13-00-24-00-00

This will result in exactly the same XML files, no matter if queried via web interface (Historic Data tab) or the API functions.


Apr, 2011 - Permalink