Ruby on Rails - differentiating plural vs singular resource in a REST API

Posted by randombits on Stack Overflow See other posts from Stack Overflow or by randombits
Published on 2010-04-10T20:29:00Z Indexed on 2010/04/10 20:33 UTC
Read the original article Hit count: 376

Filed under:
|
|

I'm working on building the URLs for my REST API before I begin writing any code. Rails REST magic is fantastic, but I'm slightly bothered the formatting of a URL such as:

http://myproject/projects/5

where Project is my resource and 5 is the project_id. I think if a user is looking to retrieve all of their projects, then a respective HTTP GET http://myproject/projects makes sense. However if they're looking to retrieve information on a singular resource, such as a project, then it makes sense to have http://myproject/project/5 vs http://myproject/projects/5. Is it best to avoid this headache, or do some of you share a similar concern and even better - have a working solution?

© Stack Overflow or respective owner

Related posts about ruby-on-rails

Related posts about ruby