Before exploring cURL let’s understand what is cURL
so what is curl?
curl in the simplest of word is a postman for terminal you can send ,request ,delete data from an api(application programming interface) using the required credentials and data from the terminal only , curl is used widely among developers or programmers who love terminal . it is used to request something to or from a server . curl helps a lot when you need to automate api calls and it supports almost every protocol available from HTTP , HTTPS to SMTP , FTP etc.
You can perform all the request methods like GET , POST , PUT , DELETE etc for HTTP/S
For all the requests i will be making i will be using Jsonplaceholder which help in fake api testing
Let’s see how it works on the basic commands
GET-method:
When you type the first and since no method is mentioned it by default uses GET request for whatever the api is. You can also write the second one mentioning the method:
curl https://jsonplaceholder.typicode.com/posts/
curl --request GET https://jsonplaceholder.typicode.com/posts/
POST-method
Post method is used to post data to an API
curl --request POST https://jsonplaceholder.typicode.com/post -d '{data in json format}'
DELETE-method
Delete method is used to delete data to an API of the particular endpoint.
curl --request DELETE https://jsonplaceholder.typicode.com/post/100/
and this is how you communicate with the API there are a lot of diffrent methods and protocols these are some basics.
Request-Response Cycle is as the name suggests when a user request something the server serves them that as a response. if you order pasta then pasta will be delivered this is request response cycle
if your order is late you get status like time limit exceeded or if the shop(server) is closed you see Not found that is it everything that can happen to a pasta from you ordering to being delivered to you or not is the request response cycle.
Things To avoid doing as a begginer:
- Don’t use unneccessary commands like —request GET or -x POST if you are using -d command to post some data
- Make sure you are writing the correct commands and shortcuts an alphabet here and there can get you diffrent result than expected.
- As i said curl is like postman not postman so you need to carefully check the command line before executing it.
This is my understanding of curl , Would love to have more knowledge on this.


Top comments (0)