• 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/

    User help
    3
    12
    3.8k
    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.
    • P
      Pedro
      last edited by Pedro

      When using Swagger to obtain a real time datapoint value, I enter DP_myPoint in the xid field, swagger returns Request URL
      https://myserver:443/rest/v1/realtime/by-xid/DP_myPoint

      However, it also returns Response Code 404

      Response headers:

      {
        "Date": "Wed, 23 Mar 2016 19:17:28 GMT",
        "X-Content-Type-Options": "nosniff",
        "X-Xss-Protection": "1; mode=block",
        "Cache-Control": "no-cache, no-store, max-age=0, must-revalidate",
        "Pragma": "no-cache",
        "Expires": "0",
        "Strict-Transport-Security": "max-age=31536000 ; includeSubDomains",
        "X-Frame-Options": "SAMEORIGIN",
        "Errors": "Point doesn't exist or is not enabled.",
        "Content-Length": "0",
        "Server": "Jetty(9.2.12.v20150709)"
      }
      

      The trouble is that I know the point is valid and enabled, and the page https://myserver/data_point_details.shtm?dpxid=DP_myPoint displays with no problem under the same user name. I am able to see the user list using the Swagger API in the same login session. Nothing is seen in ma.log during this swagger request.

      I tried GET /v1/data-points , which caused Firefox to become unresponsive for at least one minute, but as expected it eventually returned a list of over 1000 points, again in the same session. Chromium also becomes unresponsive during that request.

      I am using ma-core 2.7.10. This is the first time I've tried swagger since 2.5.2 late last year. I presume the XSRF token issues would not cause a 404. What else has changed?

      I also tried GET /v1/server/timezones via swagger, and two consecutive errors were immediately seen in ma.log:

      2016-03-23 16:09:40,297 ERROR (com.serotonin.m2m2.web.mvc.rest.v1.exception.RestExceptionHandler.handleMangoError:58) -   
      java.lang.NullPointerException 
      	at com.serotonin.m2m2.web.mvc.rest.v1.ServerRestController.queryTimezone(ServerRestController.java:79) 
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 
      	at java.lang.reflect.Method.invoke(Method.java:497) 
      	at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:221) 
      	at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:137) 
      	at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:110) 
      	at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:806) 
      	at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:729) 
      	at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85) 
      	at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:959) 
      	at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:893) 
      	at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970) 
      	at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:861) 
      	at javax.servlet.http.HttpServlet.service(HttpServlet.java:687) 
      	at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846) 
      	at javax.servlet.http.HttpServlet.service(HttpServlet.java:790) 
      	at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:808) 
      	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1669) 
      	at org.eclipse.jetty.servlets.UserAgentFilter.doFilter(UserAgentFilter.java:83) 
      	at org.eclipse.jetty.servlets.GzipFilter.doFilter(GzipFilter.java:364) 
      	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652) 
      	at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:85) 
      	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) 
      	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652) 
      	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:316) 
      	at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:126) 
      	at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:90) 
      	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330) 
      	at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:114) 
      	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330) 
      	at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:122) 
      	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330) 
      	at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:111) 
      	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330) 
      	at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:169) 
      	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330) 
      	at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:48) 
      	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330) 
      	at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:120) 
      	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330) 
      	at com.serotonin.m2m2.web.mvc.spring.security.CsrfHeaderFilter.doFilterInternal(CsrfHeaderFilter.java:41) 
      	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) 
      	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330) 
      	at org.springframework.security.web.csrf.CsrfFilter.doFilterInternal(CsrfFilter.java:96) 
      	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) 
      	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330) 
      	at org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:64) 
      	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) 
      	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330) 
      	at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:91) 
      	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330) 
      	at org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:53) 
      	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) 
      	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330) 
      	at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:213) 
      	at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:176) 
      	at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346) 
      	at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:262) 
      	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652) 
      	at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:585) 
      	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143) 
      	at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:577) 
      	at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:223) 
      	at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1127) 
      	at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:515) 
      	at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185) 
      	at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1061) 
      	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141) 
      	at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:215) 
      	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97) 
      	at org.eclipse.jetty.server.Server.handle(Server.java:499) 
      	at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:310) 
      	at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:257) 
      	at org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:540) 
      	at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:635) 
      	at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:555) 
      	at java.lang.Thread.run(Thread.java:745) 
      2016-03-23 16:09:40,304 ERROR (com.serotonin.m2m2.web.mvc.rest.v1.exception.RestExceptionHandler.handleExceptionInternal:80) -   
      java.lang.NullPointerException 
      	at com.serotonin.m2m2.web.mvc.rest.v1.ServerRestController.queryTimezone(ServerRestController.java:79) 
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 
      	at java.lang.reflect.Method.invoke(Method.java:497) 
      	at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:221) 
      	at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:137) 
      	at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:110) 
      	at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:806) 
      	at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:729) 
      	at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85) 
      	at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:959) 
      	at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:893) 
      	at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970) 
      	at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:861) 
      	at javax.servlet.http.HttpServlet.service(HttpServlet.java:687) 
      	at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846) 
      	at javax.servlet.http.HttpServlet.service(HttpServlet.java:790) 
      	at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:808) 
      	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1669) 
      	at org.eclipse.jetty.servlets.UserAgentFilter.doFilter(UserAgentFilter.java:83) 
      	at org.eclipse.jetty.servlets.GzipFilter.doFilter(GzipFilter.java:364) 
      	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652) 
      	at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:85) 
      	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) 
      	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652) 
      	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:316) 
      	at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:126) 
      	at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:90) 
      	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330) 
      	at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:114) 
      	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330) 
      	at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:122) 
      	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330) 
      	at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:111) 
      	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330) 
      	at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:169) 
      	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330) 
      	at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:48) 
      	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330) 
      	at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:120) 
      	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330) 
      	at com.serotonin.m2m2.web.mvc.spring.security.CsrfHeaderFilter.doFilterInternal(CsrfHeaderFilter.java:41) 
      	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) 
      	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330) 
      	at org.springframework.security.web.csrf.CsrfFilter.doFilterInternal(CsrfFilter.java:96) 
      	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) 
      	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330) 
      	at org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:64) 
      	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) 
      	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330) 
      	at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:91) 
      	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330) 
      	at org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:53) 
      	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) 
      	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330) 
      	at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:213) 
      	at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:176) 
      	at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346) 
      	at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:262) 
      	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652) 
      	at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:585) 
      	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143) 
      	at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:577) 
      	at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:223) 
      	at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1127) 
      	at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:515) 
      	at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185) 
      	at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1061) 
      	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141) 
      	at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:215) 
      	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97) 
      	at org.eclipse.jetty.server.Server.handle(Server.java:499) 
      	at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:310) 
      	at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:257) 
      	at org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:540) 
      	at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:635) 
      	at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:555) 
      	at java.lang.Thread.run(Thread.java:745) 
      

      The response from the above request is Response Code 500

      Response Headers:

      {
        "Date": "Wed, 23 Mar 2016 20:09:40 GMT",
        "X-Content-Type-Options": "nosniff",
        "X-Xss-Protection": "1; mode=block",
        "Cache-Control": "no-cache, no-store, max-age=0, must-revalidate",
        "Pragma": "no-cache",
        "Expires": "0",
        "Strict-Transport-Security": "max-age=31536000 ; includeSubDomains",
        "X-Frame-Options": "SAMEORIGIN",
        "Messages": "error",
        "Content-Type": "application/json; charset=UTF-8",
        "Transfer-Encoding": "chunked",
        "Server": "Jetty(9.2.12.v20150709)"
      }
      
      1 Reply Last reply Reply Quote 0
      • phildunlapP
        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
          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
            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
              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
                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
                  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
                    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
                      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
                        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
                          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
                            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