How to CURL
18 May 2020 -
The cURL utility is handy when you want to quickly explore a resource on the web such as an API or webpage.
cURL comes installed by default in Windows 10 and macOS. So go ahead, open CMD and give it a whirl. Terminal, if you use macOS.
Stripe’s API reference is a good resource to explore.
If you have CMD open, copy paste into it this test Authentication API call.
curl https://api.stripe.com/v1/charges –user sk_test_4eC39HqLyjWDarjtT1zdp7dc:
Take a look at the response. See if you can make sense of it.
Public datasets are another great resource to explore. The city of Seattle, for example, has an Open Data Portal.
The Fremont Bridge Bicycle Counter is a popular dataset in this portal. It records the number of bikes that cross the bridge using the pedestrian/bicycle pathways
curl https://data.seattle.gov/resource/65db-xm6k.csv –output fremontbikedata.csv
The last bit –output fremontbikedata.csv writes the dataset to a local CSV file which you can explore using Excel or similar tools. To download this in JSON, replace .csv with .json above.
If you want to wrangle the Fremont Bridge Counter’s JSON dataset right in the command line, try JQ or use its online equivalent JQ Playground.
Total number of rows
When crossings across both sidewalks were less than 10
. select(.fremont_bridge <= “10”)