Challenge - 5 Problems
Postman Data Chaining Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ Predict Output
intermediate2:00remaining
What is the value of the variable after extraction?
You run this Postman test script after a response:
Given the response body:
What will be the value of the environment variable
pm.test("Extract userId", () => {
const jsonData = pm.response.json();
pm.environment.set("userId", jsonData.user.id);
});Given the response body:
{"user": {"id": 42, "name": "Alice"}}What will be the value of the environment variable
userId?Attempts:
2 left
💡 Hint
Remember that environment variables in Postman are stored as strings.
✗ Incorrect
Postman environment variables always store values as strings, even if the original data is a number.
❓ assertion
intermediate2:00remaining
Which assertion correctly uses extracted data in the next request?
You extracted a token in the first request and saved it as an environment variable
authToken. Which assertion in the next request correctly checks the token is used in the header?Attempts:
2 left
💡 Hint
Use pm.environment.get to access environment variables in scripts.
✗ Incorrect
To access environment variables in test scripts, use pm.environment.get('authToken'). The header value should be 'Bearer ' plus that token string.
🔧 Debug
advanced2:00remaining
Why does the next request fail to use extracted data?
You extracted a sessionId in the first request with:
In the next request, you use the header:
But the request fails with unauthorized error. What is the most likely reason?
pm.environment.set('sessionId', pm.response.json().session.id);In the next request, you use the header:
Authorization: Bearer {{sessionId}}But the request fails with unauthorized error. What is the most likely reason?
Attempts:
2 left
💡 Hint
Check if the environment selected for the next request is the same as where the variable was saved.
✗ Incorrect
If the next request runs in a different environment, it won't have access to the variable saved in the previous environment.
🧠 Conceptual
advanced2:00remaining
What is the best way to pass extracted data between requests in Postman?
You want to extract a userId from one request and use it in multiple subsequent requests. Which method ensures the data is available across all requests in the collection?
Attempts:
2 left
💡 Hint
Local variables only exist during one request execution.
✗ Incorrect
Environment variables persist across requests within the same environment and are best for sharing data between requests.
❓ framework
expert3:00remaining
How to chain requests using extracted data with Postman Collection Runner?
You have a collection with two requests: Login and GetProfile. Login extracts a token and saves it as environment variable
Which setup ensures the Collection Runner correctly passes the token from Login to GetProfile?
token. GetProfile uses this token in the Authorization header.Which setup ensures the Collection Runner correctly passes the token from Login to GetProfile?
Attempts:
2 left
💡 Hint
Collection Runner uses the selected environment to share variables between requests.
✗ Incorrect
Using pm.environment.set saves the token in the selected environment, which is accessible by all requests in the collection run.