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

      • Help Us Improve Cura – Join the Ultimaker Research Program
        🚀 Help Shape the Future of Cura and Digital Factory – Join Our Power User Research Program!
        We’re looking for active users of Cura and Digital Factory — across professional and educational use cases — to help us improve the next generation of our tools.
        Our Power User Research Program kicks off with a quick 15-minute interview to learn about your setup and workflows. If selected, you’ll be invited into a small group of users who get early access to features and help us shape the future of 3D printing software.

        🧪 What to Expect:
        A short 15-minute kickoff interview to help us get to know you If selected, bi-monthly research sessions (15–30 minutes) where we’ll test features, review workflows, or gather feedback Occasional invites to try out early prototypes or vote on upcoming improvements
        🎁 What You’ll Get:
         
        Selected participants receive a free 1-year Studio or Classroom license Early access to new features and tools A direct voice in what we build next
        👉 Interested? Please fill out this quick form
        Your feedback helps us make Cura Cloud more powerful, more intuitive, and more aligned with how you actually print and manage your workflow.
        Thanks for being part of the community,

        — The Ultimaker Software Team
        • 0 replies
      • Cura 5.10 stable released!
        The full stable release of Cura 5.10 has arrived, and it brings support for the new Ultimaker S8, as well as new materials and profiles for previously supported UltiMaker printers. Additionally, you can now control your models in Cura using a 3D SpaceMouse and more!
          • Like
        • 18 replies
    ×
    ×
    • Create New...