GET and POST: The rest is history
This is going to be some sort of tribute to the web, and all the people who helped the web to become possible.
The web could have been a read-only medium. I think it could have been succesful; people uploading HTML pages (and HTML page-generating scripts) through FTP while submitting the corresponding URLs of the Hypertext Reading Protocol to search engines, and let them crawl and index their pages. It would have been the biggest library in the world.
“A read-only medium is nice, but what about a read/write medium?” Someone must have thought. If we would specifify an explicit read method, we can just as well make a write and delete method. So GET, PUT and DELETE where born, resulting in an early form was what going to be the Hypertext Transfer Protocol. The protocol had striking similarities with a filesystem.
The designers thought of one other feature. They wanted to make publishing new content as easily as possible. This is were HTTP and filesystems diverge. They added an extra method, POST, which was a little like PUT, in the sense that you could instruct the webserver to store a new resource. Only this time, the server was in control of the URL space. In other words, the server decides where your new resource will be located. This relieved the content author from the task of finding an empty location to store the new resource. Now, all CRUD functionality had been accounted for. This was nice.
So far, it has been all quite predictable. Now something strange happens. Someone apperantly gets the idea that it would be advantegous to overload the POST method. The POST method already gave the server much responsibilities. For example, it could check the contents of the resource to decide where to place it. But, with reasons not apparantly clear to me, they let go of all semantic constraints of the POST method. POST became a catch-all, a ‘do as you please’ method of sorts. For all HTTP cares about, it’s just a message that’s posted to the resource identified by the URL. [See the posting 'Post vs PUT']
Aside from that, they also extended the HTML specification with forms to aid webpage visitors to send a structured message. The adding of the POST method, as we will see, would turn out to be genius.
The Hypertext Reading Protocol allowed for arbitrary information discovery. The new Hypertext Transfer Protocol however, allowed for arbitrary service discovery. I can’t stress the importance of that enough.
The web in it’s early days must have surely been a nice and exciting place, with all it’s interlinked webpages. But just reading would get boring. To read, and then being able to actually do something, that was exciting. Leave a message in a guestbook, ask or answer a question in a forum, or order a rare book from Amazon: That’s exciting.
Fast forward to the present time. E-commerce, online communities, online auctions, bug databases, blogs (decentralized, but interconnected by trackbacks!), webbased feed readers, social bookmarking: What do they all have in common? Arbitrary service discovery. That’s what the web is all about.
Funny thing is that – despite it clear presence in the HTTP specification – PUT and DELETE are rarely used, if at all. It could very well be that we don’t really need those, because we’re blessed with arbitrary service discovery. A plain, dumb filesystem is a good example of one such possible service, but not neccesarily the most important one.
The Hypertext Reading Protocol is fictional. However, there was a protocol called HTTP 0.9 which only supported GET. Actually, I made up the whole story. But it’s based on true facts. It’s a story how it could have been. I expect that most of you who’ve read this far, know the rest of history yourselves.
For any of you who are interested in SOAP/WSDL/etc Web Services, or ever took interest in them, you should take note of a quote of Mark Baker: The web is what Web Services are trying to be. Also read Towards fully document-oriented Web services, also by Mark Baker. Better yet, subscribe to his blog. You’ll be a better developer, architect or analist because of it.
If you want to fully appreciate the architecture of the web, you should read Roy Fielding’s dissertation: Architectural Styles and
the Design of Network-based Software Architectures.
Recent comments on this blog