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.9 stable released!
        Here comes Cura 5.9 and in this stable release we have lots of material and printer profiles for UltiMaker printers, including the newly released Sketch Sprint. Additionally, scarf seams have been introduced alongside even more print settings and improvements.  Check out the rest of this article to find out the details on all of that and more
          • Like
        • 5 replies
      • Introducing the UltiMaker Factor 4
        We are happy to announce the next evolution in the UltiMaker 3D printer lineup: the UltiMaker Factor 4 industrial-grade 3D printer, designed to take manufacturing to new levels of efficiency and reliability. Factor 4 is an end-to-end 3D printing solution for light industrial applications
          • Heart
          • Thanks
          • Like
        • 4 replies
    ×
    ×
    • Create New...