Test REST Services with Curl


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


Paul Sterl has written 52 articles

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>