• 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

    How to negotiate a Plain text response from Mango 3.6 Rest API

    User help
    3
    18
    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.
    • raylatbasixR
      raylatbasix
      last edited by raylatbasix

      Thanks Phil,

      I was able to get it to compile by switching to the C:\Mango356\web\modules\mangoApi\lib directory, and then use the following command:

      javac -cp C:\Mango356\lib\*;C:\Mango356\web\modules\mangoApi\lib\* CustomizedRestController.java
      

      I then copied the CustomizedRestController.class file that was created, to the C:\Mango356\web\modules\mangoApi\lib\com\infiniteautomation\mango\rest\v2 directory.

      I then ran jar uf mango-api-3.6.0.jar com/infiniteautomation/mango/rest/v2/CustomizedRestController.class and did not recieve any errors at all. I then restarted Mango, and went into swagger, but fail to see any URL path t o access this custom endpoint. I tried accessing: http://localhost:8080/rest/v2/custom/latest-value-only/DP_059c7915-c0e7-48dc-b9e3-28ca8b92da01?fields=VALUE&limit=1&useCache=NONE but got a "page not found" error. Again, thanks for all the help!

      1 Reply Last reply Reply Quote 0
      • raylatbasixR
        raylatbasix
        last edited by

        Hi Phil,

        Nevermind! Apparently the command:

        jar uf mango-api-3.6.0.jar com/infiniteautomation/mango/rest/v2/CustomizedRestController.class
        

        did not actually take the first time. I think Mango was running by mistake, when I ran it the first time.

        It's actually all working now, and I see the plain text data that I need for my application!!

        Brilliant as always Phil!!

        Thanks again!!

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

          :D Glad to hear it, I was trying to figure out what could have gone awry as I had tested it before posting!

          Happy hacking!

          1 Reply Last reply Reply Quote 0
          • raylatbasixR
            raylatbasix
            last edited by

            On a side note to this application, When I use this Rest URL from my third-party app on the same network, Will I recieve any authentication challenges "Auth Tokens" before Mango will display the data? Right now, It works fine in my localhost browser, but I'm not sure about a remote application.

            1 Reply Last reply Reply Quote 0
            • terrypackerT
              terrypacker
              last edited by

              @raylatbasix all endpoints located below /rest are restricted to authenticated users. For a 3rd party app I would suggest token authentication which is quite easy to use from the client side by including the token in the Authorization header as shown on this page:

              https://help.infiniteautomation.com/mango-rest-api-authentication?rq=token

              Ensure you use https to protect the token.

              1 Reply Last reply Reply Quote 0
              • raylatbasixR
                raylatbasix
                last edited by

                Hi Terry,
                Sorry for being a newbie, but How would I pass this JWT Auth token within a request URL to the Rest API?

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

                  The header is Authorization, the value is Token <token value> like
                  Authorization: Bearer <token value> and you can generate auth tokens for users on the users page.

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

                    Whoops, wrote that wrong, don't trust the email notification text!

                    Authorization: Bearer <token value>

                    1 Reply Last reply Reply Quote 0
                    • raylatbasixR
                      raylatbasix
                      last edited by raylatbasix

                      Hi Phil,

                      Yes, I saw that, and forgive my ignorance, I can generate user tokens. My problem is that I can only modify the URL on my third party app. I am not understanding how to pass this authorization token from within my request URL.

                      Sorry for the crazy question :)

                      EDIT: In other words, what is my URL's format for reqesting data? ie:

                      http://localhost:8080/rest/v2/custom/latest-value-only/DP_e64bb726-ddd4-4065-8972-21c9441af408?access_token=<auth token here>??????
                      
                      1 Reply Last reply Reply Quote 0
                      • raylatbasixR
                        raylatbasix
                        last edited by

                        Good Morning Phil,

                        You can cancel this request, I was able to solve my Authorization Request Header issue.

                        Thanks again for all the help!!

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