Powerful Debugging with The Postman Console

“If at first you don’t succeed, console.log() everything.” –Ritwij Sinha, Postman software engineer

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

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 (see the list at the bottom of this post), the basic principle remains the same: The console is where you go to dig deep and debug issues in a streamlined way 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 and unassuming console — but don’t be fooled! What lies behind this blank canvass is the robust power to handle everything from large request and response bodies to a running record of the last 5,000 logs. In a matter of moments, you’ll be able to use helpful messages and rich data about the HTTP calls you make from Postman to improve your overall debugging activities.

To open the built-in 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. The debugging process is streamlined for you by all of the things that you can do directly in the console, like inspect your headers, your certificates, and your requests and responses. You can even use the console to log messages. 

  

Log a message in the console

  1. Insert an expression, like console.log(“Hello from Postman!”), into apre-request or test script and run the call.

  2. Write an expression in the “Pre-request Script” tab. 
  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 that we think you’ll find useful:

  • 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

We recommend keeping the console open while you work in Postman to 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 will help you identify and fix errors quickly.

The power of the Postman console is limited only by your imagination (and also the last 5,000 logs and 24 hours, of course). We’d love to hear about all the cool and creative ways that you use the console in your daily work. Share your debugging stories with us on Twitter via @getpostman !

 

Author: Joyce

Developer Advocate. Makes dank memes.