Jump to content
Ultimaker Community of 3D Printing Experts

Ultimaker S5 API returning 405: Method not allowed status


xsimplex
 Share

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
     Share

    • Our picks

      • New here? Get ahead with a free onboarding course
        Hi,
         
        Often getting started is the most difficult part of any process. A good start sets you up for success and saves you time and energy that could be spent elsewhere. That is why we have a onboarding course ready for
        Ultimaker S5 Pro Bundle, Ultimaker S5, Ultimaker S3 Ultimaker 2+ Connect.   
        They're ready for you on the Ultimaker Academy platform. All you need to do to gain access is to register your product to gain free access. 
        Ready? Register your product here in just 60 seconds.
          • Like
        • 11 replies
    ×
    ×
    • Create New...