How to do a PUT request with curl?

John picture John · Dec 8, 2012 · Viewed 464.8k times · Source

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

Answer

theabraham picture theabraham · Dec 8, 2012

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.