Basics of Postman
API (Application Programming Interface) automation is growing in demand. A postman is a tool used for API testing. We can use Postman in two ways, one is a web version and the other is a desktop version. It sends the request to the server and gets the response back.
Why do we use Postman :
We use Postman for the following reasons.
Postman is available as a free tool too.
It is suitable for the end-to-end life cycle of the API.
It has Graphical User Interface too.
Postman has a command line interface, Newman. Using Newman, we can easily integrate with CI / CD tools, like Jenkins.
Users can organize their test suites using Collections / Folders/ Requests.
Postman has an extensive support community.
5 Popular HTTP Methods :
Some of the most used methods in Postman are GET, POST, DELETE, PUT, and PATCH.
Similar to SQL statement
Use of Method
To fetch the data from the resource
To create a new resource
To delete a resource
To replace the entire resource
To replace a particular resource element
Description of 'New" Menu :
The following options are available in the 'New' menu.
1. HTTP Request: We can send a request to the server and get the response from the server along with other methods.
2. WebSocket Request: WebSocket is stateful. It has a bi-directional flow. The client and server have the information about the session. We can test WebSocket too using Postman.
3. gRPC Request: gRPC stands for google Remote Procedural Call. We can test gRPC API too using Postman.
4. Collection: We can place all our requests in a single Collection.
5. Environment: Postman allows us to test in various environments, such as Dev, QA, UAT, Prod, and Staging
6. Workspace: When multiple people are working on the same project or we are working on multiple projects, this option is very helpful.
7. API Documentation: Postman also provides documentation features like Swagger.
8. Mock Server: Mock Server is helpful when we work on some complex APIs. When any API is not ready for integration, Mock Server will provide some temporary fix to proceed with our testing.
9. Monitor: It is a scheduling tool. Using Monitor, we can schedule our tests. It is available in free and commercial forms.
10. API: It is used to track the development and testing
11. Flow: It is like a flowchart. We can connect the requests by drag and drop.
Status Codes :
Status codes are response codes sent by the server for our HTTP request. Using this, we can find out whether our request status is successful or not. If it is not successful, it will let us know what is wrong.
1XX series (100 - 199): The server receives the client's request and is working on it.
102 - Processing
2xx series (200 - 299): The server receives the client's request and processes it successfully.
200 - OK
201 - Successful insertion of a resource into the database
204 - Successful deletion of a resource, empty response
3xx series (300 - 399): It means that the responses relate to redirection.
301 - Moved permanently
4xx series (400 - 499): It means that the responses relate to client error.
401 - Unauthorized access
403 - Forbidden
404 - Not found
5xx series (500 - 599): It means that the responses relate to a server error.
500 - Internal server error
Due to its merits, Postman is one of the popular tools that is used for API testing.