In Postman, what is the primary purpose of using path parameters in an API request URL?
Think about how URLs change to access different items in a collection.
Path parameters are used to specify dynamic segments in the URL that point to specific resources, like user IDs or product codes.
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?
Path parameters replace placeholders in the URL path, not query strings.
Path parameters replace the placeholders in the URL path with actual values, forming the final URL.
Which Postman test script assertion correctly verifies that the userId path parameter in the request URL is 123?
pm.test('UserId path parameter is 123', () => {
const url = pm.request.url.toString();
// Assertion here
});Path parameters appear in the URL path array, not in query or variables directly.
In Postman, pm.request.url.path is an array of path segments. The userId is usually the second segment if the path is like /users/123.
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?
Check if the variable name matches exactly and is defined.
If the path parameter variable is not defined in Postman environment or collection variables, Postman cannot replace the placeholder in the URL.
Which approach best automates testing multiple path parameter values in a Postman collection run?
Think about how to run the same request multiple times with different inputs automatically.
Using the collection runner with a CSV file allows you to supply multiple sets of path parameter values and run tests automatically for each set.