Hi Everyone!
My name is Pooja and I am a brand new Postmanaut!
I am so excited to be here! One of my first challenges as a brand new Postmanaut is to go through the 30 days of Postman challenge.
Perhaps many of you may also be going through this challenge. With that in mind I figured I would start this thread with any notes I’ve taken on key insights and things I’ve gotten stuck on and managed to figure out along the way.
Hope this thread helps! Feel free to follow along.
4 Likes
Day 01
Today I learned that
https://postman-echo.com/get?user-agent:PostmanRuntime/7.29.0
≠
https://postman-echo.com/get?user-agent=PostmanRuntime/7.29.0
be careful when you copy user-agent
content . I copied everything with the colon and added it to my url and got this error :
it’s a pretty simple mistake but makes a world of a difference!
4 Likes
Day 02
Today I learned that there are 3 types of IDs in a collection. You have your collection ID which can be found at the collection top folder - which is different from the sub folder
In this case this collection ID lives in the top most folder which you’ve forked. It is in the info side panel.
Make sure to not confuse these with folder ID ( ID for any folders ) and furthermore a request ID which is ID for individual requests
4 Likes
Great idea sharing this stuff Pooja!
I’m excited to follow your progress
2 Likes
Day 03
I found it to be interesting feature that Initial values may be accessible to others in a team or public workspace whereas Current values are local, and not synced or shared.
It can be easy to add something sensitive like an API key to the Initial Value, so definitely be careful with that content and keep any secret info as a Current values! You will also get security notification if you do manage to share accidentally of course!
If that’s the case - make sure to revoke and regenerate your API key
1 Like
Day 04
Different ways to Authorize
Request level :
- Adding API key under the Header’s tab
- Adding API key as a query parameter under Param’s tab
- Adding API key from Type dropdown
API Key
from Authorization Tab
Folder level :
- Change Type in Authorization Tab of the request to Inherit auth form parent. Change Type to API key at folder level. Should be able to run all requests in the folder with this info
Collection level :
- One more abstraction - change Type at folder level to Inherit auth from parent and now at the collection level you can add Type API key to include API key header in all requests of all folders.
Day 05
There are multiple ways to add global variables!
The coolest feature is to highlight something you want to turn into a variable and give it the scope
Second way is to click the eye icon at top right and edit your global variables
1 Like
Day 06
Test snippets make it really easy to write some easy tests. You can click on any of the provided test snippets in the Test Tab. More info on writing tests here : https://learning.postman.com/docs/writing-scripts/test-scripts/
1 Like
Day 07
An interesting feature of consoles is being able to see timestamps as well. The following logs can be accepted while debugging :
console.log()
console.info()
console.warn()
-
console.error()
Also an interesting feature about the pre-request scripts vs. the test scripts is that the Pre-request Script will always run before a request is sent.
You can use this while you debug to understand which data is being processed first
1 Like
This is amazing Community will surely love it!
1 Like
Day 08
This was a relatively simple day, learning a powerful tool! The collection runner allows you to run multiple requests consecutively. It also allows you to iterate , see the summary of your tests, view and export the results.
The runner can be used for a variety of test cases - especially great if you have multiple requests in a collection and you would like to automate your testing process
Learn more about the runner here :
1 Like
Day 09
Things to keep in mind about variables as we think about scripting
- Collection Variables - Specific to Collection and independent of environment
- Environment Variables - Enable you to scope your work to different environments. One environment can be active at a time. Best used for - role-based access
- Global Variables - can be used across an entire workspace
In this challenge we are going to be chaining requests with variables using scripts
By default the Collection variables we see :
In the Post request (echo the user
) we are given a request body that has the following information.
To make life a little easier - lets group firstName and lastName to 1 variable called - Name
That way our Post request (echo the user
) can use 1 variable for name, 1 for email and 1 for id
The script will need to be written as a test in the Get request get random user
The idea here is to parse the output for the variables that are of interest!
You will need to think about parsing the output. Consider using console.log to parse the output
Hint → create a variable to Parse the JSON output :
let responseJSON = pm.response.json();
console.log(responseJSON)
Once you’ve parsed the response output - think about how you can get the interested feilds - name , email and uuid
Then you will need to use a script to set the variables - ideally at a collection level
1 Like
Day 10
Mocking services is a really interesting feature that allows you to simulate services without the overhead of setting up something real. This is great when you are interested in playing around with some expected output data if you don’t have that service created in real life.
Check out this page to learn about the many ways to set up a mock
Day 11
Something to keep in mind :
The postman.setNextRequest("request_name");
line won’t actually send anything . It just sets it up so that if you run something in the collection runner or in Newman, it allows you to control the next request. If you set the request name to null, it will end the collection runner.
pm.sendRequest(“https://postman-echo.com/get”, function (err, response) {
console.log(response.json());
});
This test sends a request immediately, so while you are debugging you can consider playing around with these options.
1 Like
@pooja-mistry Its really very useful. Thank you and Keep it up!!
2 Likes
Day 12
There are multiple ways to set variables. You can set them at collection level, global level and environment level. This challenge is about setting environment variables.
Some tests you can write to work with env variables :
set env variables : pm.environment.set("variable_key", "variable_value");
get env variables : pm.environment.get("variable_key");
clear env variables: pm.environment.unset("variable_key");
Hint for finding Workspace ID : Info at workspace level
I am waiting for further Day 13 and onwards, dont stop this
2 Likes
hello,
I’m in Day 03 with the error below:
I’m sure that I added the console.log in Rick and Morty request.
Do you know which step I need to update?
Thanks