REST Api Questions
-
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:
- The REST Api doc doesn't seem to be on the new doc site
- 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.
- 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.
-
@markz with the SBC has a different set of endpoints. You can find more information here https://github.com/Duet3D/DuetSoftwareFramework/wiki/REST-API
-
@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
-
@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.
-
@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
-
@sindarius You're officially my favorite person today. I spent a day diagnosing this and trying to find a workaround.
-
@markz You can find the docs for the RRF HTTP API here: https://github.com/Duet3D/RepRapFirmware/wiki/HTTP-requests