Path parameters let you send different values in the URL to get specific data. They help make your API requests flexible and dynamic.
Path parameters in Postman
https://api.example.com/resource/{parameterName}Use curly braces {} to mark the path parameter in the URL.
In Postman, you replace {parameterName} with actual values when sending requests.
{userId} is a path parameter to get a specific user's data.https://api.example.com/users/{userId}{orderId} as the path parameter.https://api.example.com/orders/{orderId}/items{productCode}.https://api.example.com/products/{productCode}/reviewsThis example shows a GET request to fetch user details by replacing {userId} with 12345 in Postman.
GET https://api.example.com/users/{userId}
// In Postman, set path parameter userId to 12345
// Expected response:
// {
// "id": "12345",
// "name": "Alice",
// "email": "alice@example.com"
// }Always define path parameters clearly in your API documentation.
In Postman, you can add path parameters in the Params tab or directly in the URL by replacing the placeholders.
Path parameters are different from query parameters; path parameters are part of the URL path.
Path parameters make URLs dynamic by allowing variable parts.
Use curly braces {} to mark path parameters in URLs.
In Postman, replace path parameters with actual values before sending requests.
Practice
Solution
Step 1: Understand URL structure in APIs
URLs can have fixed and variable parts. Variable parts are called path parameters.Step 2: Role of path parameters in Postman
Path parameters allow you to replace parts of the URL dynamically to test different data.Final Answer:
To make URLs dynamic by allowing variable parts -> Option CQuick Check:
Path parameters = dynamic URL parts [OK]
- Confusing path parameters with headers
- Thinking path parameters set HTTP methods
- Mixing path parameters with request body
Solution
Step 1: Identify path parameter syntax in Postman
Postman uses curly braces {} to mark path parameters in URLs.Step 2: Compare options
Only /users/{userId} uses curly braces correctly: /users/{userId}.Final Answer:
/users/{userId} -> Option AQuick Check:
Curly braces = path parameters in Postman [OK]
- Using colon : instead of curly braces
- Using square brackets [] or angle brackets <>
- Omitting braces around parameter name
https://api.example.com/users/{userId}/posts/{postId} and path parameters userId=42 and postId=7, what is the final URL sent by Postman?Solution
Step 1: Replace each path parameter with its value
Replace {userId} with 42 and {postId} with 7 in the URL.Step 2: Construct the final URL
The URL becomes https://api.example.com/users/42/posts/7 after substitution.Final Answer:
https://api.example.com/users/42/posts/7 -> Option AQuick Check:
Substitute parameters correctly = final URL [OK]
- Leaving curly braces in final URL
- Swapping parameter values
- Using parameter names instead of values
https://api.example.com/items/{itemId} in Postman but forgot to set the path parameter itemId. What will happen when you send the request?Solution
Step 1: Understand missing path parameter behavior
If a path parameter is not set, Postman does not replace it automatically.Step 2: Effect on request URL and response
The URL is sent with {itemId} literally, likely causing server error or 404.Final Answer:
Postman sends the URL with {itemId} unchanged, causing a 404 or error -> Option DQuick Check:
Unset path parameter = URL unchanged, error likely [OK]
- Assuming Postman auto-fills missing parameters
- Expecting Postman to remove missing parameters
- Thinking Postman prompts automatically
/orders/{orderId}/items/{itemId} in Postman. You have a list of order IDs and item IDs. Which approach correctly tests all combinations using path parameters?Solution
Step 1: Understand testing multiple parameter combinations
Testing all combinations manually is slow and error-prone.Step 2: Use Postman collection runner with CSV data
CSV file with columns orderId and itemId lets Postman run requests for each row, replacing path parameters automatically.Final Answer:
Use Postman collection runner with a CSV file containing orderId and itemId columns -> Option BQuick Check:
Collection runner + CSV = efficient parameter testing [OK]
- Testing combinations manually one by one
- Hardcoding URLs instead of using parameters
- Setting only one parameter in environment variables
Ready to prove it?
Pass the test and this pattern moves unknown
