Make HTTP Requests in Bash with `curl`

Share this video with your friends

Send Tweet

curl is how you make HTTP requests from the command line. It's awesome for testing out APIs because you have full control over all the headers that are sent, and you don't have to interact with a UI to send a request.

We’ll learn how to make requests and change the HTTP method, set headers, and send JSON and url encoded form data. We'll also see how to increase readability by splitting long requests into multiple lines and formatting JSON responses with jsome, a node module.

Jwan Khalaf
Jwan Khalaf
~ 5 years ago

How do you install jsome and is there any setup required after you've installed it to make it work in bash like you showed?

Cameron Nokes
Cameron Nokes(instructor)
~ 5 years ago

How do you install jsome and is there any setup required after you've installed it to make it work in bash like you showed?

Nothing special, just npm install -g jsome. NPM handles putting it on your PATH automatically. Another option to check out is jq which not only does json formatting but allows you to query and manipulate the json. (It's not a node module, you'll have to install it via brew or something like that). See https://egghead.io/lessons/jq-read-and-use-json-in-bash-with-jq for how to use that. Hope that helps 😀