How to debug RESTful services?
Use an existing 'REST client' tool that makes it easy to inspect the requests and responses, like RESTClient.
I've found RequestBin useful for debugging REST requests. Post to a unique URL and request data are updated/displayed. Can help in a pinch when other tools are not available.
https://requestbin.com/
At my firm we use a variety of different tools and approaches to testing RESTful services:
We write cURL scripts - essentially a single command saved in a file. One file per resource per method. For PUT and POST, we'll usually have files containing the representations to send alongside the cURL script. For example, for a mailbox resource, we might have a file named
mailbox_post.cmd
, which might contain the linecurl -v -X POST -u username -H 'Content-Type:application/xml' -d @mailbox_post.xml http://service/mailbox
. We like this approach because we end up building a collection of tests which can be run in a batch, or at least passed around between testers, and used for regression testing.We use cURL and RESTClient for ad-hoc tests
We have the service serve XHTML by default, so it's browsable, and add forms resources, so the service is actually partially or fully testable using a browser. This was partly inspired by some parts of RESTful Web Services, wherein the authors show that the line between web services and web applications may not need to be as solid and strict as is usually assumed.
We write functional tests as Groovy closures, using the Restlet framework, and run the tests with a test runner Groovy script. This is useful because the tests can be stateful, build on each other, and share variables, when appropriate. We find Restlet's API to be simple and intuitive, and so easy to write quick HTTP requests and test the responses, and it's even easier when used in Groovy. (I hope to share this technique, including the test runner script, on our blog soon.)
Postman, a Google Chrome extension, may be helpful.
Edit years later: Also the website of the url in case Chrome extension link gets changed: www.postman.com