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...
Real people. Real stories. See how Yahoo! Groups impacts members worldwide.

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   Topic List   < Prev Topic  |  Next Topic >
Summarize Messages Sort by Date  
#13073 From: "Jim Edwards-Hewitt" <jimeh@...>
Date: Wed Jul 1, 2009 7:42 pm
Subject: Resources with read-only and read-write parts
jimeh_xjs
Offline Offline
Send Email Send Email
 
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




#13074 From: Sam Johnston <samj@...>
Date: Thu Jul 2, 2009 3:01 pm
Subject: Re: Resources with read-only and read-write parts
sam.johnston...
Offline Offline
Send Email Send Email
 
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



#13082 From: Subbu Allamaraju <subbu@...>
Date: Sat Jul 4, 2009 11:03 pm
Subject: Re: Resources with read-only and read-write parts
sallamar
Online Now Online Now
Send Email Send Email
 
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.

Subbu


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
>
>
>
>
>




#13090 From: Sam Johnston <samj@...>
Date: Mon Jul 6, 2009 5:28 pm
Subject: Re: Resources with read-only and read-write parts
sam.johnston...
Offline Offline
Send Email Send Email
 
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








#13091 From: "Moore, Jonathan (CIM)" <jonathan_moore@...>
Date: Mon Jul 6, 2009 5:51 pm
Subject: RE: Resources with read-only and read-write parts
jonathan_t_m...
Offline Offline
Send Email Send Email
 

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 produce alternative representations for GET, say via content negotiation. I could do a PUT with an Atom representation and then still GET a JSON representation afterward. So I don’t see that PUT requires you to literally store the exact message body (although, as you mention, that’s entirely allowable).

 

In AtomPub [1], for example, this is one reason why a successful PUT returns a 200 OK where the body contains the resulting representation—then the server can apply the PUT to the portions it needs, and the client can see the result.

 

If you like, however, if the server sees that the client has modified an unmodifiable portion of the entity (e.g. some piece of computed metadata, like a last-updated timestamp), the server can reply with a 409 Conflict with additional detail [2].

 

Jon

 

[1] http://bitworking.org/projects/atom/rfc5023.html#rfc.section.5.4.2

[2] http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.10

 

……..

Jon Moore

Comcast Interactive Media

 


From: rest-discuss@yahoogroups.com [mailto:rest-discuss@yahoogroups.com] On Behalf Of Sam Johnston
Sent: Monday, July 06, 2009 1:29 PM
To: Subbu Allamaraju
Cc: Jim Edwards-Hewitt; rest-discuss@yahoogroups.com
Subject: Re: [rest-discuss] Resources with read-only and read-write parts

 




On Sun, Jul 5, 2009 at 1:03 AM, Subbu Allamaraju <subbu@subbu.org> 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@surety.com>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




 

 


#13092 From: Sam Johnston <samj@...>
Date: Mon Jul 6, 2009 6:27 pm
Subject: Re: Resources with read-only and read-write parts
sam.johnston...
Offline Offline
Send Email Send Email
 
On Mon, Jul 6, 2009 at 7:51 PM, Moore, Jonathan (CIM) <Jonathan_Moore@...> wrote:

Well, the “[as is]” isn’t actually part of the RFC.

Right, which is why I said "The way I read the RFC is..."

The body of the PUT request is simply a *representation* of the state.

Which brings me to a question I considered asking but didn't. REST talks about representations of resources, where one resource can have multiple representations.

Let's say I have a person (http://example.com/person/123) and instead of transferring the person over HTTP (which is not yet possible) I make available their portrait, fingerprint(s), a scan of their national ID card and some XML demographics. Where I use distinct content types I can simply PUT a given representation and have the server side state updated accordingly.

What's the best practice though when portrait, fingerprint and scan are JPGs? That is, I'm retrieving http://example.com/person/123 with Accept: image/jpeg but it's impossible to tell whether it's the portrait, fingerprint or scan I'm after. Similarly, what if I want the fingerprint in PNG?

I immediately start thinking about putting the content-type and/or link-relation into the URL:

http://example.com/person/123;rel=portrait;type=image/jpeg

Then I start to think about cleaning this up a bit:

http://example.com/person/123/portrait.jpg

