3 ms·
I like everything the author mentions, with one addition: besides XML and JSON as media types, I like to provide xhtml with a microformat. This allows browsers
by DougWebb 16y ago
I like everything the author mentions, with one addition: besides XML and JSON as media types, I like to provide xhtml with a microformat. This allows browsers to interact with most API functionality directly, which has development benefits you just won't realize until you try it.
The key is that your xhtml must be generated dynamically from an internal data structure, and your JSON and XML should be generated dynamically from the same data structure. This ensures consistency both within and across media types, and it simplifies development because you can stop worrying about the output format; you just need to worry about the internal data structure which represents your resources. The transformation into a client-usable representation occurs completely separately from all of your business logic.