The uHateoas API is designed to give RESTful clients access to the data stored as IPublishedContent in a typical Umbraco web site via the Content Service in a number of supported data formats i.e. json, xml, umbraco+json or any of the HATEOAS hypermedia formats ( hal, collection-json, siren etc... ) that you can implement via a simple Umbraco alternate template. The HATEOAS formats, specifically umbraco+json makes your entire Umbraco Content tree discoverable and navigable via the json link collections. The links are filtered based on membership access and only expose Published Content.
Three alternate templates are supplied with the package as a starting point, feel free to add your own and contribute back to the project:
- umbraco+json - An umbraco centric Hypermedia format based on Siren and Magic Hypermedia (Thanks Amith & Team)
- json - A basic json format without the Hypermedia Links and Actions
- xml - An xml representation of the json format.
By default these three templates are associated with Content-Type headers that are configurable via the web.config and are integrated into the Umbraco Request Pipeline, so that if you supply the appropriate Content-Type header, the resource that you are asking for will be returned in that format without specifying the alternate template. For most developers, this would be the natural way of requesting the data.
Content-Type templates ( web.config )
Adding additional views/templates can be done simply by adding a new setting to appSettings for example :
<add key="WG2K.Hypermedia.Templates.text/rss+xml" value="urss" />