Logic Machine Forum
How are get trends list and them data via HTTP request? - Printable Version

+- Logic Machine Forum (https://forum.logicmachine.net)
+-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1)
+--- Forum: Visualization (https://forum.logicmachine.net/forumdisplay.php?fid=9)
+--- Thread: How are get trends list and them data via HTTP request? (/showthread.php?tid=676)



How are get trends list and them data via HTTP request? - zebox - 16.03.2017

Hi,

I developing some web-service and it need get trends  list from LM via HTTP request.
How can I get trends list and them data as json object via HTTP request using POST or GET?


RE: How are get trends list and them data via HTTP request? - admin - 16.03.2017

Only via admin interface: http://LM_IP/scada-main/trends/main


RE: How are get trends list and them data via HTTP request? - zebox - 16.03.2017

(16.03.2017, 13:40)admin Wrote: Only via admin interface: http://LM_IP/scada-main/trends/main

Yes! I use it URL, but I can't get list of trends as json objects.  I get only values of each trends separately(.


RE: How are get trends list and them data via HTTP request? - admin - 16.03.2017

To get trend data, you have to call fetch instead of main.


RE: How are get trends list and them data via HTTP request? - zebox - 16.03.2017

(16.03.2017, 14:23)admin Wrote: To get trend data, you have to call fetch instead of main.

If I request fetch I get error message: 

Code:
Error: /lib/genohm-scada/web/trends/fetch.lua:0: attempt to index a nil value

Which are parameters need to add to POST or GET request for the url ("http://LM-IP/scada-main/trends/fetch") if I need get list of trends?

I add followoing parameters to POST request for get values of trend 


Code:
data:"{"dates_curr":{"start":{"year":2017,"day":1,"month":3},"end":{"year":2017,"day":17,"month":3}},"id":14,"dates_prev":{"start":{"year":2017,"day":16,"month":3},"end":{"year":2017,"day":17,"month":3}}}"
where "id" - the id of some trend

But I don't know which parameters using for get list of all trends in a system.


RE: How are get trends list and them data via HTTP request? - admin - 16.03.2017

To get a list of trends you need to send GET request to http://LM_IP/scada-main/trends/main


RE: How are get trends list and them data via HTTP request? - zebox - 16.03.2017

(16.03.2017, 16:41)admin Wrote: To get a list of trends you need to send GET request to http://LM_IP/scada-main/trends/main

Great! It is what I wanted!
Thank you very much!!!