3 ms·
how do you differentiate between plural vs singular of: `GET /staff` ?
by prisonality 3y ago
how do you differentiate between plural vs singular of:
`GET /staff`
?
- stickfigure 3y agoI don't? It's fine. I'm also fine just adding an 's' to many words that have unusual plurals; English is flexible, and "persons" is a perfectly acceptable substitute for "people". That said, I don't love your example. Staff does have a plural, staffs - as in, the separate staffs of multiple organizations.
- prisonality 3y agowhat's your opinion of using suffix like '_list' to differentiate it ? ie: GET /species and GET /species_list ?
- stickfigure 3y agoSeems weird. Of all the rules, #1 one is by far the most arbitrary and least important. But it's also a thoroughly established convention. If you want to present "this is a normal, boring API with few surprises" to your clients, I wouldn't recommend odd collection suffixes. But it's not going to fundamentally change the usability of your API, unlike many of the other rules.
- bonzini 3y agoThe case of having a singular at the end of a GET is so rare that it should be easy to disambiguate. I have a project where one of the main objects is a "series", it's clear what "GET /series" and "GET /series/ID" means to anyone that has seen a REST API.