Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to do a PUT request with cURL?

Tags:

rest

http

curl

How do I test a RESTful PUT (or DELETE) method using cURL?

like image 579
John Avatar asked Dec 08 '12 21:12

John


People also ask

How do you make a PUT request on curl?

To make a PUT request with Curl, you need to use the -X PUT command-line option. PUT request data is passed with the -d parameter. If you give -d and omit -X, Curl will automatically choose the HTTP POST method. The -X PUT option explicitly tells Curl to select the HTTP PUT method instead of POST.

How do you make a PUT request?

Sending a PUT Request with Axios The simplest way to make the PUT call is to simply use the put() function of the axios instance, and supply the body of that request in the form of a JavaScript object: const res = await axios. put('/api/article/123', { title: 'Making PUT Requests with Axios', status: 'published' });


1 Answers

Using the -X flag with whatever HTTP verb you want:

curl -X PUT -d arg=val -d arg2=val2 localhost:8080 

This example also uses the -d flag to provide arguments with your PUT request.

like image 79
theabraham Avatar answered Oct 01 '22 05:10

theabraham