Back to All Questions
Question 19 of 100
Basic API Testing
Beginner
Q19: What are Path Parameters in API Requests?
🛣️Core Concept
What are Path Parameters in API Requests?
Key Takeaways & Architecture Summary
- ✓Embedded directly within the URL path string (separated by slashes).
- ✓Used to identify a specific, unique instance of a resource.
- ✓Represented as dynamic variables (e.g., /users/{id}) in documentation.
Direct Answer Summary
Path Parameters are variable placeholders embedded directly inside the URL path, separated by slashes (e.g., `/users/{userId}`). They act as primary keys to identify a specific, unique instance of a resource on the server.
⚠️ Senior Engineering Warning (Red Flag)
Do not confuse path parameters with query parameters. Path parameters act as identifiers for target resources; query parameters filter or slice the resource collections.
💡 STAR Architectural Explanation & Pro Tip
Path parameters model resource hierarchies. Changing a path parameter changes the unique resource identity being requested, which can lead to a 404 error if it does not exist.
RestAssuredTest.java
Rest-Assured + Java// Target URL: https://api.careerraah.com/v1/users/1024
RestAssured.given()
.pathParam("userId", "1024")
.when()
.get("https://api.careerraah.com/v1/users/{userId}");