Mixing REST API plural and singular for different resources? -
plural form rest api more natural , more used e.g. /api/users or api/users/123.
but resources not natural e.g.:
/api/login- log in exact 1 user/api/profile- profile of logged user
this resources never used more 1 object/model in app.
on other hand read mixing plural , singular form in resources names not practice (http://pages.apigee.com/web-api-design-ebook.html).
so consider do:
- use singular all
- use plural (with stupid forms
/api/logins) - to inconsistent , use plural resources expect special resources
/api/loginor/api/profileused 1 object/model.
what better approach?
there no strict guidelines defining restful api, read common sense should have upper hand.
therefore, option 3:
to inconsistent , use plural resources expect special resources /api/login or /api/profile used 1 object/model.
is logical. should able guess url when think "i need resource x, how url like"?
Comments
Post a Comment