Hello,
I am trying to use the API to get the historic data for my sensors. When using the webapp this is the URL
[server]/historicdata_html.htm?id=2244&sdate=2017-07-01-00-00-00&edate=2017-07-31-23-59-00&avg=86400&pctavg=300&pctshow=false&pct=95&pctmode=false
So for my API call I am using: [server]/api/historicdata.json?id=2244&sdate=2017-07-01-00-00-00&edate=2017-07-31-23-59-00&avg=86400
however from the API I am getting this response:
<prtg> <version>17.2.31.2018</version> <error>Sorry, the selected object cannot be used here.</error> </prtg>
whereas the webapp is working perfectly.
Any suggestions would be greatly appreciated!
Article Comments
Hi,
Yes xml/csv do give me a response. however, both download a file and I need to consume the data in a web app so json is definitely preferable.
Thanks for your assistance
Aug, 2017 - Permalink
Stephen, I just tried the
/api/historicdata.json?id=objectid&avg=0&sdate=2017-01-20-00-00-00&edate=2017-01-21-00-00-00&usecaption=1
call on a .33 stable release and a .34 canary release, and on both it did work and produce a proper JSON file with historic data. Can you please run the update on your PRTG? It should then work just as well.
Aug, 2017 - Permalink
Hello,
Thank you for the KB-Post. Just to check, does it work when calling the historicdata.xml or historicdata.csv function instead?
best regards
Aug, 2017 - Permalink