how should I change the representation (not mimetype) of a resource?

Posted by xenoterracide on Programmers See other posts from Programmers or by xenoterracide
Published on 2014-03-16T14:34:02Z Indexed on 2014/08/21 16:29 UTC
Read the original article Hit count: 141

Filed under:

I'm looking at how I can change the representation of a payload at runtime for varied potential advantages, but I'm not sure how to do it. Specifically collections.

Array of Pairs

[{ <resource_uri> : { <entity> }, ...}]

Array of Objects

[<entity>,...]

Array of Resources

[<resource_uri>]

Map of entities

{ <resource_uri> : { <entity> }, ... }

My problem is, I'm not sure if I should put these different representations of the sets at different URI's, give them slightly varied mime types, e.g. application/foomap+json or perhaps use an optional query parameter ?format=map, or resource /entities/map. The UI is going to hide this, this is for programmatic web service access only (which the "UI's JS will have to call).

© Programmers or respective owner

Related posts about rest