This is a more of an architectural question. And I am rather new two Rest.
Let's assume these resources /offers and /offers/:id. And the offer does have a single connection to an organization. My first thought was creating a resource: /offers/:id/organization This would be singular, because it feels unnatural to call the resource in plural, when there is always only one element returned.
First question: Would you always use plural no matter what?
This /offers/:id/organization/:id seems to be useless, because there is only one organization linked to the offer.
To make things complicated. The organizations need to be a separate resource as well: /organizations and /organizations/:id.
So basically I have to ways to achieve my goal. I could get the /offers. And then with the retrieved organizationId get /organization/:id. Or I could nest the organization into the offer that I get everything in one request either /offers or /offers/:id.
The second option would potentially get rid of /offers/:id/organization(s). Except I wanted to get the organization by the offerId and not be the organizationId. (One organization has cn offers).
Second question: When there is a standalone resource, i.e /organization, should I bother of implementing a nested resource as well /offer/:id/organization(s).
There is also the issue of how to implement the services (i am using jersey) if the organization is available at /offers/:id/organization(s) but that is probably a Question on its own.
Any thoughts?
REST.