Closed daid closed 10 years ago
Could not reproduce (with an Arduino connected). I get back {"data":[],"status":"success"}
.
main.lua is the main entry point for all code so it seems there is another problem. Could you check if the file actually doesn't exist? And maybe run other API calls (both get and post)?
On code differences: branches haven't been merged back to master yet, perhaps that's why you're seeing differences.
I'll check on Monday.
I made a python script to call the API calls, I'll put together a test that gave me this result.
https://gist.github.com/daid/81134b50e1f27b672481
This python code triggers the error for me if I run it on my 0.9.9 Doodle3D box when there is a print running already. (So my test code tries to stop the print) The Doodle3D box is running in AP mode, the printer is an Ultimaker.
@David, could you explain shortly how to run the script? Also, what happens when you do add a gcode parameter?
If I add the gcode parameter I it works as it should.
The script can be run with python from the commandline. (It requires no parameters)
(Can't reproduce this using Advanced Rest Client addon in Chrome) Will try python later.
So finally tried it. Next time I want some more information, like how to use the script. Connecting to the box in access point mode and starting a print from the web interface I could reproduce the problem. The code contained the following section. It doesn't specify a content type when there is no postData.
if postData is not None:
self._http.request(method, path, urllib.urlencode(postData), {"Content-type": "application/x-www-form-urlencoded"})
else:
self._http.request(method, path);
When I change this to the following, I get a regular response back.
if postData is not None:
self._http.request(method, path, urllib.urlencode(postData), {"Content-type": "application/x-www-form-urlencoded"})
else:
self._http.request(method, path,"",{"Content-type": "application/x-www-form-urlencoded"})
Maybe specifying a content-type is required when doing a post request. That's one for the API documentation.
Odd.
Note, you're also sending (empty) post data with that change. I'll give it a shot with: self._http.request(method, path, headers={"Content-type": "application/x-www-form-urlencoded"}) As then you do send the content-type but no empty post data.
I still think it is an odd error to get back, but nothing critical.
When calling the printer/stop API without a GCode parameter (but as POST request) I get the response:
Instead of a normal JSON response. On Version 0.9.9
(Also, the code on the doodle-box does not match the code in the repository?)