Loading Depth Study
Preparing your workspace
Path parameters identify specific resources, while query parameters commonly control filtering, searching, sorting, and pagination.
A good REST API uses predictable resource-oriented URLs. A path such as /courses/123 identifies one specific course. Query parameters such as ?status=published&limit=20 can modify how a collection is retrieved without changing the identity of the resource. Consistent naming makes APIs easier to consume and document. URLs should generally describe resources rather than contain unnecessary action words.
An admin user page might use /users/123 for one user and /users?role=mentor&status=active for filtered users.
GET /api/courses/123 GET /api/courses?difficulty=beginner&published=true&limit=20
The first request identifies one course, while the second requests a filtered course collection.