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.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
        • 18 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...