users@jersey.java.net

Re: [rest-discuss] hateoas - draft #1

From: Will Hartung <willh_at_mirthcorp.com>
Date: Thu, 15 Oct 2009 10:02:08 -0700

2009/10/15 Jan Algermissen <algermissen1971_at_mac.com>
> Sometimes you just need to create a new media type and/or new link
> relations[1]. If there is 'public relevance' in your use case, your
> new type might even become a standard type. IOW, don't be afraid to
> ceate a new type if you have to (but think long and hard if you really
> have to :-)

Does it make any sense to qualify the link with the verb and the data type?

A client doesn't need to know the content type of a GET, as it can ask
for what it wants.

But do you think for a PUT or POST, the data type can (should?) be
referenced in the link?

The Atom link can look like:
<link href="http://example.com/resource" rel="create" type="xml/ubl-invoice"/>

I guess the media types for both POST and PUT should ideally be the
same, as they're typically closely related. I was just thinking if
they were different, how would you best communicate that to a client.

And it's up to the standard interface, to know what you can do with
that media type at that link.

I don't see how you could simply have "xml/application" as a media
type for most cases, especially for creating or changing resources.
It's just too generic.

I suppose it's up to the client to "know" what schema
"xml/ubl-invoice" is, through some internal mapping. Or, the service
can post a resource that provides the mapping.

Regards,

Will Hartung
(willh_at_mirthcorp.com)