Jump to content

Recommended Posts

Posted (edited) · UM 5 API help

Hello!

 

I am new to API software and am working on a research project where I need to send gcode to my printer using python. I only have experience with an Ender and using a serial port to do this, so the API world and wireless communication is all new to me. 

 

I've gotten an ethernet connection setup on the printer an am attempting to follow the Swagger documentation to start authentication, hoping this will eventually allow me to use the requests python library to send the gcode I want. But I'm stuck on one of the first few steps. 

 

To request authentication, the docs say to input this into a web browser: http://<my_printer_ip>/api/v1/auth/request or use the same curl command with the application and user params. In the web browser, i get this error: 

{"message":"405 Method Not Allowed: The method is not allowed for the requested URL."}

And using the following curl command: curl -X POST --header 'Content-Type: multipart/form-data' --header 'Accept: application/json' -F application=test' -F user=mmittlem  'http://<my_printer_ip>/api/v1/auth/request'

 

i get these errors

curl: (28) Failed to connect to multipart port 80 after 22087 ms: Couldn't connect to server
curl: (28) Failed to connect to application port 80 after 22076 ms: Couldn't connect to server
curl: (3) URL rejected: Port number was not a decimal number between 0 and 65535

 

I'm using a placeholder for the application, since I am unsure quite what that parameter is. That could very well be the source of the issue—i just don't have enough experience to know otherwise. 

 

I've tried a few other things but nothing appears to be working. The documentation on the auth/check requires an id for it to work, and giving that the id from the 'response body' section of the request (despite being unable to actually fetch an id on my own computer), i do get the "authorized" message. But none of the other commands are working. 

 

If anyone can offer any general or specific advice, that would be greatly appreciated! Even just a document out there on how to setup the API would be fantastic, or some resource I can refer to. Thank you!

 

Edited by mmittlem
  • Link to post
    Share on other sites

    Posted · UM 5 API help

    Hiya! Firstly just so you know, I'm moving this to the "Third party products and modifications" board since this really doesn't have anything to do with Cura.

     

    The only thing I can think of off the top of my head is have you tried using https instead of http?

     

    A community about... Swagger, was it you said? would probably be a much better place to ask about something like this.

  • Link to post
    Share on other sites

    Posted · UM 5 API help

    Yes, I tried both http and https. And yeah, the <my_printer_id> is the ip of my printer, i just didn't want to include it in a public post. 

     

    I can look around for a help forum for the API hosting site!

  • Link to post
    Share on other sites

    Posted · UM 5 API help
    On 3/6/2024 at 10:33 PM, gr5 said:

    This was exactly what I needed! Thank you so much!

    • Like 1
    Link to post
    Share on other sites

    Create an account or sign in to comment

    You need to be a member in order to leave a comment

    Create an account

    Sign up for a new account in our community. It's easy!

    Register a new account

    Sign in

    Already have an account? Sign in here.

    Sign In Now
    • Our picks

      • UltiMaker Cura 5.7 stable released
        Cura 5.7 is here and it brings a handy new workflow improvement when using Thingiverse and Cura together, as well as additional capabilities for Method series printers, and a powerful way of sharing print settings using new printer-agnostic project files! Read on to find out about all of these improvements and more. 
         
          • Like
        • 20 replies
      • S-Line Firmware 8.3.0 was released Nov. 20th on the "Latest" firmware branch.
        (Sorry, was out of office when this released)

        This update is for...
        All UltiMaker S series  
        New features
         
        Temperature status. During print preparation, the temperatures of the print cores and build plate will be shown on the display. This gives a better indication of the progress and remaining wait time. Save log files in paused state. It is now possible to save the printer's log files to USB if the currently active print job is paused. Previously, the Dump logs to USB option was only enabled if the printer was in idle state. Confirm print removal via Digital Factory. If the printer is connected to the Digital Factory, it is now possible to confirm the removal of a previous print job via the Digital Factory interface. This is useful in situations where the build plate is clear, but the operator forgot to select Confirm removal on the printer’s display. Visit this page for more information about this feature.
          • Like
        • 0 replies
    ×
    ×
    • Create New...