Notes on using Curl

Introduction

If you never heard or used the curl command line tool then this post is for you. This post will teach you some basic curl commands. I recommend that you read the official site for more details: http://curl.haxx.se/

Curl Setup

  1. Download curl zip
  2. Extract the contents (if you have downloaded the correct version you should find curl.exe)
  3. Place curl.exe in a folder where you keep your software (e.g. D:\software\curl\curl.exe)

Get Commands

Basic Get

curl www.google.com
curl -o google.html www.google.com
curl www.google.com -H X-ApiKey:17263jhbjh1gjhgb
curl www.google.com -i
curl www.google.com -I

Post Commands

Send post request

curl -X POST www.google.com
curl -X POST www.google.com -d '{ data: value}'
curl -X POST https://api.cloudmine.me/v1/app/928a78ffd73e4ff78383d1d4c06dd5a7/text \  
-d '{"myrandomkey":{"name":"ethan"}}' \
-H X-CloudMine-ApiKey:e90ef1aeaadd48de93b45038ed592a06 \
-H "content-type:application/json"
Common content-type: application/xml application/x-www-form-urlencoded
curl -X DELETE www.google.com
curl -X POST www.google.com -d @./path/to/file
curl -X POST www.google.com -u username:password
curl www.google.com -v

Summary

I hope these commands help you get started in using curl. I use curl to quickly test APIs. It is a very helpful little tool.
Again I would recommend reading the official documentation to understand some of the more advanced features.

--

--

Passion for Software and Enterprise Architecture. I like to play with Azure, Cloudflare and programming languages (C#, Rust, and JavaScript).

Love podcasts or audiobooks? Learn on the go with our new app.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Cecil

Cecil

Passion for Software and Enterprise Architecture. I like to play with Azure, Cloudflare and programming languages (C#, Rust, and JavaScript).