• Recent
    • Tags
    • Popular
    • Register
    • Login

    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.

    Radix IoT Website Mango 3 Documentation Website Mango 4 Documentation Website Mango 5 Documentation Website

    Swagger 404 errors on /rest/v1/realtime/by-xid/

    Scheduled Pinned Locked Moved User help
    12 Posts 3 Posters 4.0k Views 3 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • phildunlapP Offline
      phildunlap
      last edited by phildunlap

      Hi Pedro,

      Thanks for bringing the timezone endpoint to our attention. I'm sure we'll be doing lots of validation and speed work on the API in the coming months. Some of the urls have a known issue where you can only query their nested endpoints, but I'm not sure that's what's going on in your example.

      As to the 404, that status codes for that endpoing are somewhat misleading perhaps. You can get it if 1) your data point is disabled, 2) your data point is recently enabled and your point hierarchy hasn't refreshed yet, 3) your point is still in the /Root/ of the point hierarchy or 4) your point does not have any values.

      The 'realtime' stuff had its origins in bringing in a live table to DGLux. That DGLux dependency is probably why the point hierarchy affects the behavior of that endpoint.

      1 Reply Last reply Reply Quote 0
      • P Offline
        Pedro
        last edited by

        I get the 404 message for all the xids I've tried. None of them meet any of the four criteria you outlined above.

        1 Reply Last reply Reply Quote 0
        • phildunlapP Offline
          phildunlap
          last edited by

          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.

          1 Reply Last reply Reply Quote 0
          • P Offline
            Pedro
            last edited by

            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?

            1 Reply Last reply Reply Quote 0
            • phildunlapP Offline
              phildunlap
              last edited by phildunlap

              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.

              1 Reply Last reply Reply Quote 0
              • P Offline
                Pedro
                last edited by

                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.

                1 Reply Last reply Reply Quote 0
                • phildunlapP Offline
                  phildunlap
                  last edited by phildunlap

                  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.

                  1 Reply Last reply Reply Quote 0
                  • P Offline
                    Pedro
                    last edited by

                    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.

                    Woody BeverleyW 1 Reply Last reply Reply Quote 0
                    • Woody BeverleyW Offline
                      Woody Beverley @Pedro
                      last edited by Woody Beverley

                      @Pedro

                      #!/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

                      -WoodyB

                      1 Reply Last reply Reply Quote 0
                      • P Offline
                        Pedro
                        last edited by

                        Thanks, Woody. I think this would be useful to have in the wiki.

                        1 Reply Last reply Reply Quote 0
                        • Woody BeverleyW Offline
                          Woody Beverley
                          last edited by Woody Beverley

                          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

                          -WoodyB

                          1 Reply Last reply Reply Quote 0
                          • First post
                            Last post