22 Feb 2011

Beyond POST and GET

POST and GET are the most common http data transfer methods. There are however others like HEAD, PUT and DELETE. The problem with these other methods however is support on various clients. Some clients don't support them, so you are left with the choice of workarounds.

So what are your workaround options?

1. _method
Some clients allow you to pass a _method parameter to the URL like this

1
    http://api.somesite.com/user/1234?_method=PUT

You can then pass other required body of the query via post to the modded url. The same applies to DELETE as well.

2. Google Data Protocol
Google's Data Protocol allows you set a method overwrite header. The specs states you simple add the applicable method override header to your request like this:

1
    X-HTTP-Method-Override: PUT

or

1
    X-HTTP-Method-Override: DELETE

Normally, you'd think this specs will apply to google API's and resources alone but many clients are adopting this work around as well. I came to notice this when toying with the cloudApp API via J2ME. The _method hack didn't work but the Google Data Protocol did work.

 

Looking for a simple marketing automation tool to automate your customer onboarding, retention and lifecycle emails? Check out Engage and signup for free.

 

My name is Opeyemi Obembe. I build things for web and mobile and write about my experiments. Follow me on Twitter—@kehers.

 

Next post: Native apps vs Mobile web apps