This article was originally published on my old blog.


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:

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)

To run curl from the command line

a) Right-hand click on “My Computer” icon

b) Select Properties

c) Click ‘Advanced system settings’ link

d) Go to tab [Advanced] — ‘Environment Variables’ button

e) Under System variable select ‘Path’ and Edit button

f) Add a semicolon followed by the path to where you placed your curl.exe (e.g. ;D:\software\curl)

Now you can run from the command line by typing the following commands.

Get Commands

Basic Get


Basic Get output to file

curl -o google.html

Specify Header

curl -H X-ApiKey:17263jhbjh1gjhgb

Display all response headers and body

curl -i

Display only all headers

curl -I

Post Commands

Send post request

curl -X POST

Send post request with data

curl -X POST -d '{ data: value}'

Send JSON data

curl -X POST \  
-d '{"myrandomkey":{"name":"ethan"}}' \
-H X-CloudMine-ApiKey:e90ef1aeaadd48de93b45038ed592a06 \
-H "content-type:application/json"
Common content-type: application/xml application/x-www-form-urlencoded

Send delete request

curl -X DELETE

Send content in file in request (Great for large amount of data)

curl -X POST -d @./path/to/file

HTTP Basic Authentication request

curl -X POST -u username:password

Make request verbose

curl -v

These commands just provide a small taste of what is possible with curl.


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.

Written by

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

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