DEV Community

Cover image for [Postman] The dev console
Daphné Hervé
Daphné Hervé

Posted on

[Postman] The dev console

From advanced to expert 
For developers and testers.  
         ---------          
Some great tutorials to get all Postman tips :
Enter fullscreen mode Exit fullscreen mode

Image description

Number 1 : we begin the tutorials with the dev console.
The console is very useful when you are coding your front or for testing purpose.

Breaking news - we will write some javascript inside !

For this tutorial we will need the dev console itself just here :

Image description
In the left corner on the bottom.

And the test tab in the request part, just here :

Image description

Create a get request to the free pokemon api without any parameters just this call :

https://pokeapi.co/api/v2/pokemon
Enter fullscreen mode Exit fullscreen mode

Should be like that :

Image description

Press the send button for submitting our request !
Alright, so far everything ok !

Image description

Let's take a deeper look to our main subject by clicking the console button on the bottom

Image description

All the call informations are properly retrieved.
And so what ?

Wait a minute, I mentioned some javascript, let's go !
Go to the test tab and write some js :

let pokemons = pm.response.json().results
pokemons.forEach(pokemon => console.log(pokemon.name))
Enter fullscreen mode Exit fullscreen mode

Should seems like that :

Image description

Click on the send button to see the result in the console !
Awww wow ! We have it ! A wonderful pokemon list !

Image description

We achieve our first goal : Use the postman console for debugging or testing.

Additional tips : you can clear the console on the right corner on bottom of postman.

Image description

Next steps :

  • Learning to use variables to do something with the pokemon list or any data you get.
  • Manage your environnement and keep your infos secret
  • Go further in the javascript methods
  • Learn to use the mock server
  • Go deeper with the automation ... and several very useful things !

Hope it helps !
Daphné Hervé (API, monitoring and QA automation lover)

Top comments (0)