Habilelabs-Logo
Blog

API Testing Using POSTMAN

May 4th, 2021 . 4 minutes read
Blog featured image

POSTMAN is rest client. It is used to hit REST APIs.  REST is “Representational State Transfer” Architecture. REST APIs are based on some HTTP methods like-

  • GET: It is used for fetching data from the server
  • POST: It is used for creating data in server
  • PUT: It is used for updating data in the server
  • DELETE: It is used for deleting data from the server

Postman is also used for automation. Test scripts can also be written using it. It is also used for creating bulk data on the server. Postman provides a collection runner for creating the bulk data.

How to Use Postman for API Testing?

Data for API:

url: https://localhost:8081/api/v1/register-node method: post

Content-Type: application/json

Explanation:

url: https:// (Protocol) + localhost:8081 (applink+port) +  api/v1/register-node (Endpoint)

requestPayload: type=> JSON (Javascript Object Notation)

Content-Type: application/json=> Request payload is in JSON

In postman select method: POST (A method is used to create data on a server. It is the HTTP method.)

Enter URL in Postman. Meanwhile, the URL will have a protocol, port, endpoint & server IP. Server IP represents the application server.

  • Payload should have a valid JSON. Key & value pairs should only be included in JSON.
  • Click on the send button.
  • When we click on send button then it will send a request to the server. The server will analyze this request.

Enter headers in postman. Headers can change according to the request body.

Enter payload in the ‘body’ row section.

  • Payload should have a valid JSON. Key & value pairs should only be included in JSON.
  • Click on the send button.
  • When we click on send button, it will send a request to the server. The server will analyze this request.
  • It will send a request to the server and the server will validate the request and send the response.

The response will be –

Some Response Code is-

  • 200: OK
  • 404: Not Found
  • 409: Conflict
  • 500: Internal Server Error
  • 400: Bad Request

Conclusion

It is an easy-to-use tool. The end-user can learn it easily. If we compare it with soap UI then JSON is very simple and understandable. All methods are HTTP-based. User Interface is very easy to use. Response codes are readable and simple. We can also check responses in HTML and XML as well.

Also read-

Author: adarsh
Share: