Wow. Just awesome work!
I'm fairly happy with how the API turned out. I'm also quite curious as to what people will do with it.
Wow. Just awesome work!
I'm fairly happy with how the API turned out. I'm also quite curious as to what people will do with it.
I'm fairly happy with how the API turned out. I'm also quite curious as to what people will do with it.
Well, now that I've been testing some odds and ends that we where not using yet, I've noticed a few things that we can improve and fix on. Especially status reporting on calls is a bit "random". For example, the result of setting a name is:
{'message': " set", 'result': True, 'return_value': 1}
or
{'message': " set", 'result': True, 'return_value': 0}
Depending on if it changed the name or not.
While sending an abort/pause always comes back with an empty reply.
Setting a single property of the led returns something that looks like setting the name, but setting them all at once returns an empty result like the abort/pause...
I think our data querying part, and the data setting part are quite good, but the reporting back from certain calls is a bit messy.
I think our data querying part, and the data setting part are quite good, but the reporting back from certain calls is a bit messy.
Yeah I agree. I focused more on getting the initial structure right and not so much on consistent reporting.
Just made a small fix to the example script, authentication would not be saved if you needed new authenication because for example, you started to talk to a different Ultimaker3.
Hey, really nice work !
Maybe you can help me with my problem.
When i want to change the printer name the PUT request is working but i get from the printer: body: {"message": "Authorization required."}
How can I send him the authentication id and key.
I am trying to set up a nodeJS server.
Hello,
I'm using a Ultimaker3 with firmware : 3.7.7.20170627 (latest from stable).
I have the following issue when calling GET /printer via a client generated from swagger tools : the Network object returns differs from the spec (returns an object : is an enum in spec), which throws a serialization exception.
Is there an updated - correct - swagger doc somewhere ?
A nuget package for a c# client ?
If not, a github repo where we can contribute ?
Thanks !
I'm trying to save a print by sending an API call to change the extruder temperature. A bad pause caused the temperature to be set to 0, and it will not return back to the default printing temperature. It tries to print at 0 C, which is cold extrusion, so I'm surprised it is letting me do that.
I'm trying to use the API documentation and digest authentication to accomplish this, but all I've been able to do is change the LED, and when I run the curl command through the API interface, it returns a 405 Method Not Allowed.
Is it even possible to modify extruder temperature during a print?
In other news, the forum has really garbled your python code posted here, removing a lot of the end of lines. I'm trying to repair them, but since Python is an indent-based language, it is quickly becoming hectic and error-prone. Do you have your class library and example in an easier format that retains the EOLs?
api = Ultimaker3("10.180.1.209", "Test script")api.loadAuth("auth.data") # Get all the system data system = api.get("api/v1/system").json()print(system["name"]) # Change the system name result = api.put("api/v1/system/name", data="MyUltimaker3")print(result.json()) # Set the target hotend temperature to 100C, and then back to 0. print(api.get("api/v1/printer/heads/0/extruders/0/hotend/temperature").json())result = api.put("api/v1/printer/heads/0/extruders/0/hotend/temperature/target", data=100.0).json()print(api.get("api/v1/printer/heads/0/extruders/0/hotend/temperature").json())result = api.put("api/v1/printer/heads/0/extruders/0/hotend/temperature/target", data=0.0).json()print(api.get("api/v1/printer/heads/0/extruders/0/hotend/temperature").json()) # Change the LEDs api.put("api/v1/printer/led", data={"brightness": 50.0, "saturation": 20.0, "hue": 100.0}) # Start a print job. result = api.post("api/v1/print_job", files={"file": ("UM3_Box_20x20x10.gcode", open("UM3_Box_20x20x10.gcode", "rb"))})print(result.content) # Pause the print api.put("api/v1/print_job/state", data={"target": "pause"}) # Resume the print api.put("api/v1/print_job/state", data={"target": "print"}) # Abort the print api.put("api/v1/print_job/state", data={"target": "abort"}) ## This program is free software: you can redistribute it and/or modify# it under the terms of the GNU Affero General Public License as# published by the Free Software Foundation, either version 3 of the# License, or (at your option) any later version.# # This program is distributed in the hope that it will be useful,# but WITHOUT ANY WARRANTY; without even the implied warranty of# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the# GNU Affero General Public License for more details.# # You should have received a copy of the GNU Affero General Public License# along with this program. If not, see . import requests import json import os import time # Ultimaker 3 API access class. # Allows for access of the Ultimaker 3 API with authentication. # Uses the python requests library to do the actual http requests, which does most of the work for us.
At the end there is where the EOLs become more difficult to repair.
Many thanks,
Sean
There is discussion on how to set the temperature of either core here:
Read particularly posts by robinmdh
Note that your printer needs to be in developer mode and you need to ssh to the printer using username/password ultimaker/ultimaker.
Thanks for the response. Sadly, I did not put it in developer mode before printing, and so can't seem to connect via SSH. Probably need to be like serially connected.
Oh. That's a problem. I put my printer into dev mode when it was just a few days old and it has been there since. It's been a few years.
Are there any other workarounds? API Put method on the hotends doesn't seem to be allowed, which is immensely frustrating.
Can we submit the temperature API setting PUT "Method Not Allowed" as a bug? This feature increases accessibility to the printer, and is awesome, but it fails to actually work when required. Specifically, I'm trying to enact it during a pause, and I confirmed that the API Post method does not work when printing either.
Edited by SeanTapscott
Did some more testing, can move the head up and down and all kinds of positions, but cannot change the temperature.
Finally figured it out.
Ok, figured this out. If you go back to his original API post, you'll find there's a typo in the Swagger API documentation. To set the temperature, you need to send a CURL -X PUT to http://192.168.1.15/.../extru.../1/hotend/temperature/target \
-H 'Accept: application/json' \
-H 'Authorization: Digest username="e7070a69184a88fa7155b53703c026de", realm="Jedi-API", nonce="ee9219554d47256f6fcda62f006908ea", uri="/api/v1/printer/heads/0/extruders/1/hotend/temperature/target", algorithm="MD5", qop=auth, nc=00000001, cnonce="iCCymccp", response="b1c26cba5c37a19c14731816024e269a"' \
-H 'Content-Type: application/json' \
-H 'Postman-Token: da5f6c8b-f68a-4fa8-94b6-9dd0eccc123c' \
-H 'cache-control: no-cache' \
-d 200
Need to add /target to the end of the API call, and only pass in a number value, with no text.
I developed a web application by PHP. If I want to use POST print_job, do I need to generate new id and key every time? Because I found that a previous authorized id and key would be unauthorized next time. By the way, do I need to set api key? Thank you very much!
That shouldn't happen, a id+key should remain valid unless the machine is factory reset. So you only need it once. (On HTTP Digest level things do expire, but I would expect PHP to handle this for you seamlessly)
On 5/18/2019 at 5:31 AM, Daid said:That shouldn't happen, a id+key should remain valid unless the machine is factory reset. So you only need it once. (On HTTP Digest level things do expire, but I would expect PHP to handle this for you seamlessly)
Thank you very much! I solved this POST print_job problem. There are several syntax errors of PHP code.
Edited by sxj1121On 5/28/2019 at 10:41 PM, sxj1121 said:Thank you very much! I solved this POST print_job problem. There are several syntax errors of PHP code.
@sxj1121
any chance you got your printing done with PHP, would you like to share some more on it then? I am working on the same thingy, actually I want to authorize the user to print GCODE files from my website to directly to their 3DPrinter say ( ultimaker S5). I also want to restrict the number of prints as well but that's second step. More interested into the process of printing a GCODE directly from my website to the 3D printer, have you any thoughts on it? Waiting on you and thanking you in advance!
3 hours ago, zaaf77 said:@sxj1121
any chance you got your printing done with PHP, would you like to share some more on it then? I am working on the same thingy, actually I want to authorize the user to print GCODE files from my website to directly to their 3DPrinter say ( ultimaker S5). I also want to restrict the number of prints as well but that's second step. More interested into the process of printing a GCODE directly from my website to the 3D printer, have you any thoughts on it? Waiting on you and thanking you in advance!
I am sorry that I can't directly share my code with you due to the restrictions of our lab. You could try to start from posting a gcode file on windows cmd by curl.
In my PHP code, I also use curl to send gcode file. You could refer to my previous post.
For PHP7, it is:
$data_array = array(
'jobname' => 'file',
"file" => new \CURLFile($filedata)
);
If you want develop a perfect website. You need to develop a PHP file for using Get, Put, Post to call the API. Then develop another PHP file to receive the file which is uploaded from the front-end. Next save the file to local (You don't really need this step, but I don't know how to skip it). Then upload this file from local to API by Post.
For restricting the number of prints, you could use AJAX to get the real-time print process. If it's not Not Found, then disable the upload function. But I think if 3D printer starts printing, then keep uploading files won't make any changes.
Edited by sxj112117 hours ago, sxj1121 said:I am sorry that I can't directly share my code with you due to the restrictions of our lab. You could try to start from posting a gcode file on windows cmd by curl.
In my PHP code, I also use curl to send gcode file. You could refer to my previous post.
For PHP7, it is:
$data_array = array(
'jobname' => 'file',
"file" => new \CURLFile($filedata)
);
If you want develop a perfect website. You need to develop a PHP file for using Get, Put, Post to call the API. Then develop another PHP file to receive the file which is uploaded from the front-end. Next save the file to local (You don't really need this step, but I don't know how to skip it). Then upload this file from local to API by Post.
For restricting the number of prints, you could use AJAX to get the real-time print process. If it's not Not Found, then disable the upload function. But I think if 3D printer starts printing, then keep uploading files won't make any changes.
@sxj1121... .. Many thanks for your help and is much much appreciated! Thanks for the piece of code just above as well as a reference to your PHP7, Would you be kind enough to share the link to this.... I mean PHP7 you just mentioned above....
Much appreciated once again and thankyou so very much...
Have a nice day!
11 hours ago, zaaf77 said:@sxj1121... .. Many thanks for your help and is much much appreciated! Thanks for the piece of code just above as well as a reference to your PHP7, Would you be kind enough to share the link to this.... I mean PHP7 you just mentioned above....
Much appreciated once again and thankyou so very much...
Have a nice day!
you could download and install xampp, it would be easier for you to start programming. https://www.apachefriends.org/index.html
Hello @Daid @SeanTapscott @gr5
Can you please tell me how to set extruder temperature using Ultimaker API.
Recommended Posts
kitusmark 0
Wow. Just awesome work!
Link to post
Share on other sites