0
0
Postmantesting~20 mins

Path parameters in Postman - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Path Parameter Pro
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
1:00remaining
Understanding Path Parameters in API Requests

In Postman, what is the primary purpose of using path parameters in an API request URL?

ATo define the request body format
BTo specify dynamic parts of the URL that identify specific resources
CTo add query filters to the API request
DTo set HTTP headers for authentication
Attempts:
2 left
💡 Hint

Think about how URLs change to access different items in a collection.

Predict Output
intermediate
1:30remaining
Output of a Postman Request with Path Parameters

Given the API endpoint https://api.example.com/users/:userId/orders/:orderId and path parameters userId=42 and orderId=1001, what is the final URL sent by Postman?

Ahttps://api.example.com/users/1001/orders/42
Bhttps://api.example.com/users/:userId/orders/:orderId
Chttps://api.example.com/users?userId=42&orderId=1001
Dhttps://api.example.com/users/42/orders/1001
Attempts:
2 left
💡 Hint

Path parameters replace placeholders in the URL path, not query strings.

assertion
advanced
2:00remaining
Validating Path Parameter Usage in Postman Tests

Which Postman test script assertion correctly verifies that the userId path parameter in the request URL is 123?

Postman
pm.test('UserId path parameter is 123', () => {
  const url = pm.request.url.toString();
  // Assertion here
});
Apm.expect(pm.request.url.path[1]).to.eql('123');
Bpm.expect(pm.request.url.query.get('userId')).to.eql('123');
Cpm.expect(pm.request.url.variables.get('userId')).to.eql('123');
Dpm.expect(url).to.include('/users/123/');
Attempts:
2 left
💡 Hint

Path parameters appear in the URL path array, not in query or variables directly.

🔧 Debug
advanced
1:30remaining
Debugging Path Parameter Replacement Issue

A Postman request URL is https://api.example.com/items/:itemId/details. The path parameter itemId is set to 789, but the request is sent with the URL https://api.example.com/items/:itemId/details (no replacement). What is the most likely cause?

AThe path parameter <code>itemId</code> was not defined in the Postman collection or environment variables
BThe HTTP method is incorrect and prevents path parameter substitution
CThe request body is missing, causing the URL to not update
DThe server is rejecting the request and returning the original URL
Attempts:
2 left
💡 Hint

Check if the variable name matches exactly and is defined.

framework
expert
2:30remaining
Automating Tests for Path Parameters in Postman Collections

Which approach best automates testing multiple path parameter values in a Postman collection run?

AWrite a pre-request script that randomly generates path parameter values without external data files
BManually change the path parameter value in the URL before each request and run the collection multiple times
CUse a Postman collection runner with a CSV file containing different path parameter values and reference them in the URL
DUse Postman monitors to schedule requests without changing path parameters
Attempts:
2 left
💡 Hint

Think about how to run the same request multiple times with different inputs automatically.