This is an application which helps test/tinker with RESTful services by allowing users to edit the raw HTTP which is sent to the server and view the raw HTTP responses.
REST stands for Representational State Transfer. It is a very simple architectural style of application development in which objects are acted upon using a fixed set of methods. In many cases, REST is implemented via HTTP, since it lends itself so well to the task. The objects are represented by URIs, and the set of methods are
DELETE. I won't go into much detail about REST here, but you can see my Links section for more information.
The problem with this approach is that most browsers do not support anything outside of
POST. So, I threw together this little application to do the job. I've used it to help me test one of my RESTful services, and it has proved to be quite handy.
Using the Application
The application allows you to type raw HTTP into the request panel (the left panel). You can then
DELETE the HTTP to a given URI. By default, RESTPad will make minor corrections to your entry. It will substitute the URI in the address bar for whatever URI you might have entered into the request. It will also correct your content-length. If you do not want this auto-correction, you can turn it off by un-checking Options->Use Auto Correct.
Points of Interest
If you have entered a content-encoding header, RESTPad will honor it and send the request using gzip or deflate. (It currently does not understand any other form of encoding.)
Internally, RESTPad is using the
HttpWebRequest class. The very early versions of RESTPad were using raw sockets, but the
HttpWebRequest class makes too many things too convenient to pass it up. Unfortunately, it also has some quirks, such as not allowing you to set certain headers via the generic "headers" collection. RESTPad understands some such headers, but there is probably a set of headers which RESTPad will attempt to set generically, causing the
HttpWebRequest object to complain. If you need such a header, simply modify the code to treat that header specially, as it currently is doing with content-encoding, content-length, etc.
Getting Started With REST
This is a little off topic, but here are some basic links on REST/documentation of some RESTful services.
I'm rather fond of Mercurial, so I'm hosting the source over at bitbucket.org. You can pull the repository and if you really want, I can add you as a contributor.
- 01 March 2009 - Updated to support specifying credentials via an item in the Options menu
- 02 March 2009 - Modified to no longer dump output to disk, added processing indication
- 03 March 2009 - Fixed content-header bug and a bug with error handling
This is currently a beta and is in pretty rough form, but useful nonetheless. I am planning on setting it up on Codeplex or Sourceforge sometime pretty soon.
The code is public domain, so take it and do what you please. If you add something really nice, it would be kind to share with all.