Search the web
Sign In
New User? Sign Up
rest-discuss · REST Discussion Mailing List
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Hear how Yahoo! Groups has changed the lives of others. Take me there.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
Resources with read-only and read-write parts   Message List  
Reply | Forward Message #13095 of 14436 |
Re: [rest-discuss] Resources with read-only and read-write parts

I agree with the inefficiency (it is an inconvenience, to be accurate)
part. That is why, there is no need to require clients to supply the
immutable parts. The "supply everything" requirement usually stems
from XML-schema driven applications, which is unnecessary.

Subbu

On Jul 6, 2009, at 10:28 AM, Sam Johnston wrote:

> On Sun, Jul 5, 2009 at 1:03 AM, Subbu Allamaraju <subbu@...>
> wrote:
>
>> Representations in a request (e.g. PUT or POST) and representations
>> in a
>> response (e.g. GET or a PUT) need not be absolutely the same. HTTP
>> servers
>> are not databases that blindly store the data. Using PUT to update
>> the
>> mutable parts of a resource is perfectly okay. At least, I don't see
>> anything that breaks HTTP.
>>
>
> The way I read the RFC is "*The PUT method requests that the
> enclosed entity
> be stored [as is] under the supplied Request-URI*", which is obvious
> for
> "simple" media types like images where anything else doesn't really
> make
> sense. While it does go on to talk about partial updates (mentioning
> the
> Content-Range header), PUTting a resource in its entirity knowing that
> immutable parts will be ignored and/or trigger errors seems neither
> efficient nor clean to me.
>
> Sam
>
> On Jul 2, 2009, at 8:01 AM, Sam Johnston wrote:
>>
>>
>>>
>>> Jim,
>>>
>>> Typically you would express the overall writeability of a resource
>>> via
>>> OPTIONS (e.g. if you can only GET it's read only), but if you've
>>> got, say, a
>>> template driven website and you only want the body to be updated
>>> then that's
>>> something different.
>>>
>>> I would almost certainly NOT be using PUT for this, rather
>>> accepting POSTs
>>> of just the midifiable data (perhaps in HTML forms or some XML-based
>>> format). If you were to use XML then a GET (with the appropriate
>>> Accept:
>>> header) could return just the parts which are modifiable by the
>>> client.
>>> Optionally you could add information to the URL about whether the
>>> client
>>> wants just the writeable elements or the whole lot, or even markup
>>> the
>>> elements as writable (or not).
>>>
>>> Hope that helps,
>>>
>>> Sam
>>>
>>>
>>> On Wed, Jul 1, 2009 at 9:42 PM, Jim Edwards-Hewitt <jimeh@...
>>>> wrote:
>>>
>>>
>>> Hi, everyone,
>>>
>>> I'm a newbie here (though not to REST in general), and the list
>>> archives
>>> have been a great help in clarifying my understanding of a lot of
>>> REST
>>> concepts and suggesting good design elements. I have one part of
>>> my design
>>> right now where I'm unsure what a good RESTful approach would be.
>>>
>>> I have resources that support GET and PUT, but contain some parts
>>> that
>>> clients are not allowed to modify. (This doesn't seem like an
>>> uncommon case;
>>> I would think that navigation links, for example, would typically
>>> not be
>>> modifiable in a PUT.) So is it better to:
>>>
>>> 1. Require clients to submit all the read-only parts unmodified in
>>> a PUT,
>>> and respond with an error code if they are absent or altered?
>>> 2. Take advantage of the leniency allowed in a server's
>>> implementation of
>>> PUT to ignore the read-only elements (or their absence)?
>>> 3. Separate read-only elements into a sub-resource that only
>>> supports GET?
>>> (This may not be feasible for resources which must be created as a
>>> whole.)
>>>
>>> or something else?
>>>
>>> Second, there are some elements that are modifiable or not
>>> depending on
>>> the privileges held by the (authenticated) user. I would think
>>> this would be
>>> expressed by a difference in the representation returned to the
>>> client, but
>>> what should that difference be? (My representations are XML
>>> documents, if
>>> there isn't a more general solution.)
>>>
>>> And in a broader sense, I'd like the client to know which elements
>>> of the
>>> resource the user can modify, for presentation purposes. Is there a
>>> generally accepted way to do this, perhaps with form templates or
>>> XForms?
>>>
>>> I'd be interested in any comments or alternative approaches, if
>>> I'm just
>>> looking at it from the wrong angle.
>>>
>>> Thanks,
>>>
>>> -- Jim
>>>
>>>
>>>
>>>
>>>
>>>
>>
>>




Mon Jul 6, 2009 6:50 pm

sallamar
Offline Offline
Send Email Send Email

Forward
Message #13095 of 14436 |
Expand Messages Author Sort by Date

Hi, everyone, I'm a newbie here (though not to REST in general), and the list archives have been a great help in clarifying my understanding of a lot of REST...
Jim Edwards-Hewitt
jimeh_xjs
Offline Send Email
Jul 2, 2009
2:43 pm

Jim, Typically you would express the overall writeability of a resource via OPTIONS (e.g. if you can only GET it's read only), but if you've got, say, a ...
Sam Johnston
sam.johnston...
Offline Send Email
Jul 2, 2009
3:01 pm

Representations in a request (e.g. PUT or POST) and representations in a response (e.g. GET or a PUT) need not be absolutely the same. HTTP servers are not...
Subbu Allamaraju
sallamar
Offline Send Email
Jul 4, 2009
11:04 pm

... The way I read the RFC is "*The PUT method requests that the enclosed entity be stored [as is] under the supplied Request-URI*", which is obvious for ...
Sam Johnston
sam.johnston...
Offline Send Email
Jul 6, 2009
5:29 pm

Well, the "[as is]" isn't actually part of the RFC. The body of the PUT request is simply a *representation* of the state. Consider a resource that could...
Moore, Jonathan (CIM)
jonathan_t_m...
Offline Send Email
Jul 6, 2009
6:28 pm

On Mon, Jul 6, 2009 at 7:51 PM, Moore, Jonathan (CIM) < ... Right, which is why I said "The way I read the RFC is..." ... Which brings me to a question I...
Sam Johnston
sam.johnston...
Offline Send Email
Jul 6, 2009
6:28 pm

Sounds like the fingerprint, portrait, and scan could all be subordinate resources. Maybe http://example.com/person/123 returns an HTML or XML document with...
Moore, Jonathan (CIM)
jonathan_t_m...
Offline Send Email
Jul 6, 2009
6:38 pm

On Mon, Jul 6, 2009 at 8:38 PM, Moore, Jonathan (CIM) < ... resources. Maybe http://example.com/person/123 returns an HTML or XML document with several links...
Sam Johnston
sam.johnston...
Offline Send Email
Jul 6, 2009
6:59 pm

You need to decide if the portrait of user is a resource or a representation in your system. If it's a resource, it should have a URI. If it's a ...
mike amundsen
mamund
Offline Send Email
Jul 6, 2009
6:42 pm

... I don't blame custom media types for that. Proliferation of custom means of expressing semantics limits the usability of the system. A media type is one of...
Subbu Allamaraju
sallamar
Offline Send Email
Jul 6, 2009
7:48 pm

I agree with the inefficiency (it is an inconvenience, to be accurate) part. That is why, there is no need to require clients to supply the immutable parts....
Subbu Allamaraju
sallamar
Offline Send Email
Jul 6, 2009
6:51 pm

I'll certainly admit to my thinking being influenced by past schema-driven projects. I suppose I've also been thinking of GET/PUT formats being the same as a...
Jim Edwards-Hewitt
jimeh_xjs
Offline Send Email
Jul 7, 2009
7:31 pm

I worked on one project where the OPTIONS call returned documentation for that URI. This document detailed the methods, accept-types (GET), content-types (POST...
mike amundsen
mamund
Offline Send Email
Jul 7, 2009
7:48 pm

Jim: I am addressing the security portion of your post. Hopefully this will give you some ideas. <snip> there are some elements that are modifiable or not...
mike amundsen
mamund
Offline Send Email
Jul 2, 2009
5:56 pm

(I posted this reply privately instead of publicly, so I'm re-posting.) Ah, that does make it more clear. So I might have two (or more) different...
Jim Edwards-Hewitt
jimeh_xjs
Offline Send Email
Jul 6, 2009
8:28 pm

Hi Jim, can you provide an example representation for the mutable/immutable use case? Jan...
Jan Algermissen
algermissen1971
Offline Send Email
Jul 3, 2009
3:24 am

The most complicated resource of this type is an Administrator account. The current representation is: <admin> <uid>{id}</uid> <status>{status string}</status>...
Jim Edwards-Hewitt
jimeh_xjs
Offline Send Email
Jul 6, 2009
9:03 pm

Hey Jim, ... IMO, you seem to be confusing between the state of the resource and its representation. GET and PUT allow you to retrieve and set the state of the...
Sandeep Shetty
sandeep.shetty@...
Send Email
Jul 4, 2009
10:03 pm

Ah. That makes a lot of sense, but I don't think I've seen it expressed that way before. Are there content-type definitions that make that explicit? (I suppose...
Jim Edwards-Hewitt
jimeh_xjs
Offline Send Email
Jul 6, 2009
10:04 pm

Hey Jim, ... A form (POST) that accepts only the values that represent the state of the resource is one way to make it explicit (sigh... if only I could say...
Sandeep Shetty
sandeep.shetty@...
Send Email
Jul 7, 2009
6:08 am
Advanced

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help