Reputation: 4387
I am currently performing some REST API improvements and maintenance for my employer. I was wondering what data formats people seem to be gravitating towards for generating hypertext within XML?
I've seen Collection+JSON but that doesn't seem too popular, with some claiming it was mostly just invented for the sake of the author's book, RESTful Web APIs. HAL seems like the only even marginally popular format, and it has the added benefit of at least mentioning XML somewhere on the page.
The current clients of the API are interested in XML responses, so an XML based format would be ideal.
Upvotes: 0
Views: 67
Reputation: 4010
HAL XML is not very popular because JSON dominates over XML in the current zeitgeist. Finding examples is not too easy.
I'd say the most popular hypertext formats that are XML are XHTML or ATOM. ATOM AFAIK doesn't have a specified way to define templated links (one of the better features of HAL). You could add a convention...but it would be a local convention. XHTML does have template links...as forms:
<form action="some url" method="some http verb">
<input type="text" name="param name"></text>
</form>
I'd guess you're familiar with that, but never thought of it as a templated URL.
fielding talks about this approach specifically as a good example of being "hypertext driven" at http://roy.gbiv.com/untangled/2008/rest-apis-must-be-hypertext-driven
allow servers to instruct clients on how to construct appropriate URIs, such as is done in HTML forms and URI templates
Upvotes: 2