Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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"


I 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.


  /clothes/:clothing_id
The reason for using plural is because without the `:clothing_id`, `/clothes` endpoint would return a collection of clothing.


We 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


Both

  /books
  /book/:id




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

Search: