Re:How to (and how not to) design REST APIs
by AlexandrB on Wednesday November 01, 2023 @04:30PM
(#38104655)
Found a contradiction that I don't understand. From rule 1:
But then in Rule 2:
Shouldn't that be "/shops/{shop_id}/listings"? Or is it plural only if you can actually GET the path (i.e. there's no GET for just "/shop") and otherwise it should be singular?
[ Parent
| on HN ]
Re:How to (and how not to) design REST APIs
by robertlagrant on Wednesday November 01, 2023 @04:40PM
(#38104834)
Plural or singular seems far too marginal to be good or bad. I use singular.
Re:How to (and how not to) design REST APIs
by iterati on Wednesday November 01, 2023 @05:20PM
(#38105458)
Same. My table names are also singular.
Re:How to (and how not to) design REST APIs
by prisonality on Wednesday November 01, 2023 @06:17PM
(#38106130)
I use singular too, but I always wonder to those sticking with plural - what's the convention for words which plural and singular are the same.
ie - like 'staff' or 'species' or 'aircraft'.
Then I can add suffix to those singular ie - 'staffList', 'speciesList' etc
Re:How to (and how not to) design REST APIs
by stickfigure on Wednesday November 01, 2023 @04:33PM
(#38104718)
The `/shop/{shop_id}` example is Etsy's API. They apparently didn't read Rule #1.