Jump to content
zaaf77

"PUT" cURL command not working

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

 

 

 

Share this post


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 [...]

 

Share this post


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"}

Share this post


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

×
×
  • Create New...

Important Information

Welcome to the Ultimaker Community of 3D printing experts. Visit the following links to read more about our Terms of Use or our Privacy Policy. Thank you!