Click here to Skip to main content
Click here to Skip to main content

An Editor for Communicating with RESTful Services

By , 3 Mar 2009
Rate this:
Please Sign up or sign in to vote.

GoMenu.gif

Introduction

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.

Background

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 POST, PUT, GET, and 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 GET and 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 POST, PUT, GET, or 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.

Source Control

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.

History

  • 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.

License

This article, along with any associated source code and files, is licensed under A Public Domain dedication

About the Author

christophilus
Software Developer
United States United States
I'm a professional geek.

Comments and Discussions

 
GeneralSending HTTP request from customer computer with the thinnest client process to a website... [modified] Pinmemberjwpjr7659-Mar-09 11:58 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Mobile
Web03 | 2.8.140415.2 | Last Updated 3 Mar 2009
Article Copyright 2009 by christophilus
Everything else Copyright © CodeProject, 1999-2014
Terms of Use
Layout: fixed | fluid