|
|
|
|
|
by ericmoritz
5461 days ago
|
|
What I've seen in the past (mainly from Pylons) is to have an extension on the end of the URL so: /updates/ has a default format say XML and then there's a JSON resource called /updates.json, /updates.txt, etc. Keep in mind what the R in REST stands for. Each resource is a representation of internal data. You can have multiple representations under different URLs even though they're powered by the same internal data structure. Ideally you'd use the Accept header to do it but sometimes you need to be practical. |
|
The concept of internal data structure doesn't enter the picture at all; for all the client knows, the response might even be generated by a monkey typing on a keyboard.
So if you're using different URLs, you're saying that those are different resources, not multiple representations of the same resource.
Sure, it may be useful and 'practicality beats purity', but it's bending the concept.