5 Revere Drive, Northbrook, Illinois, 60062-150, United States of America          +1-312-436-0278          [email protected]

Postman

What is Postman?

Postman is an application for testing APIs, by sending request to the web server and getting the response back.

  • It allows users to set up all the headers and cookies the API expects, and checks the response
  • Productivity can be increased using some of the Postman features, which are listed below.

Postman is a tool that many testers use to perform API testing . It allows users to perform GET, POST, PUT, DELETE and many other request to web service API.

A test in Postman is fundamentally a JavaScript code, which run after a request is sent and a response has been received from the server.

Postman is an API development tool which helps to build, test and modify APIs.

API stands for Application Programming Interface which is a software that works as a mediator and allows two applications to talk to each other. Each time you use an app like Facebook, send an instant message, or check the weather on your phone, you’re using an API.

As an Example, When you use an application on your mobile phone, the application connects to the Internet and sends data to a server. The server then receives that data, interprets it, performs the necessary actions and sends it back to your phone. The application then interprets that data and presents you with the information you wanted in a readable way. This is what an API is, all of this happens via API.

 It has the ability to make various types of HTTP requests such as GET, POST, PUT, DELETE, PATCH, saving environments for later use and converting the API to code for various languages like JavaScript, Python.

What are HTTP Requests ?

The internet consists vast amount of resources located on different servers. For you to access these resources, your browser needs to be able to send a request to the servers and display the resources for you. HTTP (Hypertext Transfer Protocol), is responsible for requesting and taking responses for effective communication between a client and a server. The message that is sent by a client to a server is what is known as an HTTP request.

Therefore, HTTP request methods are used to indicate the specific desired action that needs to be performed on a given resource. Each method should be implemented clearly. There are many types of HTTP request methods,

  • GET – This is used to retrieve and request data from a specified resource in a server.
  • POST – This method is used to send data to a server to create/update a resource.
  • PUT – This method is similar to POST as it is used to send data to the server to create or update a resource. The difference between the two is that PUT requests are idempotent. This means that if you call the same PUT requests multiple times, the results will always be the same.
  • DELETE – This request method is used to delete resources indicated by a specific URL.

These are the basic HTTP request methods and there are many more,I will use this basic requests to demonstrate how does the postman work with this kind of requests that are passing through client and the server.

 download Postman  And  install Postman . After downloading and installing the Postman, open the software.

After Postman is opened,  sign up window will be appeared in your screen as below. So, you have to enter valid email address and password to sign up for postman successfully.

When you have signed up successfully for Postman, you will see the startup screen . No need to worry about the interface, because this is very simple to use.

Working with GET requests

GET requests are used to get information from a given URL. There will be no changes done to the endpoint, because using this request we can only retrieve information.

URL:localhost:8080/api/v1/person

In the above workspace:

  1. Set your HTTP request to GET.
    2. In the request URL field, input link
    3. Click Send
    4. You will see 200 OK Message which indicates the success of the request.
    5. This section shows the data which is taken from the API
    6. After you retrieve the data, your GET request is saved in history section

Working with POST requests

POST requests are used for data manipulation with the user adding data to the endpoint. Use the same URL and  let’s add our own user.

In the above workspace:

  1. Set your HTTP request to POST
    2. In the request URL field, input link
    3. Click the body section
    4. Select the JSON format to add data
    5. In the body section add your data in JSON format according to your parameters
    6. Click Send
    7. You will see 200 OK Message
    8. This section shows the posted data
    9. After you create the data, your request is saved in history section

After Posting the data, you can check whether the data is successfully added to the server by following these simple steps

In the above workspace:

  1. Set your HTTP request to GET
    2. Click Send
    3. As you can see in the picture the data has been added to the system successfully

Working with PUT Requests

PUT requests can be simply used to edit data that have been already added to the system or also used to add new data to the server from the given URL. You can follow this simple steps to make a PUT request.

In that highlighted section, I will change the name from “Will Smith” to “Jessica Jones”.

In the above workspace:

  1. Set your HTTP request to PUT
    2. Copy the id of “Will Smith” and paste it right after the URL
    3. Change the name into “Jessica Jones”
    4. Click Send
    5. You will see 200 OK message

To make sure that the data has been successfully changed, send a simple GET request to the URL

Working with DELETE Request

DELETE Request can be simply used to delete any data in a database. If the delete request was successful, you will receive status 200. Unless  you will receive status 404.

I will delete “Jessica Jones” from the database to demonstrate this DELETE Request for you guys. You can follow these simple steps to delete any data from the database,

In the above workspace:

  1. Set your HTTP request to DELETE
    2. Copy the id of “Jessica Jones” and paste it right after the URL
    3. Click Send
    4. You will see 200 OK message that indicates the success of your request

Then send a simple GET request to the URL to make sure that the data has been successfully deleted from the database.

That is all and pretty simple. As you can see in this example, this is the way of how to achieve the basic GET, POST, PUT and DELETE request methods in postman to test your API.

Postman is a powerful tool for API testing. However, in order to achieve the best results and save time and effort, it must be used properly.

Summary:

What I have demonstrated above are only the basics of RESTful API testing in Postman. It has many more functionalities which are very useful for API testing and can be further extended. Postman is a powerful tool for API testing. However, in order to achieve the best results and save time and effort, it must be used properly. So invest some time to play around with it and you will soon be equipped enough to perform extensive API testing.

Leave a Reply

Close Menu