News for hackers. Stuff that matters.
Re:How to (and how not to) design REST APIs by jacknews on Wednesday November 22, 2023 @08:45PM (#38388137)
"Rule #1: DO use plural nouns for collections"

I disagree, as you then have to deal with English pluralization rules to match single objects and collections.

Also database tables should just be singular, things like 'country.id' makes more sense than 'countries.id'.

Also no discussion of versioning?

Re:How to (and how not to) design REST APIs by acheong08 on Wednesday November 22, 2023 @08:50PM (#38388186)
It would be countries[i].id (or country.id in a forEach)
Re:How to (and how not to) design REST APIs by LAC-Tech on Wednesday November 22, 2023 @08:51PM (#38388191)
English pluralisation rules are a non issue. 1.5 billion people world wide speak English, and I'll forgive some of them if they accidentally make a gooses URL instead of a geese one.
Re:How to (and how not to) design REST APIs by jacknews on Wednesday November 22, 2023 @09:27PM (#38388470)
Why have plural at all. All rest urls except index, which is easily discernible because it has no id, make more sense in the singular:

  get /ticket/12
  patch /ticket/12
  put /ticket
The problem is not humans getting confused by 'gooses', but that sometimes your code has to do the mapping, and there are plenty of edge-cases. Just avoid the issue entirely by sticking with singular throughout.