curl https://jsonplaceholder.typicode.com/posts/1/comments
- This will fetch you the json response from the input api url.
curl -i https://jsonplaceholder.typicode.com/posts/1/comments
- This will include all the header information
curl -I/--head https://jsonplaceholder.typicode.com/posts/1/comments
- -I or --head will give us only the header.
curl -o/--output filename.txt https://jsonplaceholder.typicode.com/posts
- This will copy the respone/output in filename.txt
curl -O https://jsonplaceholder.typicode.com/posts/1/comments
- This will download the response but will not have any extension name.
curl -O --limit-rate 100B https://jsonplaceholder.typicode.com/posts
- This will limit the transfer rate of our download, to the given speed.
curl --data "title=Hello&body=world" https://jsonplaceholder.typicode.com/posts
- This will make a Post request to add data to the server using
curl
.
curl -X PUT -d "title=Raghav" https://jsonplaceholder.typicode.com/posts/3
- This will make a PUT request to the server.
curl -X DELETE https://jsonplaceholder.typicode.com/posts/3
- This will make a DELETE request to the server.
curl -L https://google.com
- This will give us location's response from the url.