But this requires routes/rules and doesn't seem as clean/flexible as it should be.

Sam

 

#13093 From: "Moore, Jonathan (CIM)" <jonathan_moore@...>
Date: Mon Jul 6, 2009 6:38 pm
Subject: RE: Resources with read-only and read-write parts
jonathan_t_m...
Offline Offline
Send Email Send Email
 
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 several links in it, like:

(excuse my not-exactly-Atom XML)...

<entry>
<id>http://example.com/person/123</id>
<link rel="http://example.com/schemas/#portrait"
href="http://example.com/person/123/portrait
type="image/jpeg"/>
<link rel="http://example.com/schemas/#fingerprint"
href="http://example.com/person/123/fingerprint"
type="image/jpeg"/>
...
</entry>

Etc.

Jon

________________________________________
From: Sam Johnston [mailto:samj@...]
Sent: Monday, July 06, 2009 2:27 PM
To: Moore, Jonathan (CIM)
Cc: Subbu Allamaraju; Jim Edwards-Hewitt; rest-discuss@yahoogroups.com
Subject: Re: [rest-discuss] Resources with read-only and read-write parts

On Mon, Jul 6, 2009 at 7:51 PM, Moore, Jonathan (CIM)
<Jonathan_Moore@...> wrote:
Well, the "[as is]" isn't actually part of the RFC.
Right, which is why I said "The way I read the RFC is..."
The body of the PUT request is simply a *representation* of the state.
Which brings me to a question I considered asking but didn't. REST talks about
representations of resources, where one resource can have multiple
representations.

Let's say I have a person (http://example.com/person/123) and instead of
transferring the person over HTTP (which is not yet possible) I make available
their portrait, fingerprint(s), a scan of their national ID card and some XML
demographics. Where I use distinct content types I can simply PUT a given
representation and have the server side state updated accordingly.

What's the best practice though when portrait, fingerprint and scan are JPGs?
That is, I'm retrieving http://example.com/person/123 with Accept: image/jpeg
but it's impossible to tell whether it's the portrait, fingerprint or scan I'm
after. Similarly, what if I want the fingerprint in PNG?

I immediately start thinking about putting the content-type and/or link-relation
into the URL:

http://example.com/person/123;rel=portrait;type=image/jpeg

Then I start to think about cleaning this up a bit:

http://example.com/person/123/portrait.jpg

But this requires routes/rules and doesn't seem as clean/flexible as it should
be.

Sam

 



#13096 From: Sam Johnston <samj@...>
Date: Mon Jul 6, 2009 6:58 pm
Subject: Re: Resources with read-only and read-write parts
sam.johnston...
Offline Offline
Send Email Send Email
 
On Mon, Jul 6, 2009 at 8:38 PM, Moore, Jonathan (CIM) <jonathan_moore@...> wrote:
>
> 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 several links in it, like:

Yes, you should certainly be able to enumerate the available resources but this gets me thinking about a server-side Accept: header (e.g. Offer:). Anyway I'm liking the idea of subordinate resources and it fits with the requirement to upload existing multi-file virtual machines.

> (excuse my not-exactly-Atom XML)...
>
> <entry>
> <id>http://example.com/person/123</id>
> <link rel="http://example.com/schemas/#portrait"
> href="http://example.com/person/123/portrait
> type="image/jpeg"/>
> <link rel="http://example.com/schemas/#fingerprint"
> href="http://example.com/person/123/fingerprint"
> type="image/jpeg"/>
> ...
> </entry>

Another way of achieving the same while eliminating the dependency on Atom & XML is to serve up the best representation available along with Link: headers (draft-nottingham-http-link-header). Given "best" often translates to "biggest" you can get just the links in advance using HEAD (which is also compatible with "simple" clients like wget/curl, thus lowering the barriers to entry).

Sam



#13094 From: mike amundsen <mamund@...>
Date: Mon Jul 6, 2009 6:42 pm
Subject: Re: Resources with read-only and read-write parts
mamund
Offline Offline
Send Email Send Email
 
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 representation, it should have a media-type.

Keeping in mind that a proliferation of custom media types limits the usability of a system, I tend to lean on the side of URIs when identifying interesting items. 

