I have a collections of customers and each customer has a relationships resource that looks like this:
{ "customerId" : "string", "accounts" : [{ "accountId" : "string", ... }], "profiles" : [{ "profileId" : "string", ... }] } I am building a REST api to provide access to this resource and sub resources like accounts and profiles.
This is the URIs that I came up with:
- /customers/{id}/relationships - To return the above resource
- /customers/{id}/relationships/accounts - To return
accountssub resource - /customers/{id}/relationships/profiles - To return
profilessub resource
But one issue I see is that relationships resource looks like a collection. So it will be expected to have a {relationshipId} after that. But actually it is a single resource. How can I design URIs for this?