I am defining a REST API, one of the end points would match a resource (not exactly like that, but analogous) that holds a M-N relationship, for instance, let's says permissions by user, so a user could have read/write.... I was thinking of mapping to get it like:
/permissions/{user}
That would represent what I am interested in representing, but that would bring back an array of permissions rather than just one object, in an Id request. Is that something that would be RESTFUL? How would it be represented otherwise?
My doubts came when trying to use Restangular to consume this resource and having to fiddle around to make it work (as it was expecting an object rather than an array). It could also be a problem related to my limited knowledge of Restangular, of course.
Thanks,
You could return a JSON list of permissions for that user;
{ "permissions": { "read": "true", "write": "false" }