Also, I see using the rel="" value as a way to add metadata to links, not a way to tell servers which representation/resource to return.

mca
http://amundsen.com/blog/



On Mon, Jul 6, 2009 at 14:27, Sam Johnston <samj@...> wrote:


On Mon, Jul 6, 2009 at 7:51 PM, Moore, Jonathan (CIM) <Jonathan_Moore@...> wrote:

Well, the “[as is]” isn’t actually part of the RFC.

Right, which is why I said "The way I read the RFC is..."

The body of the PUT request is simply a *representation* of the state.

Which brings me to a question I considered asking but didn't. REST talks about representations of resources, where one resource can have multiple representations.

Let's say I have a person (http://example.com/person/123) and instead of transferring the person over HTTP (which is not yet possible) I make available their portrait, fingerprint(s), a scan of their national ID card and some XML demographics. Where I use distinct content types I can simply PUT a given representation and have the server side state updated accordingly.

What's the best practice though when portrait, fingerprint and scan are JPGs? That is, I'm retrieving http://example.com/person/123 with Accept: image/jpeg but it's impossible to tell whether it's the portrait, fingerprint or scan I'm after. Similarly, what if I want the fingerprint in PNG?

I immediately start thinking about putting the content-type and/or link-relation into the URL:

http://example.com/person/123;rel=portrait;type=image/jpeg

Then I start to think about cleaning this up a bit:

http://example.com/person/123/portrait.jpg

But this requires routes/rules and doesn't seem as clean/flexible as it should be.

Sam

 




#13097 From: Subbu Allamaraju <subbu@...>
Date: Mon Jul 6, 2009 7:48 pm
Subject: Re: Resources with read-only and read-write parts
sallamar
Online Now Online Now
Send Email Send Email
 

On Jul 6, 2009, at 11:42 AM, mike amundsen wrote:

> Keeping in mind that a proliferation of custom media types limits the
> usability of a system, I tend to lean on the side of URIs when
> identifying
> interesting items.

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 the ways of expressing semantics.

However, this is a contradiction in itself, since most non-browser
applications have custom/non-standard semantics that do not completely
fit standard definitions.

My 2 cents
Subbu



#13095 From: Subbu Allamaraju <subbu@...>
Date: Mon Jul 6, 2009 6:50 pm
Subject: Re: Resources with read-only and read-write parts
sallamar
Online Now Online Now
Send Email Send Email
 
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
>>>
>>>
>>>
>>>
>>>
>>>
>>
>>




#13102 From: Jim Edwards-Hewitt <jimeh@...>
Date: Tue Jul 7, 2009 7:28 pm
Subject: Re: Resources with read-only and read-write parts
jimeh_xjs
Offline Offline
Send Email Send Email
 
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 way of communicating the expected format to the client. (Though obviously that isn't the case when form-encoded input is accepted.) Is there any standard method or common convention for telling the client what media types and formats are accepted for a PUT request (other than forms)? The HTTP standard seems a bit thin on the subject of PUT media types, compared to GET.

  -- Jim

Subbu Allamaraju wrote:
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











#13103 From: mike amundsen <mamund@...>
Date: Tue Jul 7, 2009 7:48 pm
Subject: Re: Resources with read-only and read-write parts
mamund
Offline Offline
Send Email Send Email
 
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 and PUT), and any other details.It was a small system, but the OPTIONS screens took a good deal of effort to keep up. I thought some form of automation of responses to OPTIONS would work, but we never got around to doing it.

Internally I have used some additional headers on the OPTIONS method to help keep track of content-types:

mca
http://amundsen.com/blog/



