Re: Link relation for adding a resource
Jan Algermissen <[email protected]>
| Newsgroups | gmane.comp.web.services.rest |
|---|---|
| Message-ID | <[email protected]> |
On Aug 31, 2012, at 6:07 PM, Paul Cohen wrote:
> Hi,
>
> I would like to define, in JSON, a link that provides a way to add a
> new resource to a collection of resources.
HTTP POST has that semantic already, there is no need to use a link relation for that.
All you need to know is that some resource has collection semantics, so you should tell the client that /photos is a collection rather than focussing on the action.
E.g. tell the client that /photos/ is the 'photos collection' (you can use a link rel for that, or, e.g. an AtomPub service document, or a specific media type you design) and that's it. That POST is for adding items is known from HTTP already.
Jan
> I'm considering this:
>
> "link": {
> "href": "/photos/",
> "type": "image/tiff",
> "method": "POST",
> "rel": "new",
> "title": "Add new photo"}
>
> I'd appreciate any comments on the link representation above. In
> particular I'm interested in suggestions for the relation type - I use
> "new" above. I've seen "new" being used in similar cases but it's not
> an officially registered relation type here:
>
> * http://www.iana.org/assignments/link-relations/link-relations.xml
>
> * http://www.w3.org/TR/html401/types.html#h-6.12
>
> * http://microformats.org/wiki/existing-rel-values
>
> And there's no registered relation type with new/add/append-like
> semantics. Well maybe "create-form" on the mircroformats page, but
> that doesn't really seem appropriate.
>
> /Paul
>
> --
> Paul Cohen
> www.seibostudios.se
> mobile: +46 730 787 035
> e-mail: [email protected]
>
------------------------------------
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/rest-discuss/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/rest-discuss/join
(Yahoo! ID required)
<*> To change settings via email:
[email protected]
[email protected]
<*> To unsubscribe from this group, send an email to:
[email protected]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/