Powerful Debugging with the Postman Console

Avatar

If you didn’t already know about the power of the Postman Console, then prepare yourself for debugging hyperdrive.

If at first you don’t succeed, console.log() everything.

Ritwij Sinha, Postman software engineer

The Postman Console was originally designed to help debug Postman Collections and API network calls. While we’ve made a number of improvements since that original release, the basic principle remains the same: The console is where you go to dig deep and debug issues when your API and API tests aren’t behaving the way you expect them to.

Meet the console

At first glance, we have what appears to be a modest console. What lies behind this unassuming console is the power to see what’s going on under the hood. In a matter of moments, you’ll see helpful messages and details about the HTTP calls you make from Postman for more visibility while debugging.

To open the Postman Console: Use the keyboard shortcut (CMD/CTRL + ALT + C) in the Postman app, or go to the application menu > “View” > “Show Postman Console”.

The debugging power

Every network call sent with Postman is logged in the console in both its raw and pretty form, replacing all the variables that you’ve used in the request. In the console, you can inspect headers, certificates, requests, and responses. You can even use the console to log messages. 

Besides info about your network calls, most web developers are familiar with the idea of using a console for closer inspection and to see when something happens.

Web developers log messages for 2 general reasons:

  • Making sure that code is executing in the right order.
  • Inspecting the values of variables at a certain moment in time.

– Chrome DevTools 

Log a message in the console

  1. Open the Postman Console (CMD/CTRL + ALT + C).
  2. Under the Pre-request Script or Tests  tabs of the Postman app, write an expression, like console.log("I'm a boring old log").

  3. Click Send

When you send a request or run a collection of requests, your message will output to the Postman Console as a string or JavaScript object(s). If you’re familiar with the console.log() function in JavaScript, this is similar.

Here’s how the messages look in your console:

Recent improvements

Whether you’re old friends with the Postman Console or a newcomer, here are some of the latest enhancements:

  • More information about network calls, like status codes, time, asynchronous calls from within a script, and redirects
  • Support for new message types which can be filtered by type with highlighted errors and warnings
  • Configurable settings to show or hide network calls and display timestamps
  • Handling larger request and response bodies to view up to 10KB inline and up to 5MB when opened within the console
  • Running record of the last 5,000 logs and 24 hours of history

Go forth and debug

Keeping the console open while you work in Postman will increase the visibility of your network calls and logged messages. That way, you can track request executions, exceptions, and errors as they happen. These real-time insights can help you identify and fix errors quickly. 

The power of this console is limited only by your imagination, and also the last 5,000 messages and 24 hours. 

Watch and learn

Level up your Postman game with our short YouTube video that explains how to use the Postman Console for more visibility while debugging in one minute:

What do you think about this topic? Tell us in a comment below.