Problem
Often we want an easy way to test our REST services. Even if where are many tools around e.g. Chrome Plugins etc. it is maybe easier on servers to juts use curl
to do the job.
Basic PUT command
curl -X PUT -H "<Header-Name>: <Header-Value>" "https://<url>" -v
Add basic Authorization
Curl already supports basic auth out of the box just adding the -u
parameter.
curl -u <user>:<password> -X PUT "http://<url>" -v
Create a basic Authorization Base64 token
echo -e "<user>:<password>" | base64
Post or Put JSON data
curl -X PUT "http://<url>" -H "Content-Type: application/json" -d '{"foo": "bar"}' -v