Hacker News new | past | comments | ask | show | jobs | submit login

Many of your examples are changing the query string, not the resource path. That's an important designation in REST semantics. REST APIs shouldn't use query strings for accessing singular records with IDs, that's what direct resource paths are for. Anything accessed with a query string should be treated as a search.

/api/v1/employees/100 - direct path to a resource. 404 if it doesn't exist.

/some_photo.jpg - direct path to a file/resource. 404 if it doesn't exist.

/photo/100 - direct path to resource: photo ID 100. 404 if it doesn't exist.

/photo?id=100 - search for a photo with ID "100". Return a code 200 with an empty results set if that ID is not found. (With optional application-specific error feedback in the response body.) 404 if /photo doesn't exist at all.




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: