viernes, 14 de septiembre de 2012

Once upon a time CURL

Have you had the chance to work with REST???

Something that I've come to learn working with REST is that people working with it are fond of the CURL command line.

Wikipedia defines CURL as:

"is a computer software project providing a library and command-line tool for transferring data using various protocols."

Thing is, I really don't like it. Not because it's a bad tool but because I just don't want to learn yet another command line, let's face it I'm lazy. Any way this people I was talking about have so much faith in CURL that may come to demand you to post the output of a CURL execution to validate what ever you're saying about a REST call.

Providing all this I thought it may be worth to write a small post about the really basic things that you can do with CRUL.

Now the prototype of the command it's quite simple:


curl [options] [URL...]


The options portion is the one that really matters.
Here is a list that I found useful, but keep an eye on the post for I may keep updating it:

 -H  this is for header. Any valid HTTP may be used here.

It's useful  for things like Authorization.

-X this can be used for for HTTP verbs

Like so -X DELETE, -X POST


So this would be how a valid call looks like:

curl  -H "Authorization: Basic sdaqwrdsfdsfafdszadsafdsafdsfad3" -X DELETE http://somehost.com/something?queryparam=somethingelese

Any way, for now this suits me but would you need more data please refer to:


Of course over there you'll find all there is to find about CURL, but I just like to post here things that I tend to forget.

Enjoy





No hay comentarios:

Publicar un comentario