Swagger 404 errors on /rest/v1/realtime/by-xid/
-
I get the 404 message for all the xids I've tried. None of them meet any of the four criteria you outlined above.
-
Save your point hierarchy.
I played with it, it does seem like it could be more reliable. Is there a benefit to this endpoint over querying for point values or registering for a point value websocket? This I am wondering.
-
The client software being used to make the GET calls is not very flexible, so registering a websocket will be difficult. We can use point-values, but we'll have to change a lot of URLs that used to work with the previous API. Are you implying that you were able to reproduce the problem?
-
I was able to get some 404s when I thought I should get data, but I read the comment in the code and swagger that says,
notes = "Note that recently enabled points will not be available until the point hierarchy is saved.")
which should have been visible in the swagger api. I do see that many things changed in how this endpoint works during 2.5's time (many in April-June of last year). I am not overly familiar with all the aspects of the endpoints, so perhaps I spoke hastily. We will check it out more, as I think you may be right that something is up.
-
Thanks. All the points I've tried to read via the Swagger page were enabled long before I upgraded last year. Since then there have been a number of upgrades or Mango restarts, and the point hierarchy has also been saved numerous times. Therefore the note you quoted is unlikely to be the cause of the errors I've reported.
-
Well, I am getting reliable results. I get the 404 if the data source has been enabled after the point hierarchy has been saved. I also don't get 404 if the datasource is disabled after it was reading (until the PH is saved). Even points in /Root/ are available, it seems, I was incorrect. Points seem to be available if their datasource was enabled at system startup. Otherwise, I am reliably getting a point to read by enabling its data source and saving the point hierarchy. You also must have read permission, but I am sure you are admin.
-
Thanks, Phillip. The person using swagger stated that he was able to get past this hurdle by making changes to the GET header. He is still working on getting PUT to work to write values. Both worked under ma-core 2.5.2. Do you have any sample scripts, preferably in python or php, that you can post online for your users, so we can start with working examples with the proper headers and XSRF token handling for reading and writing point values? Things were much easier before the security upgrades.
-
#!/usr/bin/python import requests s = requests.Session() s.headers.update({'Accept': 'application/json', 'Accept-Encoding': 'gzip,deflate,sdch', 'password': 'admin'}); #Show session headers print s.headers r = s.get('http://192.168.1.46/rest/v1/login/admin'); #r = s.get('http://localhost:8080/rest/v1/login/admin'); #Show headers sent print r.request.headers #Show Login response JSON print r.text #Remove password from headers s.headers.update({'Accept': 'application/json', 'Accept-Encoding': 'gzip,deflate,sdch'}); #Show all data points r = s.get('http://192.168.1.46/rest/v1/data-points'); print r.text
The above Python script makes use of Requests
-
Thanks, Woody. I think this would be useful to have in the wiki.
-
I totally agree Pedro and I plan to it to the wiki as soon as I can. I also plan to have one for PHP as well. If anyone out there would like to share a PHP version please feel free contribute to this thread.
Thanks