In this post, I will use the Postman software to send and recieve requests, POST data to the server and I will try to demo some other popular maneuvers. You can treat this article as your first contact with the Postman. So, lets get started !!
You can download Postman from here.
After downloading and installing the Postman, open the software.
Explaining the Interface
- The longest middle input field that looks something like a search bar is where the URL that we want to GET or POST or DELETE,etc. is fed.
- Just to the left of it, is a drop down button which has all the various HTTP methods as options. If you want to POST to the URL that you have specified, select POST.
- To the right of it is the params button. If you click on it, a new interface will appear. Params are basically the data that we want to send to the server with our request. We will use this params interface to POST to put app a new User.
- To the left of this button is the Send button which is used in sending the request to the server or the app in this case.
I think this much introduction to the interface is enough for us to get started. I will explain any other bit about the Postman on the fly if I have to.
So, lets get started with sending and receiving requests through Postman.
Sending and receiving requests through Postman
- Enter the url that you want to hit in the URL bar that i described above. I will put http:localhost:3000 in my case.
- Lets select our HTTP method to send the request as GET in the left button. Now click on the Send button.
- You will be returned HTML of the URL that you GET. I have selected the Preview to have a browser-like look.
- As you can see in the snap below that with the response from the server or the app, various headers are returned too with the main response.
Explanation of Header :
The first header returned is keep-alive . It basically means that the server’s connection with the user will not kill itself after some time.
- Content-length is the length of the html document that is returned.
- Date is the time the request has been made to the server to return the file.
- X-Powered-By sends Express as the app server is Express.
- Etag is an identifier for a specific version of the resource. It helps in saving time and bandwidth in case the user requests the same page again without any modifications, then the same file could be sent. You can read more about Etags here.
For that, we will first GET the register form.
- Change the HTTP method of the next request that we are going to the send to POST. Open the Params tab of the Postman . This will help us in sending the form with the values that we want.
- After we hit enter, it POSTs the form with our key-value pairs and returns the response.
The terminal also logs the registerd user.
- Super easy API
- Wide range of functionality like support for all possible HTTP methods, saving progress, API to code conversion, changing environment of API development and many others.
- Helps to see the status codes, time taken for response and other performance parameters.
- Testing of APIs can be scheduled and automated.
- There is an option for importing of existing work so that you don’t have to start from scratch.
- Too many choices can overwhelm a beginner.
- It is not always true that an API developed in Postman will sure shot work in browser.
- Limited area of application(API testing and some other techniques).
- Introduction to Web Development and the Holy Trinity of it
- Introduction to Xamarin | A Software for Mobile App Development and App Creation
- How can I start to learn Web Development ?
- What is full stack development ?
- My minified journey with Web Development!
- 10 Myths About Software Development
- Android App Development Fundamentals for Beginners
- Top Programming Languages for Android App Development
- ReactJS | Setting up Development Environment
- What is the difference between Front-End and Back-End Web Development?
- Begin Web Development with a Head Start
- Top Android Development Frameworks to Learn in 2019
- Why Kotlin will replace Java for Android App Development
- Android & iOS App development using React Native with Expo
Posting the data to the Server
Now, lets try to POST some data to the server(local server).
Pros and Cons
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.