On Tue, Jul 7, 2009 at 15:28, Jim Edwards-Hewitt <jimeh@...> wrote:


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 way of communicating the expected format to the client. (Though obviously that isn't the case when form-encoded input is accepted.) Is there any standard method or common convention for telling the client what media types and formats are accepted for a PUT request (other than forms)? The HTTP standard seems a bit thin on the subject of PUT media types, compared to GET.

  -- Jim


Subbu Allamaraju wrote:
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














#13075 From: mike amundsen <mamund@...>
Date: Thu Jul 2, 2009 5:55 pm
Subject: Re: Resources with read-only and read-write parts
mamund
Offline Offline
Send Email Send Email
 
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 depending on the privileges held by the (authenticated) user.
</snip>

First, I favor managing access rights using a combination of URI + HTTP_Method + Auth'ed_User. For example:
- user1 has GET,HEAD,OPTIONS for /collection/
- manager1 has GET,HEAD,OPTIONS,POST,PUT for /collection/
- admin1 has GET,HEAD,OPTIONS,POST,PUT,DELETE for /collection/

This means I focus on defining the proper Resources (addressed via URI) when I want to limit what state representations clients and server share. 

In the case you provide, I would consider different Resources to handle different update privileges for the same stored data. This also clears up any attempts at doing partial updates (and therefore clears up caching issues) since none are needed now that there are different resources to handle the details. 

In my example, the ability to pass different state representations is modeled as different resources. These various "secured" resource variations might still all "map" to the same data storage on the server, but that's not interesting to the client anyway since the data model is *not* the resource model on RESTful implementations. 
 
mca
http://amundsen.com/blog/



On Wed, Jul 1, 2009 at 15:42, 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



------------------------------------

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:
   mailto:rest-discuss-digest@yahoogroups.com
   mailto:rest-discuss-fullfeatured@yahoogroups.com

<*> To unsubscribe from this group, send an email to:
   rest-discuss-unsubscribe@yahoogroups.com

<*> Your use of Yahoo! Groups is subject to:
   http://docs.yahoo.com/info/terms/



#13098 From: "Jim Edwards-Hewitt" <jimeh@...>
Date: Mon Jul 6, 2009 8:28 pm
Subject: Re: Resources with read-only and read-write parts
jimeh_xjs
Offline Offline
Send Email Send Email
 
(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
resources/URIs for one behind-the-scenes object, each of which contains only the
elements that the user can modify, which supports GET/HEAD/OPTIONS/PUT?

I like that; it seems much cleaner than the direction I was going.

I think I'd also want to have a resource which contains all the elements and
supports only GET/HEAD/OPTIONS (since, in my case, they're all readable if the
user is authorized to see the resource at all), but I think I'd want it to have
an edit link to navigate to the appropriate read/write resource. Does that mean
that in order to avoid trouble with caching, I'd have to have parallel versions
of that resource with different URIs as well, since the edit link would be
different depending on the user?

-- Jim

--- In rest-discuss@yahoogroups.com, mike amundsen <mamund@...> wrote:
>
> 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 depending on the
> privileges held by the (authenticated) user.
> </snip>
>
> First, I favor managing access rights using a combination of URI +
> HTTP_Method + Auth'ed_User. For example:
> - user1 has GET,HEAD,OPTIONS for /collection/
> - manager1 has GET,HEAD,OPTIONS,POST,PUT for /collection/
> - admin1 has GET,HEAD,OPTIONS,POST,PUT,DELETE for /collection/
>
> This means I focus on defining the proper Resources (addressed via
> URI) when I want to limit what state representations clients and
> server share.
>
> In the case you provide, I would consider different Resources to
> handle different update privileges for the same stored data. This
> also clears up any attempts at doing partial updates (and therefore
> clears up caching issues) since none are needed now that there are
> different resources to handle the details.
>
> In my example, the ability to pass different state representations
> is modeled as different resources. These various "secured" resource
> variations might still all "map" to the same data storage on the
> server, but that's not interesting to the client anyway since the
> data model is *not* the resource model on RESTful implementations.
>
> mca
> http://amundsen.com/blog/
>
>
>
> On Wed, Jul 1, 2009 at 15:42, 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
> >
> >





#13076 From: Jan Algermissen <algermissen1971@...>
Date: Fri Jul 3, 2009 1:05 am
Subject: Re: Resources with read-only and read-write parts
algermissen1971
Offline Offline
Send Email Send Email
 
Hi Jim,

can you provide an example representation for the mutable/immutable
use case?

Jan

On Jul 1, 2009, at 3:42 PM, Jim Edwards-Hewitt 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
>
>
>
> ------------------------------------
>
> Yahoo! Groups Links
>
>
>




#13099 From: "Jim Edwards-Hewitt" <jimeh@...>
Date: Mon Jul 6, 2009 9:03 pm
Subject: Re: Resources with read-only and read-write parts
jimeh_xjs
Offline Offline
Send Email Send Email
 
The most complicated resource of this type is an Administrator account. The
current representation is:

<admin>
<uid>{id}</uid>
<status>{status string}</status>
<roles>
<role>{role-name}</role>
...
</roles>
<vcard>...</vcard>
<link rel="http://...#organization" href={org URL} title="{org name}" />
</admin>

The user may be an ordinary user or a privileged user (leaving aside users with
read-only access, since that case is easy.) An ordinary user can modify the
contact information in the vcard structure, a privileged user can modify the
roles and status (active/disabled/etc.), and the uid is immutable.

(As a further complication, a privileged user can only add or remove roles that
their own account possesses.)

I'm already thinking that my roles may be better expressed as a set of
<role-name> tags with true/false values rather by the presence/absence of a
<role> tag as in the structure above, to avoid ambiguity on PUTs.

-- Jim

--- In rest-discuss@yahoogroups.com, Jan Algermissen <algermissen1971@...>
wrote:
>
> Hi Jim,
>
> can you provide an example representation for the mutable/immutable
> use case?
>
> Jan
>
> On Jul 1, 2009, at 3:42 PM, Jim Edwards-Hewitt 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
> >
> >
> >
> > ------------------------------------
> >
> > Yahoo! Groups Links
> >
> >
> >
>





#13080 From: Sandeep Shetty <sandeep.shetty@...>
Date: Sat Jul 4, 2009 10:01 pm
Subject: Re: Resources with read-only and read-write parts
sandeep.shetty@...
Send Email Send Email
 
Hey Jim,

On Thu, Jul 2, 2009 at 1:12 AM, Jim Edwards-Hewitt<jimeh@...> wrote:
> 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.)

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 resource. The data format used for transferring that
state is the media type. "Navigation links" are specific to the media
type and not the state of the resource. I could PUT
application/atom+xml or application/x-www-form-urlencoded and GET
text/html.

--
Sandeep Shetty
http://sandeep.shetty.in/



#13100 From: "Jim Edwards-Hewitt" <jimeh@...>
Date: Mon Jul 6, 2009 10:04 pm
Subject: Re: Resources with read-only and read-write parts
jimeh_xjs
Offline Offline
Send Email Send Email
 
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
it mostly applies to xml or html-based formats, where the same type of language
is used to express the state of the resource and the purely content-type
elements.)

