News for hackers. Stuff that matters.
Re:How to Design Better APIs by trinovantes on Saturday March 12, 2022 @12:04AM (#30649130)
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"
Re:How to Design Better APIs by akvadrako on Saturday March 12, 2022 @02:17AM (#30649615)
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.

Re:How to Design Better APIs by systemvoltage on Saturday March 12, 2022 @12:32AM (#30649218)

  /clothes/:clothing_id
The reason for using plural is because without the `:clothing_id`, `/clothes` endpoint would return a collection of clothing.
Re:How to Design Better APIs by barefeg on Saturday March 12, 2022 @03:54AM (#30650052)
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
Re:How to Design Better APIs by imnitishng on Saturday March 12, 2022 @12:09AM (#30649144)
Both

  /books
  /book/:id