It depends :o)
In fact, we use resources with lists of possible actions per role, and the resources are in part not uniform, some have detail attributes which are not available on others. We can assume however that some attributes are always there.
The client handles this by expecting dynamic lists of actions, it makes menus from them (simple). The details display is programmed to show what is there (not so simple). We apply display templates which follow an all or nothing approach, i.e. if there are no sufficient data for an item, the entire item is skipped, and we have the possibility to define fallbacks. In our case, that was worth the effort since we need all kinds of decorations, layouts, fallback texts depending on the type of resource.
So it is not immediately obvious to me why it seems a bad idea to have the difference within the resource.
I'm not saying this is the single best way, but once we accepted the necessity to have powerful templates for the client ui, things fell into place for us. Can you give us more details about your use case, and why you think having different resources is better?
Best regards
Dietrich
--
You received this message because you are subscribed to the Google Groups "API Craft" group.
To unsubscribe from this group, send email to api-craft+...@googlegroups.com.
Visit this group at http://groups.google.com/group/api-craft?hl=en.
Good point, Mike. Thank you.
Cheers,
Dietrich
The reason it works for us is, we must revalidate with etags anyway because of the nature of our data but send back not modified as long as the data did not change, so usually the cache can be used which normally gains us quite an improvement. The cases where the role changes are rare and handled by revalidation.
So it works for us, but that is a special case. Having a separate resource for role dependent stuff is certainly the cache-friendlier approach. Still I wanted to mention that caching is still possible for a single resource as long as the role rarely changes and you revalidate anyway.
Cheers,
Dietrich