Verbs and Nouns, Methods and URLs

Following the concept of HTTP as the Web’s pidgin language, it’s interesting how often the only two verbs in this language, GET and POST (PUT and DELETE are making a comeback, but still pretty rare), are interchanged. It seems many developers simply use POST whenever there’s a form and GET when there’s a link – not the way they’re meant to be used.

Here’s how it is: GET is when you want to get some data from the server. POST is when you want to change the data in the server. GET is for read. POST is for write.

It’s important to keep data-changing actions behind POST – common mistake is to make a “Delete” GET link and then get it accidentally activated when a bot crawls your site (if you didn’t follow that particular issue – Rails team eventually realized it was their mistake and added support for POST links).

It’s equally important to make various reads via GET, because that way you’re allowing people to link to specific data in the site. A common scenario: a simple search field behind POST forces users to ask their friends to “go to this URL, then search for “x”…” instead of simply sending them a link to the search results. Naturally it gets worse in more complex forms, with several variables.

Speaking of URLs, seems to me deep URLs – pointing to specific content on the site – aren’t getting the care they deserve. Used to be that HTML frames hid the URL for a specific data item or view from the user, now you often get this in AJAX interfaces. It’s a shame, since deep URLs are really the most basic and most used Web API. It’s the link to an article, or product or comment to a story that people send to their friends.

Back in Notifyr (yeah, I’m going to milk every drop of Webapp examples material from this little app) I put in a short explanation page on how to build a simple URL to subscribe to a specific account. It’s cool to see folks using this to create their own “Subscribe to my photos” link in their profiles and blogs.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s