DEV Community

Cover image for How to Easily use cURL for HTTP Requests

How to Easily use cURL for HTTP Requests

Aditya Sridhar on November 19, 2018

Originally published in adityasridhar.com Every developer needs to know a bunch of tools to be effective. cURL in one such tool 😄 In this article...
Collapse
 
pbnj profile image
Peter Benjamin (they/them) • Edited

Nice introduction to cURL!
Tiny nitpick: you can wrap your payload (i.e. -d) in single quotes to avoid having to escape inner double quotes.
Example:

$ curl -H “Content-Type: application/json“ -d{ “value”: “node.js” }’ https://localhost:3000/test
Collapse
 
adityasridhar profile image
Aditya Sridhar

Thank you :)

Actually I tried single quotes initially. Works well in mac, but in windows it threw an error. So switched it back to double quotes :D

Collapse
 
pbnj profile image
Peter Benjamin (they/them)

Huh, didn't know that.
Thanks for the info.

Collapse
 
chenge profile image
chenge

How about postman app?

Collapse
 
david_j_eddy profile image
David J Eddy

IMO, always learn and understand a tool via the CLI first. Then pick a GUI of your choice.

"CLI, everything else is abstraction" - DJE

Collapse
 
adityasridhar profile image
Aditya Sridhar • Edited

POSTMAN is great too. I use that a lot. But I feel knowing curl always helps :D