@phildunlap also, a bit off topic, but could you please help me out with some python code to access the REST API, I can successfully login, but any attempt to retrieve data keeps timing out, here is the code I used in python
import requests
import json
s = requests.Session()
s.headers.update({'Accept': 'application/json', 'Content-Length': '39', 'Content-Type': 'application/json;charset=UTF-8','Cookie':'XSRF-TOKEN=74cf354a-e871-48b6-a1c2-bebb93d00120','X-XSRF-TOKEN':'74cf354a-e871-48b6-a1c2-bebb93d00120'});
#Show session headers
#print(s.headers)
js = {'username': "admin", 'password': "admin"}
r = s.post('http://localhost:8080/rest/v2/login', data=json.dumps(js))
#Show headers sent
print( r.request.headers)
# show returned headers
print( r.headers)
##you may need to set your X-Xsrf-Token header from the cookie, if so uncomment next line.
s.headers.update({'X-XSRF-TOKEN' : s.cookies['XSRF-TOKEN']})
#Show Login response JSON
#print( r.text)
##Show all data points
r = s.get('http://localhost:8080/rest/v1/data-points/', timeout=5);
#print( r.text)
the initial login returns the following header
{'Date': 'Tue, 16 May 2017 15:03:52 GMT', 'Set-Cookie': 'MANGO8080=1k38gugobccn4d2nrpfc18f6r;Path=/;HttpOnly, XSRF-TOKEN=e4a452ea-6e47-4a12-8547-202eb0b158d4;Path=/', 'Expires': 'Thu, 01 Jan 1970 00:00:00 GMT', 'X-Mango-Default-URI': '/ui/data-point-details/', 'Content-Type': 'application/json;charset=UTF-8', 'X-Content-Type-Options': 'nosniff', 'X-XSS-Protection': '1; mode=block', 'X-Frame-Options': 'SAMEORIGIN', 'Transfer-Encoding': 'chunked'}
however, the second "s.get" receives the following error message
Traceback (most recent call last):
File "<ipython-input-33-fae73997cd8c>", line 1, in <module>
r = s.get('http://localhost:8080/rest/v1/data-points/', timeout=5);
File "C:\ProgramData\Anaconda3\lib\site-packages\requests\sessions.py", line 501, in get
return self.request('GET', url, **kwargs)
File "C:\ProgramData\Anaconda3\lib\site-packages\requests\sessions.py", line 488, in request
resp = self.send(prep, **send_kwargs)
File "C:\ProgramData\Anaconda3\lib\site-packages\requests\sessions.py", line 609, in send
r = adapter.send(request, **kwargs)
File "C:\ProgramData\Anaconda3\lib\site-packages\requests\adapters.py", line 499, in send
raise ReadTimeout(e, request=request)
ReadTimeout: HTTPConnectionPool(host='localhost', port=8080): Read timed out. (read timeout=5)
On the other hand, if I do it in the browser (after logging in to the web UI), the full list of points is returned.