We (Jive Software) use something similar in our representations -- but with
a slight extra twist. We also include what verbs can be used (by this
particular requestor) against the URL being sent. This saves an extra HTTP
call to do an OPTIONS request (or let the client just try it and get a
403), and is useful especially in mobile clients because they can do things
like turn off options that won't exist.
The JAX-RS 2.0 support for links builds off of RFC 5988 [1], which lets you
define link relationships in HTTP headers -- sort of link a <link rel="..."
...> element in HTML, but works fine lasts a long time no matter what your
data format is.
Craig
[1]
http://tools.ietf.org/html/rfc5988
On Mon, May 5, 2014 at 1:15 PM, Robert DiFalco <robert.difalco_at_gmail.com>wrote:
> Oh and a little more additional info if you need it. I don't use this
> functionality in a super hypermedia way. I just use it to have a self
> describing API so my clients don't need hard coded REST paths.
>
> So, for example, if the client GETs or POSTs a user they will get the JSON
> representing the user but also a "rel" that contains the already expanded
> path to their Account resource or their Preferences resource, etc. Already
> expanded to mean that if they are user ID at 1 the Hateoas links would be
> the fully qualified paths like /user/1/account and /user/1/preferences
> respectively.
>
> That's really all I use the HATEOAS stuff for.
>
>
>
> On Mon, May 5, 2014 at 1:10 PM, Robert DiFalco <robert.difalco_at_gmail.com>wrote:
>
>> I'm lacking some knowledge here.
>>
>> My REST API uses some HAL style HATEOAS responses. At a basic level the
>> JSON entities I return have an "entity" field (for the actual entity) and a
>> "links" field for a collection of links (usually containing at least one
>> called "self" which is the link to the call just made to get the value of
>> "entity".
>>
>> I notice JAX-RS has something different but that I could use instead of
>> all the Hateoas stuff I rigged up.
>>
>> But here's where I'm confused. Is this a proprietary standard create by
>> JAX-RS or does it map to some defined standard? Thinking of my clients, is
>> there any reason I WOULD NOT want to use this instead of my home-grown
>> solution that puts the links in the resource entity itself instead of how
>> Jersey does it?
>>
>> Thanks for any facts or opinions you can offer on this!
>>
>
>