PUT no longer works after DELETE

0 views
Skip to first unread message

Harry

unread,
Mar 21, 2009, 1:46:01 AM3/21/09
to CloudKit
Hi Jon,

I was doing a PUT, deleted the specified resource with DELETE and
reattempted to PUT.

Why does this yield an http 401 error!?

Cheerio, Harry.



Jon Crosby

unread,
Mar 21, 2009, 4:29:56 PM3/21/09
to clou...@googlegroups.com
On Fri, Mar 20, 2009 at 10:46 PM, Harry <harry....@gmx.net> wrote:

Hi Jon,

I was doing a PUT, deleted the specified resource with DELETE and
reattempted to PUT.

Why does this yield an http 401 error!?

You mean a 410? This is intentional and there is even a spec for this behavior (see spec/service_spec.rb around line 636, noting the comment about URIs). A 410 means that a resource once existed but is now gone. The reason for this behavior is to prevent a stale client from trying to update a resource that no longer exists. Once a resource has been created, its URI should be considered "used." Once it has been deleted, it should be considered "gone." In this case of a stale client trying to update the missing resource, it should receive a 410 so that it can decide what to do according to its application rules. It might be okay to recreate this exact object at a new URI (using POST to start a new chain of revision history). This also allows the original (non-stale) client to notice the new object rather than having to keep track of previously deleted objects that might come into existence again.

I hope this explanation was helpful.

-Jon



Cheerio, Harry.






Harry

unread,
Mar 21, 2009, 11:34:04 PM3/21/09
to CloudKit
Hi Jon,

thanks for the explanation - that certainly helps ;-)

Cheerio, Harry.
Reply all
Reply to author
Forward
0 new messages