• 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

    Can I get data back to my device using HTTP?

    Mango Automation general Discussion
    4
    14
    3.4k
    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.
    • V
      v8dave
      last edited by

      I have a remote device that is using GPRS to send the data to Mango and I am using HTTP for this. It works great and has been running reliably for 6 months on trial now.

      Using HTTP I am only able to send data to the Mango server but I want to be able to read settings on Mango such as ON/OFF states and time settings etc. Is this possible with an HTTP request?

      I can't initiate anything from the server as the device has no visible IP address. I have considered making a permanent connection to the sever similar to how push email works and send data down that but don't see how to do this at present. I can open the connection form the device but I don't see anything in Mango that allows me to send to the device.

      1 Reply Last reply Reply Quote 0
      • Jared WiltshireJ
        Jared Wiltshire
        last edited by

        If I am following you correctly, you wish to connect to the Mango server using HTTP and read binary point values and the current time? You should be able to use the REST API for this, there isn't a endpoint for time settings but you can read the latest timestamp of a point value.

        Developer at Radix IoT

        1 Reply Last reply Reply Quote 0
        • V
          v8dave
          last edited by

          I want to be able to read binary and analog data. What I am trying to do is control a motor at the remote location from Mango. I also want to be able to send the speed setting (frequency) for the drive. Time stamp I don't need as I get this from the Internet.

          1 Reply Last reply Reply Quote 0
          • Jared WiltshireJ
            Jared Wiltshire
            last edited by

            So what you are proposing is to set up a virtual datapoint that you can set to 0 or 1 to start or stop the drive and another numeric datapoint which you will set to control the speed of the drive? That should work. You can poll /rest/v1/point-values/POINT_XID/latest?limit=1 to get the latest point value.

            What are you going to be using to read the point value and send it to the drive?

            Developer at Radix IoT

            1 Reply Last reply Reply Quote 0
            • V
              v8dave
              last edited by

              Excellent Jared. That worked. I tried it in the browser and I could get the data back from Mango. Now I can code on the remote device to poll this data.

              I have a custom built data logger running NETMF and this will poll the data over the GPRS connection.

              1 Reply Last reply Reply Quote 0
              • Jared WiltshireJ
                Jared Wiltshire
                last edited by

                Great. The only issue you may have is authentication, the current Mango authentication is all session cookie based. You will have to make sure your HTTP client can handle cookies. You can find the REST end points for logging in in the Swagger documentation, change your env.properties so that swagger.enabled=true and navigate to /swagger/index.html

                Mango 2.8 will support token based authentication for the REST API.

                Developer at Radix IoT

                1 Reply Last reply Reply Quote 0
                • V
                  v8dave
                  last edited by

                  Ah, that might be a bit of a problem. There is no cookie capability as this does not have a proper browser.

                  I tried it on a browser that was not logged in and sure enough, I got an access denied message.

                  Is it possible to use some form of API key or other method to do this?

                  1 Reply Last reply Reply Quote 0
                  • Jared WiltshireJ
                    Jared Wiltshire
                    last edited by

                    Nope, at the moment session cookies are the only supported authentication mechanism. 2.8 will have token authentication.

                    I'm not familiar with NETMF but even if it doesn't support cookies you should be able to manually read the Set-Cookie header when you login and send it back in the Cookie header with each request.

                    Developer at Radix IoT

                    1 Reply Last reply Reply Quote 0
                    • V
                      v8dave
                      last edited by

                      OK. I'll check out how to do this.

                      1 Reply Last reply Reply Quote 0
                      • JoelHaggarJ
                        JoelHaggar
                        last edited by

                        Here is a link to some documentation about how authentication works which should be helpful:
                        https://help.infiniteautomation.com/support/solutions/articles/14000023292-mango-rest-api-authentication

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

                          @v8dave
                          Does your device support Python by chance or some other scripting language?

                          -WoodyB

                          1 Reply Last reply Reply Quote 0
                          • V
                            v8dave
                            last edited by

                            Hi Woody, the unit is programmed with C# using .NET Micro Framework running a custom board with the GHI Electronics G400D module.

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

                              Hmmm, well the C# path may lead you somewhere. Then again, it could be down a rabbit hole I suppose.

                              -WoodyB

                              1 Reply Last reply Reply Quote 0
                              • V
                                v8dave
                                last edited by

                                I should be able to do this one I figure out how to login from the device using TCP/IP. I have a full implementation of the TCP/IP stack on this device. I can then extract the cookie and use this to send back with the request.

                                It's just another level of coding I need to add. At present I send HTTP without doing any logging in.

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