Advanced Rest Client, Postman and SoapUI are top API clients you may have used while building or testing API integrations. These applications are useful. However there are cases where invoking the API from the command line is advantageous and is made possible through cURL.
What is cURL?
cURL is a tool used to transfer files. The cURL command can be used inside scripts or from the command line. cURL provides support for common protocols like HTTP, HTTPS, FTP and much more.
This article will focus on using the cURL command to invoke integrations that use HTTP. The cURL commands provided in this article will be demonstrated by invoking a sample API built in Mule 4, running on my local machine. Let’s get started!
How do I start?
Open your command prompt (Windows) or terminal (Mac/Linux). Run
curl

Look for the following output:
curl: try 'curl --help' for more information
This is a good indicator that cURL is installed on your local machine. If not, you will need to do a fresh install of cURL. Download cURL here.
cURL commands typically use the following syntax:
curl [options] [url]
Need help?
Use the --help option to provide a list of options.
curl --help
![curl --help usage: curl [options...] <url> ... This is not the full help, this menu is stripped into categories. Use "--help category" to get an overview of all categories. For all options use the manual or "--help all".](https://static.wixstatic.com/media/e0d344_ced016fedf054b288b9ffd6647ea7880~mv2.png/v1/fill/w_980,h_503,al_c,q_90,usm_0.66_1.00_0.01,enc_auto/e0d344_ced016fedf054b288b9ffd6647ea7880~mv2.png)
Use the --manual option to reference the “man” page (or manual).
curl --manual
![curl --manual Project NAME curl - transfer a url SYNOPSIS curl [options / urls] DESCRIPTION curl is a tool to transfer data from or to a server...](https://static.wixstatic.com/media/e0d344_e62807e578094d5e8956c6fc1733be26~mv2.png/v1/fill/w_980,h_577,al_c,q_90,usm_0.66_1.00_0.01,enc_auto/e0d344_e62807e578094d5e8956c6fc1733be26~mv2.png)
NOTE: Since I am using a Windows machine, I often use the command line from a Git Bash terminal.
Demo Time
The remainder of this article will focus on HTTP. All demonstrated cURL command examples will be HTTP requests (unless otherwise specified) and invoked against a simple Mule API running on my local machine. The API takes in the HTTP request and provides a breakdown of the request in the response.
REQUEST OPTION: To create an HTTP/HTTPS request. Use the --request option.
SYNTAX:
curl --request <method> '<url>'
NOTE: URL will include the protocol (http/https).
GET
GET requests can be written in two formats:
1) Short-hand
SYNTAX:
curl '<url>'
EX:
curl 'http://localhost:8081/curl/helloget'
2) Long-hand