How to use cURL and Chrome Postman
As the growing of web applications which base on HTTP scripting. The needed of checking and getting the information from the web quickly or post, upload data to web server are very frequent tasks in web development. What’s the best way if we want to quickly do all kinds of URL manipulations and transfers. The answer is cURL and Postman. This article will help you how to use cURL and Postman in today web development.
cURL (Client for URLs) can transfer data from or to a web server by using these supported protocols (DICT, FILE, FTP, FTPS, GOPHER, HTTP, HTTPS, IMAP, IMAPS, LDAP, LDAPS, POP3, POP3S, RTMP, RTSP, SCP, SFTP, SMB, SMBS, SMTP, SMTPS, TELNET and TFTP). Don’t worry about those protocols we will focus, that’s just an overview about cURL. What we need is how to use it.
How to use
- Get data from a URL with GET method, then you will get the json data response from github
- Use curl request and specify the HTTP method we will use (POST, PUT or DELETE), GET method will be default if we don’t specify
curl http://target.url/todo/1 -XPUT
- Send data in the request
curl http://target.url/edit/task -XPUT -d "name=update_first_task"
- Update data with the basic authentication
curl http://user:firstname.lastname@example.org/user/1 -XPUT -d "name=newname" # or curl -u username:password http://target.url/user/1 -XPUT -d "name=newname"
- Get the information and store to a file
curl https://api.github.com > api.log # or curl -o manual.html http://curl.haxx.se/docs/manpage.html
- Download a file or directory from FTP server
curl -u ftpuser:ftppass -O ftp://ftp_server/backup_folder/backup.zip # or curl -u ftpuser:ftppass -O ftp://ftp_server/backup_folder/
- Send mail by using SMTP Protocol
curl --mail-from email@example.com --mail-rcpt firstname.lastname@example.org smtp://mailserver.com
- There are many more examples of cURL command, if you want to know more detail, just run
What is Chrome Postman
Postman is a tool to send HTTP requests to a REST-based service. This article will show you how to install the Chrome extension Postman and how to use it.
How to install Chrome Postman
Open this Postman install link then simply install it. After you have installed Postman, start the app by going to Apps bookmark and you will see the Postman – REST Client.
How to use Chrome Postman – REST Client
This is really amazing tool, everything are visualization
- It supports many method such as
GET, POST, PUT, DELETE, COPY ...
- You can click Headers and choose the header content type and the value pair
- After fill in all parameter click send to see the result
That’s how to use cURL and Chrome Postman, they are two very useful way to quickly make a HTTP request to the webserver. With cURL and Chrome Postman you can develop the REST API quickly and coding with more fun.