Jump to content
Ultimaker Community of 3D Printing Experts

"PUT" cURL command not working


zaaf77
 Share

Recommended Posts

Posted · "PUT" cURL command not working

On Swagger I am able to change the name of the printer with the following command

curl -X PUT --header 'Content-Type: application/json' --header 'Accept: application/json' -d '"zaaf77"' 'http://192.168.1.38/api/v1/system/name'

But When I run the same command into the command prompt (by changing the single quotes into double) it gives the following error

{"message": "Authorization required."}

How do I authorize it?

I am struggling with the logic as well as syntax mainly! I know the id and key you can get from the following command:

curl -X POST --header 'Content-Type: application/x-www-form-urlencoded' --header 'Accept: application/json' -d 'application=laravel&user=mughalz1' 'http://192.168.1.38/api/v1/auth/request'

How do I use this id and key? Or would the id and key be the "root" and "ultimaker"?  again if it is "root" and "ultimaker", how do i use it in the cURL command, Can anyone help with the syntax please?

Actually, i am trying to develop my own interface so that someone can print a model from my website directly. Any thoughts please... ..?

 

 

 

  • Link to post
    Share on other sites

    Posted · "PUT" cURL command not working
    22 minutes ago, zaaf77 said:

    How do I use this id and key?

     

    What about adding the acquired digest authorization to you first command?

    Something like this should work with 'curl':

     

    curl -X [...] --digest --user YOUR_ID:YOUR_KEY [...]

     

  • Link to post
    Share on other sites

    Posted · "PUT" cURL command not working
    1 hour ago, tinkergnome said:

     

    What about adding the acquired digest authorization to you first command?

    Something like this should work with 'curl':

     

    
    curl -X [...] --digest --user YOUR_ID:YOUR_KEY [...]

    curl -X PUT --header "Content-Type: application/json" --header "Accept: application/json" --digest --user "4f788954582aa8b80c591bae53a6a0a4":"96c4f972838de37f2f4f14a4bbfc4a9f77ed265ffbb1b80796c3cdd41daa5b39" -d "{\"message":"How are you?",\"button_caption":"Okay"\}" "http://192.168.1.38/api/v1/system/display_message"

    😴

    Now it's giving the error saying {"message": "400 Bad Request"}

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