-- Jim

--- In rest-discuss@yahoogroups.com, Sandeep Shetty <sandeep.shetty@...> wrote:
>
> Hey Jim,
>
> On Thu, Jul 2, 2009 at 1:12 AM, Jim Edwards-Hewitt<jimeh@...> wrote:
> > 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.)
>
> 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 resource. The data format used for transferring that
> state is the media type. "Navigation links" are specific to the media
> type and not the state of the resource. I could PUT
> application/atom+xml or application/x-www-form-urlencoded and GET
> text/html.
>
> --
> Sandeep Shetty
> http://sandeep.shetty.in/
>





#13101 From: Sandeep Shetty <sandeep.shetty@...>
Date: Tue Jul 7, 2009 6:07 am
Subject: Re: Re: Resources with read-only and read-write parts
sandeep.shetty@...
Send Email Send Email
 
Hey Jim,

On Tue, Jul 7, 2009 at 3:34 AM, Jim Edwards-Hewitt<jimeh@...> wrote:
> 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 it mostly applies to xml or html-based formats, where the same type
> of language is used to express the state of the resource and the purely
> content-type elements.)

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 method="PUT" path="/foo" in the form tag)

Sandeep Shetty
http://sandeep.shetty.in/


> --- In rest-discuss@yahoogroups.com, Sandeep Shetty <sandeep.shetty@...>
> wrote:
>>
>> Hey Jim,
>>
>> On Thu, Jul 2, 2009 at 1:12 AM, Jim Edwards-Hewitt<jimeh@...> wrote:
>> > 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.)
>>
>> 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 resource. The data format used for transferring that
>> state is the media type. "Navigation links" are specific to the media
>> type and not the state of the resource. I could PUT
>> application/atom+xml or application/x-www-form-urlencoded and GET
>> text/html.



 
Advanced
Add to My Yahoo!      XML What's This?

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