X
Popular Searches

How To Debug APIs With Postman

Postman is a program and toolkit that makes working with, developing, and debugging remote API services easier. It provides a platform for creating, managing, and working with GET and POST requests.

What Is Postman?

Postman describes itself as a “Platform for API Development.” At its most basic level, it provides a simple GUI interface for interacting with remote APIs. It’s essentially a state of the art REST client, designed for working with complex APIs.

On top of just being a great REST client, it also features tools for managing collections of requests. Using these collections, and a knowledge of the API schema, it can run fully automated API tests, which can be integrated in CI/CD pipelines to ensure that any code changes don’t break the API in production.

Using Postman

To get started, we’ll test a basic request. You can save multiple requests into Collections, which can be reused and shared.

In Postman, each request has its own tab in the workspace. You’ll find controls for the request settings, as well as output from the server. If you’re using it in full screen, you can swap it to side-by-side column mode with the button in the bottom right.

You can modify the request type from the dropdown on the URL bar. The most common methods are GET and POST, but all HTTP verbs are fully supported.

Under the “Authentication” tab, you’ll need to set up the auth keys for the API you’re using, unless it’s public. Postman supports OAuth 1 and 2, as well as most other token types alongside Basic Auth.

Under “Headers,” you can set the headers of the message, such as Content-Type. Many of these will be set automatically, which you can view under the “Hidden” button.

For the body of the request, you can specify form data using key-value pairs, send a binary package, a GraphQL request, or just send raw JSON or text data. The editor includes a built-in JSON editor and validator.

One of the coolest things you can do with Postman is set up API tests—these are coded in JavaScript, and run after the result has been received. You can read more about setting them up from Postman’s guide to using them

Once you’ve prepared your request, you can test it with the “Send” button. You should get a response from the remote server, which you can view in Pretty-print, HTML preview, or just raw output. You can see various stats, like the HTML response code, payload size, and ping, in the status bar above the

You can also change the dropdown from “Body” to “Header” to view the headers that the API returned.

Using the JavaScript testers, you can also create simple data visualizations, like pie and bar charts, which can be useful for making sense out of a lot of data.

If you’d like to come back to it, or save the test, you can save it to a “Collection.” You can then use the Collection Runner from the top menu bar to run all the requests and tests in the collection, which can be used to unit test all API endpoints.

Anthony Heddings Anthony Heddings
Anthony Heddings is the resident cloud engineer for LifeSavvy Media, a technical writer, programmer, and an expert at Amazon's AWS platform. He's written hundreds of articles for How-To Geek and CloudSavvy IT that have been read millions of times. Read Full Bio »

The above article may contain affiliate links, which help support CloudSavvy IT.