Duet3D Logo

    Duet3D

    • Register
    • Login
    • Search
    • Categories
    • Tags
    • Documentation
    • Order

    REST Api Questions

    General Discussion
    3
    7
    218
    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.
    • markz
      markz last edited by markz

      Hi, I've just upgraded to 3.4.0, which may be relevant.

      I'm trying to update an old application that uses the REST Api and a few things:

      1. The REST Api doc doesn't seem to be on the new doc site
      2. Per the above, the search on the new doc site seems very bad. Is it really unable to search for more than one word? The doc seems great, but.
      3. I have 3 installations (Duet2, 6HC, 6HC+SBC). For the non-SBC's I can type http://devip/rr_status and get back a json status in my browser. On the third (the 6HC+SBC) I get a page not found (404) error so no rest api?

      I looked at the (old) C# code I have to use the REST Api and it had commented out code for an authorization token so maybe I did something to the CNC (Duet2). The current/old RESTful software is working fine on that machine with no token.

      The existing api doc discusses tokens but imho it's impenetrable.

      I honestly don't care now since the +SBC system is the only one I'll never use this software on but I'd kind of like to know the root cause in case it matters some day.

      Thanks.

      Sindarius 1 Reply Last reply Reply Quote 0
      • Sindarius
        Sindarius @markz last edited by

        @markz with the SBC has a different set of endpoints. You can find more information here https://github.com/Duet3D/DuetSoftwareFramework/wiki/REST-API

        markz 2 Replies Last reply Reply Quote 0
        • markz
          markz @Sindarius last edited by markz

          @sindarius Thanks. That's really nice doc for the SBC version. A link to the non-sbc version would be nice here since I'm not clear on the differences. Will I need two different sets of code to talk to the SBC/non-SBC models? I have both here that I use and can test with.

          Meanwhile, I looked at the firmware repository for 3.4.0 and it appears to not be sending back CORS allow headers so I'm having cross domain issues from my application. When I use, for example,

          curl http://duetcnc.local/rr_status -v

          it returns no CORS headers and this is a Duet2.

          I know this is in the weeds but help?

          Mark

          chrishamm 1 Reply Last reply Reply Quote 0
          • markz
            markz @Sindarius last edited by markz

            @sindarius I went around and around and at least on my application all I needed was Access-Control-Allow-Origin: * for the rest api at least from private->private.

            From public->private I just had problems and although the spec discusses Access-Control-Allow-Private-Network (response) and Access-Control-Request-Private-Network (request) in preflight that didn't seem to work for me in a public url.

            Sindarius 1 Reply Last reply Reply Quote 0
            • Sindarius
              Sindarius @markz last edited by Sindarius

              @markz you can adjust cors by using M586. You can open it up with M586 Cā€*ā€

              You can see a list of the standalone GET requests here https://github.com/Duet3D/DuetWebControl/blob/legacy/README.md

              markz 1 Reply Last reply Reply Quote 1
              • markz
                markz @Sindarius last edited by

                @sindarius You're officially my favorite person today. I spent a day diagnosing this and trying to find a workaround.

                1 Reply Last reply Reply Quote 0
                • chrishamm
                  chrishamm administrators @markz last edited by

                  @markz You can find the docs for the RRF HTTP API here: https://github.com/Duet3D/RepRapFirmware/wiki/HTTP-requests

                  Duet software engineer

                  1 Reply Last reply Reply Quote 1
                  • First post
                    Last post
                  Unless otherwise noted, all forum content is licensed under CC-BY-SA