When you read API documentation, you may see requests made by a tool called curl. Here’s an example from Github:
Many APIs explain their documentation through curl. You’ll be able to understand every API documentation if you know curl.
What is curl
Curl is command line program that lets you send requests.
You can access the command line with the “Terminal” app if you use a Mac. If you use Windows, you can use Command Prompt.
The command line looks scary, but there’s nothing to be afraid of. Here’s an article I wrote that can help you out if you’re scared.
Installing curl
Type curl --version into your command line.
curl --version
If you see a version number, it means you have curl installed. You can move on to the next section.
If you see a “command not found” error, you will need to install curl first.
Sending requests
To send a GET request with curl, you type curl, followed by the endpoint.
curl https://api.github.com
If the server sends you a response, you will see the body of the response in your command line.
Query parameters
If you want to add query parameters to your request, you need to prepend question marks and equal signs with \. Most command line applications will prepend \ for you automatically. This is because ? and = are special characters in the command line.