4 ms·
Do you guys use plural or singular terms in your API endpoints or both? /books /books/:id /book /book/:id It gets harder to keep consistent when t
by trinovantes 5y ago
Do you guys use plural or singular terms in your API endpoints or both?
/books
/books/:id
/book
/book/:id
It gets harder to keep consistent when there are a lot of nouns that have the same singular/plural form like "clothing"
- imnitishng 5y agoBoth /books /book/:id
- systemvoltage 5y ago/clothes/:clothing_id The reason for using plural is because without the `:clothing_id`, `/clothes` endpoint would return a collection of clothing.
- akvadrako 5y agoI always prefer singular just because it's easier to spell if you know the type. It's stupid to have /geese return a Goose. If the APIs were in Esperanto it would be different.
- barefeg 5y agoWe use the form that represents a collection of objects. For example books and clothing both refer to a collection of things so I take them as valid forms