API Testing using Postman | Example

Postman is a powerful GUI platform to make your API development and Testing faster & easier, from building API requests through testing, documentation and sharing.

Sending API Request using Postman

You can create and save a request from the:

  • Request builder
  • New button
  • Launch screen

Using the request builder

  1. In the request builder, select a method and add the request URL.
  2. Click the Save button.
  3. In the SAVE REQUEST screen:
    • Enter a title and description for your request.
    • Select a collection and save the request in it.
    • Click the Save button.

For more information about the request builder, see Request builder in this topic below.

Using the New Button

  1. In the header toolbar, click the New button.

new button

The “Create New” screen appears.

create screen

  1. In the SAVE REQUEST screen:
    • Enter a title and description for your request.
    • Select a collection and save the request in it.
    • Click the Save button.

After you save the request, you can add the URL, method, headers, and body to the request in the builder.

Using the Launch screen

The “Create New” screen appears by default when you launch Postman. (At the bottom of the screen you can select “Show this window at launch” to indicate whether you want the “Create New” screen to display each time you open Postman.

  1. Open Postman.
  2. In the “Create New” screen, click “Request”.
  3. In the SAVE REQUEST screen:
    • Enter a title and description for your request.
    • Select a collection and save the request in it.
    • Click the Save button.


In Workspaces, you can create any kind of HTTP request quickly. The four parts of an HTTP request are the URL, method, headers, and the body. Postman gives you tools to work with each of these parts.



The URL is the first thing that you would be setting for a request. The URL input field stores previously-used URLs and will show an autocomplete dropdown as you begin entering your URL.

Clicking on the Params button opens up the data editor for entering URL parameters. You can individually add key-value pairs and Postman will combine everything in the query string above. If your URL already has parameters – for example, if you are pasting a URL from some other source, Postman will split the URL into pairs automatically.

Note: Parameters you enter in the URL bar or in the data editor will not automatically be URL-encoded. Right click on a piece of selected text, and select “EncodeURIComponent” to manually encode the parameter value.

Note: Postman will automatically add http:// to the beginning of the URL if no protocol is specified.

url and parameters section

Some API endpoints use path variables. You can work with those in Postman. Below is an example of a URL with a path variable:


To edit the path variable, click on Params to see it already entered as the key. Update the value as needed. For example, :entity can be “user” in this specific case. Postman will also give you suggestions to autocomplete the URL.

edit path variables


Clicking on the Headers tab will show the headers key-value editor. You can set any string as the header name. The autocomplete dropdown will provide suggestions of common HTTP headers as you type in the fields. Values for the “Content-Type” header are also available in an auto-complete drop down.

autocomplete headers

Note on restricted headers: If you’re using the Postman Chrome app, some headers are restricted by Chrome and the XMLHttpRequest specification. However, sending restricted headers is simple using the Interceptor extension.


Cookies can be managed in native apps by using the cookie manager to edit cookies associated with each domain. To open the modal, click the Cookies link under the Send button. Learn more about managing cookies.

manage cookies modal

Header presets

You can save commonly used headers together in a header preset. Under the Headers tab, you can add a header preset to your request by selecting “Manage Presets” from the Presetsdropdown on the right.

preset headers


Changing the request method is straightforward, using the control dropdown. The request body editor area will change depending on whether the method can have a body attached to it or not.

url methods

Request Body

While constructing requests, you will be working with the request body editor a lot. Postman lets you send almost any kind of HTTP request. The body editor is divided into 4 areas and has different controls depending on the body type.

Note about Headers: When you are sending requests through the HTTP protocol, your server might expect a Content-Type header. The Content-Type header allows the server to parse the body properly. For form-data and urlencoded body types, Postman automatically attaches the correct Content-Type header so you don’t have to set it. The raw mode header is set when you select the formatting type. If you manually use a Content-Type header, that value takes precedence over what Postman sets. Postman does not set any header type for the binary body type.



multipart/form-data is the default encoding a web form uses to transfer data. This simulates filling a form on a website, and submitting it. The form-data editor lets you set key-value pairs (using the data editor) for your data. You can attach files to a key as well. Note: due to restrictions of the HTML 5 spec, files are not stored in history or collections. You will need to select the file again the next time you send the request.

Uploading multiple files each with their own Content-Type is not supported yet.


urlencoded data

This encoding is the same as the one used in URL parameters. You just need to enter key-value pairs and Postman will encode the keys and values properly. Note that you cannot upload files through this encoding mode. There might be some confusion between form-data and urlencoded so make sure to check with your API first.


raw data

A raw request can contain anything. Postman doesn’t touch the string entered in the raw editor except replacing environment variables. Whatever you put in the text area gets sent with the request. The raw editor lets you set the formatting type along with the correct header that you should send with the raw body. You can set the Content-Type header manually too and this will override the Postman defined setting. Selecting XML/JSON in the editor type enables syntax highlighting for your request body and also sets the Content-Type header.

Tip: Selecting text in the editor and pressing CMD/CTRL + B can beautify the XML/JSON content automatically.


binary data

Binary data allows you to send things which you can not enter in Postman, for example, image, audio, or video files. You can send text files as well. As mentioned earlier in the form-data section, you would have to reattach a file if you are loading a request through the history or the collection.


Ensuring that the API response is correct is something that you will be doing a lot when working with APIs. The Postman response viewer will make this task much easier for you.

An API response consists of the body, headers, and the status code. Postman organizes body and headers in different tabs. The status code with the time taken to complete the API call is displayed next to the tabs. You can hover over the status code to get more details about the code. Mostly it will be the default description as mandated by the HTTP specification, however, API authors can also add custom messages.

Saving responses

save response button

If a request has been saved in a collection, you can save responses for that request. Once the response has been returned, click the Save Response button. Enter a name to call your saved response. All responses saved for a request will be available as an example whenever you load the request. Click the Examples dropdown in the top right to view and select the saved examples.

access saved responses

Viewing responses

The Postman Body tab gives you several tools to help you make sense of things quickly. The body can be viewed in one of three views – pretty, raw, and preview.


pretty view

The pretty mode formats JSON or XML responses so that they are easier to look at. Nobody wants to scroll through a minified single line JSON response looking for that elusive string! Links inside the pretty mode are highlighted and clicking on them can load a GET request in Postman with the link URL. For navigating large responses, click on the down-pointing triangles (▼) on the left to collapse large sections of the response.

For Postman to automatically format the body, make sure the appropriate Content-Type header is returned. If the API does not do this, then you can force formatting through JSON or XML. You can force JSON formatting under the General tab within the SETTINGS modal by selecting “JSON” from the “Language detection” dropdown.

Finding items in responses: You can use CMD/CTRL + F to open the search bar, and CMD/CTRL + G to scroll through results. See complete set of keyboard shortcuts.


raw view

The raw view is just a big text area with the response body. It can help to tell whether your response is minified or not.


view as preview

The preview tab renders the response in a sandboxed iframe. Some web frameworks by default return HTML errors and the preview mode is especially helpful there. Due to iframe sandbox restrictions, JavaScript and images are disabled in the iframe.

You can maximize the body to occupy the whole Postman window. In case you plan on spending a lot of time with the response, this is the way to go.

If your API endpoint returns an image, Postman will detect and render it automatically. For binary response types, you should select “Send and download” which will let you save the response to your hard disk. You can then view it using the appropriate viewer. This gives you the flexibility to test audio files, PDFs, zip files, or anything that the API throws at you.


headers tab

Headers are displayed as key-value pairs under the Headers tab. Hovering over the header name can give you a description of the header according to the HTTP spec. If you are sending a HEAD request, Postman will show the headers tab by default.

Response time

Postman automatically calculates the time it took for the response to arrive from the server. This is useful for some preliminary testing for performance.

Response size

Postman breaks down the response size into body and headers. The response sizes are approximate.


Cookies sent by the server are visible in a dedicated tab. To manage cookies in Postman the native apps, use the MANAGE COOKIES modal. If you’re working in the Postman Chrome app, you can use the Interceptor extension to help manage cookies.


Along with everything that you get from the server for the request, you can also see the results of the tests that were run against the request. Learn more about testing in Postman.

Reference: https://www.getpostman.com/docs/postman © PostMan


This is a open-source international community to improve software testing practices, send your post here


Leave a Reply