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:

  1. use singular all
  2. use plural (with stupid forms /api/logins)
  3. to inconsistent , use plural resources expect special resources /api/login or /api/profile used 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

Popular posts from this blog

php - Why I am getting the Error "Commands out of sync; you can't run this command now" -

linux - Does gcc have any options to add version info in ELF binary file? -

java - Are there any classes that implement javax.persistence.Parameter<T>? -