Jump to content

Ultimaker S5 API returning 405: Method not allowed status


xsimplex

Recommended Posts

Posted (edited) · Ultimaker S5 API returning 405: Method not allowed status

Hey,

 

I have a question regarding the Ultimaker API on my S5:  For a couple of days now, I have been unable to use new credentials for my printer.

I'm using Python with the requests library to do this.

Obtaining new credentials with

requests.post('http://192.168.1.x/api/v1/auth/request', data={'application': 'program', 'user': 'Docker'})

works fine and returns a new id, key pair which I then confirm by hand on the printer. Querying /check/id also works and returns "authorized".

But if I try to verify the id,key pair with

requests.post('http://192.168.1.x/api/v1/auth/verify', auth=requests.auth.HTTPDigestAuth(usr, pwd))

where I have saved the id and key into usr and pwd respectively, it returns

405: Method not allowed

Unfortunately the API documentation does not mention this error code at all, so I am confused as to why this is happening.

Any help with this would be greatly appreciated!

Edited by xsimplex
  • Link to post
    Share on other sites

    Posted · Ultimaker S5 API returning 405: Method not allowed status

    Did you know you can ssh into your printer with user/pass root/ultimaker?  You have to put the printer into "developer" mode first.  When in developer mode it also shows the ip address on the main display which is helpful.  Then you are in linux and can use utilities like "dmesg" to search for possible errors.  It's "debian jessie".  Or it was - I think maybe firmware version 6.X is a newer version of debian.

     

    But even if you don't want to do that you can insert a USB stick, and in the maintenance menu on the printer you can dump all the log files (there's a LOT) and see if there are more details in there.  You can match up the timing of the 405 error with what's happening in the exact same second in the log files.

  • Link to post
    Share on other sites

    Posted · Ultimaker S5 API returning 405: Method not allowed status
    12 hours ago, xsimplex said:

     

    But if I try to verify the id,key pair with

    
    
    requests.post('http://192.168.1.91/api/v1/auth/verify', auth=requests.auth.HTTPDigestAuth(usr, pwd))

     

     

    Use a get request for auth/verify, not a post request.

     

    requests.gett('http://192.168.1.91/api/v1/auth/verify', auth=requests.auth.HTTPDigestAuth(usr, pwd))

    • Thanks 1
    Link to post
    Share on other sites

    Posted · Ultimaker S5 API returning 405: Method not allowed status

    Oh!  That's probably it! get versus post.  Note also that in your example your ip address has an "x" in it - I assume that was on purpose for the post and not also in the actual code.

  • Link to post
    Share on other sites

    Posted · Ultimaker S5 API returning 405: Method not allowed status
    On 2/19/2021 at 11:35 PM, Smithy said:

     

    Use a get request for auth/verify, not a post request.

     

    requests.gett('http://192.168.1.91/api/v1/auth/verify', auth=requests.auth.HTTPDigestAuth(usr, pwd))

    Oh yes, that is of course it. Thanks for pointing that stupid mistake out to me!

     

    On 2/19/2021 at 11:20 PM, gr5 said:

    Did you know you can ssh into your printer with user/pass root/ultimaker?  You have to put the printer into "developer" mode first.  When in developer mode it also shows the ip address on the main display which is helpful.  Then you are in linux and can use utilities like "dmesg" to search for possible errors.  It's "debian jessie".  Or it was - I think maybe firmware version 6.X is a newer version of debian.

    This is also a very helpful tip, though, being able to look directly into the printers kernel ring buffer can come in quite handy I bet.

    Big thank you to both of you!

  • 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.8 Stable released 🎉
        In the Cura 5.8 stable release, everyone can now tune their Z seams to look better than ever. Method series users get access to new material profiles, and the base Method model now has a printer profile, meaning the whole Method series is now supported in Cura!
        • 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
        • 3 replies
    ×
    ×
    • Create New...