The login is working and doing PUT request like pause a print works fine in node.js.
The file is 340kbyte "big". That should be transmitted very fast. After a few seconds (maybe 10?) node ends with the error: "socket hang up".
I think the problem is the multipart form part, but i have no clue what it is exactly. I already googled a lot and the code posted above is developed with this example from the request library. But the correct names and needed fields in the multipart form is dependent to the Ultimaker API. So, I have the strong feeling that a Ultimaker developer have to take a look at the code.
Recommended Posts
pbackx 11
It's been a while since I developed anything in Node, but in general the code looks ok.
How long have you waited? Maybe you're trying to post a very big file?
As a first thing, I would try doing an /api/v1/auth/verify request. Just as a sanity check to test if you are correctly submitting the username and password.
If that is working, maybe you can try some of the easier calls that don't need a multipart form, like setting the LED brightness?
Otherwise, you may need to check your multipart form code. I know this can be complicated in many languages and it looks like the syntax is ok, but you never know.
(I used Google to find this: https://github.com/request/request#multipartform-data-multipart-form-uploads )
Link to post
Share on other sites