What is API

API is an acronym for Application Programming Interface. For example, we want to get data from the webserver. Now the application will send the request to the server and get the data back and present it to us in a human-readable format. This is what API does.

Creating API Request in Postman

The first step of creating a new API request is to create a new workspace so that all the requests can be distinguished from each other. To create a new workspace, start the POSTMAN software and click on the My Workspace icon.

When you click on the My Workspace Button, then you will see a create new option popping out. Click on that, and name a new workspace.

The workspace name can be any name. In my case, I have named it with workspace01. And then, click the Create Workspace button at the bottom.

Click the New button on the top left corner of the POSTMAN homepage interface, and once you click the button, a drop-down menu appears that contains all the shortcuts.

Select the request option from the drop-down list.

Now, as you click on the Request option, you will be prompted to enter a request name.

We will be using the website, http://reqres.in for testing the API.

Now, as we scroll down the page (http://reqres.in), you will see that several Requests are listed there. We shall select the Single User. So, click the Single User and then copy the URL from the search bar. And copy the request endpoint.

Now open a new tab in the browser type the main URL along with the Request endpoint. Once you press enter after giving the complete link(http://reqres.in/api/users/2) into the URL bar. You must see the response from the server.

After that, add a name to the Request and create a new collection and save the request and the collection as well.

In my case, the request name is the Get Response, and the collection name is Collection01.

Now, copy the request URL(http://reqres.in/api/users/2) and paste it into the URL bar in the POSTMAN.

Once done, now simply click the send button.

Then, you must see the response as below:

So far we have seen how we create our first API and get the response. Now that are different methods such as POST, GET, PUT, UPDATE, etc which can be used to update, retrieve or insert data into the server. In our next section, we shall see how different methods can be used in POSTMAN.

Postman Interview Questions

Methods in POSTMAN

There are different methods in which are available in POSTMAN that can be used while sending the request to get the response or to change the data on the server. In the POSTMAN, there is a drop-down button beside the request URL bar where you can select the type of method you want to use. The different types of methods are:

  • GET
  • POST
  • PUT
GET Method

The GET method is used to access the data from the server. First Select the GET method from the drop-down button beside the URL bar and then copy the API request address:

Visit the link: http://reqres.in

And then select a GET method Request:

Copy the main URL and then copy the request end-point and then paste it into the URL bar and set the method type as GET.

Enter the request URL as:



As you can see, I require the details of the person whose id is 4. Therefore, I have added my query as: ?id=4 in the request end-point.

Now, click on the Send button and see what is the response. You will see the details of only one person whose id is 4.

Response :

    "data": {
        "id": 4,
        "email": "[email protected]",
        "first_name": "Eve",
        "last_name": "Holt",
        "avatar": "https://s3.amazonaws.com/uifaces/faces/twitter/marcoramires/128.jpg"
POST Method

The POST method is there to create new data into the server. First Select the POST method from the drop-down button beside the URL bar and then copy the API request address:

Visit the link: http://reqres.in

And then select a POST method Request:

And then after selecting the method type as POST and pasting the Request URL, go into the body section and click into the raw and edit field you want. I have edited the field- name as I want to create a new people called Rahul.

Now, click the Send button and see the response.

The response is:

    "name": "Rahul",
    "job": "leader",
    "id": "221",
    "createdAt": "2019-10-21T10:42:44.974Z"

So, you can see that the name is now Rahul.


The PUT method is mainly used to update attributes of existing details in the server. First Select the PUT method from the drop-down button beside the URL bar and then copy the API request address:

Visit the link: http://reqres.in

And then select a PUT method Request:

Now, go to the POSTMAN software, and change the method type as PUT and then paste the Request URL along with the request end-point.

Once, you click the Send button, the request will be sent and response will be generated. Now, copy a part of the response you want to update and paste it into the raw code editor under the body section.

I have already copied the response, so directly paste below code into the raw code section:

            "id": 2,
            "email": "[email protected]",
            "first_name": "Riya",
            "last_name": "Weaver",
            "avatar": "https://s3.amazonaws.com/uifaces/faces/twitter/josephstein/128.jpg"

Now, paste the same code into the body section under raw code:

Now, change the value of any attribute in the raw code section and send the request again. I shall change the value of the attribute first_name. I shall change it from Riya to Alexa.

Now, click the Send button and check the response. The response, I got, is below:

    "id": 2,
    "email": "[email protected]",
    "first_name": "Alexa",
    "last_name": "Weaver",
    "avatar": "https://s3.amazonaws.com/uifaces/faces/twitter/josephstein/128.jpg",
    "updatedAt": "2019-10-22T03:02:34.831Z"

You can see that in the response, the first_name value has been updated to Alexa.


In the case of the PUT method, when any field or attribute information has to be updated then the complete record for that attribute has to be updated. Even if you have to update a single field, then also the entire record has to be pasted into the raw section and then the request has to be sent.

But in the case of the PATCH method, you can just mention the parameters which directly address the record can be used to update the record.

For example, in my case, I will be using the attribute id for identifying my individual records.

First, I check the record by appending the id (anyone you want, I used id =2)with the request URL.

Edit the request URL as:


Click the Send button, and send the request using the GET method to see the response.

Now, copy change the method type into PATCH and then change the value of the email, by editing in the body-raw section.

Now, click the Send button to send the request and see the response from the server. See below image, that the response of the server says, that the email has been updated.


Any record from the database can be deleted using the DELETE method in POSTMAN. To delete a record, we need an attribute that uniquely identifies the record. In my case, it is the id.

Edit the Request URL as:



Now, click on the Send button to execute the Request. As the response must be like below:

In the above image, you can see that there are no values returned from the server. Now, the status code is 204 No Content. It means, that the request is executed successfully, but no data record with id=2 has been received from the server. It means the record with id-2 has been deleted from the server.


Options method is for indicating which methods can be applied to requests. In a particular request, we may be able to apply the GET method but not the POST method.

Let us see with an example. We shall use the same Request URL as we are using, and then select the method type as Option. Then click the Send button, and see the header section of the response.

In the above image, you can see that the method type is: OPTIONS. And so in the response, under the Header section, the Access-Control-Allow-Method is: GET, HEAD, PUT, PATCH, POST, DELETE. It means these methods are suggested by POSTMAN and can be applied to the given Request URL.

HEADER Method will not retrieve the body from the server. This method is basically used to retrieve the header content from the server, which contains the meta-data information, content length, and the data and time of the response.

The HEAD method can be used to ping the server to check whether a request is working fine. Also, it can be used to validate the content type and the request.

To use the HEAD method, just change the method type into HEAD and then click on the Send button to send the request.

In the above image, you can see that the content-type is shown, along with the date, etc.

Postman Javascript

Postman Workflow

Generating Code Snippets of Requests

With the help of Code Snippets, requests can be translated into codes and can be executed in the form of codes. In the below example we shall see how to generate codes corresponding to a request.

Enter the request URL into the Request Bar and then click the code link into(on the right side of the POSTMAN interface).

Once you click on the code link, you will see a different option for languages into which you want to translate your request code. Some of the options are:

  • JSON
  • PHP
  • C#
  • JSON
  • JAVA
  • Javascript
  • etc.

Once you click into the code link, you must see the below window as follows:

I have selected my language of choice as cURL, so it's like:

Editable code:

curl -X GET 
  -H 'Accept: */*' 
  -H 'Accept-Encoding: gzip, deflate' 
  -H 'Cache-Control: no-cache' 
  -H 'Connection: keep-alive' 
  -H 'Cookie: __cfduid=d9197045e87789f8024fb186385a5f1891570648581' 
  -H 'Host: reqres.in' 
  -H 'Postman-Token: aa9dfa22-3fd7-49e2-99c9-7d7cd277004d,57c7f45b-28f7-4ee8-a8dd-55dff1ede11f' 
  -H 'User-Agent: PostmanRuntime/7.18.0' 
  -H 'cache-control: no-cache'

Now copy the code into the cmd or terminal of your system and hit an enter to run the Request.

After hitting enter you will get the response from the server into the command prompt itself.

{"page":1,"per_page":6,"total":12,"total_pages":2,"data":[{"id":1,"email":"[email protected]","first_name":"George","last_name":"Bluth","avatar":"https://s3.amazonaws.com/uifaces/faces/twitter/calebogden/128.jpg"},{"id":2,"email":"[email protected]","first_name":"Janet","last_name":"Weaver","avatar":"https://s3.amazonaws.com/uifaces/faces/twitter/josephstein/128.jpg"},{"id":3,"email":"[email protected]","first_name":"Emma","last_name":"Wong","avatar":"https://s3.amazonaws.com/uifaces/faces/twitter/olegpogodaev/128.jpg"},{"id":4,"email":"[email protected]","first_name":"Eve","last_name":"Holt","avatar":"https://s3.amazonaws.com/uifaces/faces/twitter/marcoramires/128.jpg"},{"id":5,"email":"[email protected]","first_name":"Charles","last_name":"Morris","avatar":"https://s3.amazonaws.com/uifaces/faces/twitter/stephenmoon/128.jpg"},{"id":6,"email":"[email protected]","first_name":"Tracey","last_name":"Ramos","avatar":"https://s3.amazonaws.com/uifaces/faces/twitter/bigmancho/128.jpg"}]}

Postman Sessions

About Author :

I am Pavankumar, Having 8.5 years of experience currently working in Video/Live Analytics project.

Comment / Suggestion Section
Point our Mistakes and Post Your Suggestions