Thoughts that exceed 140 characters.

Shorter and less relevant thoughts about nothing and everything can be found on my Twitter feed.
Aug 11
Permalink

Updating web resources

The following is a very well written and concise list of ways to update or edit a resource over http. The orginial post, Web resource mapping criteria for frameworks was taken from Bill de hÓra’s blog. It’s kept here for future reference. If you read this through an imported note on Facebook, I apologize. This is extremely boring. Drop me a note and I’ll send a zombie to bite you or something. -JF

Let’s take editing some resource, like a document, and let’s look at browsers and HTML forms in particular, which don’t a do a good job of allowing you to cleanly affect resource state. What you would like to do in this suboptimal environment is provide an “edit-uri” of some kind. There are basically 5 options for this; here they are going from most to least desirable

  1. Uniform method. Alter the state by sending a PUT to the document’s URL. The edit-uri is the resource URL. URL format: http://example.org/document/xyz
  2. Function passing. Allow the document resource to accept a function as an argument. URL format: http://example.org/document/xyz?f=edit
  3. Surrogate. Create another resource that will accept edits on behalf of the document. URL format: http://example.org/document/xyz/edit
  4. CGI/RPC explicit: send a POST to an “edit-document” script passing the id of the document as a argument. URL format: http://example.org/edit-document?id=xyz
  5. CGI/RPC stateful: send a POST to an “edit-document” script and fetch the id of the document from server state, or a cookie. URL format: http://example.org/edit-document
Read more (if you care)