Please Note This forum exists for community support for the Mango product family and the Radix IoT Platform. Although Radix IoT employees participate in this forum from time to time, there is no guarantee of a response to anything posted here, nor can Radix IoT, LLC guarantee the accuracy of any information expressed or conveyed. Specific project questions from customers with active support contracts are asked to send requests to support@radixiot.com.
REST API access custom software
-
Hi all,
We are developping an application for a client to fetch some datas on a custom dashboard. We use the REST API to get the data values but we are facing an error:
<html><\n><head><\n><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/><\n><title>Error 406 Not Acceptable</title><\n></head><\n><body><h2>HTTP ERROR 406</h2><\n><p>Problem accessing /rest/v1/login/admin. Reason:<\n><pre> Not Acceptable</pre></p><hr><i><small>Powered by Jetty://</small></i><hr/><\n><\n></body><\n></html><\n>
we tested to change the headers / application/json , ...
We tried with the swagger and all OK / if we're not logged in we receive a 401 error..
Is the header the problem or do we need to add the distant ip addresses? In which file?
Thanks in advance for your answer
Best regards
-
Hey,
Same issue. (maybe others as well)
Login issues: ( i'm using the python requests module btw)
The response I'm getting for an invalid login is as follows: ( I replaced dates and stuff with '...' for brevity)
response code 406 {'content-length': '0', 'errors': 'Invalid login', 'set-cookie': '...;Path=/', 'expires': '...', 'messages': '', 'server': 'Jetty(...)', 'date': '...'}Here's what I get for an accepted one: (Well, I think its accepted. )
response code 406 {'date': '...', 'set-cookie': '...Path=/', 'content-length': '0', 'expires': '...', 'server': 'Jetty(...)'}This is what I get when I query a data point when it says 'Invalid login'
response code 401 {'date': '...', 'content-length': '0', 'errors': 'User not logged in', 'messages': '', 'server': 'Jetty(...)'}And this for what I think is accepted:
response code 406 {'date': '...', 'content-length': '0', 'server': 'Jetty(...)'}
no data and still have the 406 (not acceptable error) code.The kicker is, if i login to my mango through the browser, then open up a new tab and paste the url my request library generates, the data pops up on the screen just fine.
here's the link i used
http://.../rest/v1/point-values/DP_363530?from=2015-10-29T00%3A00%3A00.000-10%3A00&timePeriodType=MINUTES&timePeriods=0&useRendered=False&rollup=&to=2015-10-29T23%3A59%3A59.999-10%3A00&unitConversion=FalseI'm not even sure if this is a login, configuration, or auth type problem. ( ive tried both basic auth and digest the results here are from basic)
What makes it harder to diagnose is that I get the same errors with the swagger docs page. Even when logged in. But if i paste the url the docs page generates and paste it into the browser , the data pops right up.Any ideas?
-
I have not used the REST API myself yet so this is a bit of a shot in the dark, but are you making the requests from a different server? If so then maybe you need to read this post by terrypacker here: http://infiniteautomation.com/forum/topic/1944/mango-rest-api-special-key
-
Jeremy,
Thanks a bunch, once, i figured out the whole CORS thing, and got the server to start back up, it works perfect. Just a warning for anyone else working on this, make sure don't leave anything in the override-web.xml file thats not xml. if you don't get the syntax right, your mango server won't start back up. It will start, then auto-terminate on a NullPointerException.