Jump to content
Ultimaker Community of 3D Printing Experts

Ultimaker S5 API returning 405: Method not allowed status


Recommended Posts

Posted · 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.91/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!

  • 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

      • Startups, apply for the Forward AM Innovation Award!
        Are you a startup using 3D printing? Perhaps you should continue reading... 
         
        Together with BASF we are launching the Forward AM Innovation Award - the very first global contest for startups developing new applications with 3D printing!
         
        Why apply?
        The winning startup will receive €100,000 in goods and services*, along with coaching and marketing exposure from top-notch leaders in the industry.
         

         
        Who can apply?
        Your startup creates products using Additive Manufacturing, is less than 5 years old, and has less than 50 employees. We are looking for 3D printing applications with a strong focus on innovation, sustainability and scalability.
         
        Dental aligners, shoes, tools, automotive parts, music instruments, industrial tooling and molding, medical implants, sports equipment, toys, architecture, fashion, construction... all are welcome to join!
         
        Do you have an innovative, sustainable and scalable idea that leverages the unique possibilities of 3D printing? Then it is time to apply!
        More information can be found here.
         
        Applications close on March 28th, 2021
        * What does "in goods and services" mean?
        The winner will be able to pick any item from the overall product and service portfolio of the sponsors, e.g. printers, materials, consulting, software... Choose whatever you need to accelerate your startup.
         
          • Like
        • 0 replies
      • New here? Register your Ultimaker for free 3D printer 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
        • 0 replies
    ×
    ×
    • Create New...