API Fundamentals
/Beginner
Path Parameters
Definition
Variables embedded directly into the core structure of the URL path itself, used to identify a specific, unique resource.
Explain Like I'm New
Query params (`?id=5`) are for optional filters. Path params (`/users/5`) are for pointing at one exact, specific thing. It's the difference between asking 'Show me all users who happen to have the ID of 5' vs 'Take me exactly to User 5's house'.
Real World Example
Visiting a GitHub profile: `github.com/torvalds`. The word 'torvalds' is a path parameter. The server extracts it and searches for a user named Linus Torvalds.
Common Use Cases
- •Fetching single records
- •RESTful resource targeting
Interactive Example
Loading...
Console output will appear here...
Interview Questions
basic
- In the URL path `/users/:id/posts`, what does the colon (`:`) represent?
intermediate
- When designing an API to fetch a specific user, should you use `GET /users?id=123` or `GET /users/123`?