59

I'm looking for an easy way to debug RESTful services. For example, most webapps can be debugged using your average web browser. Unfortunately that same browser won't allow me to test HTTP PUT, DELETE, and to a certain degree even HTTP POST.

I am not looking to automate tests. I'd like to run new services through a quick sanity check, ideally without having to writing my own client.

Oleg Pavliv
  • 20,462
  • 7
  • 59
  • 75
Gili
  • 86,244
  • 97
  • 390
  • 689

17 Answers17

35

Use an existing 'REST client' tool that makes it easy to inspect the requests and responses, like RESTClient.

John Sheehan
  • 77,456
  • 30
  • 160
  • 194
Peter Hilton
  • 17,211
  • 6
  • 50
  • 75
  • Both of these look like extremely interesting tools, thanks for the pointers! – rjray Oct 03 '08 at 09:04
  • i am using first one , works simply nice for me. – Asraful Jun 28 '12 at 11:58
  • I wrote a REST client plugin called Requester for Sublime Text, https://github.com/kylebebak/Requester. It's inspired by HTTPie and Postman. It's very powerful and easy to use, and it's cross-platform. If you're not in love with your HTTP client it's definitely worth a try. – kylebebak Aug 17 '17 at 03:54
15

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 line curl -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.)

Avi Flax
  • 50,872
  • 9
  • 47
  • 64
13

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

Yasin Okumuş
  • 2,299
  • 7
  • 31
  • 62
  • This is a relatively new extension, but simply for the ability to save sets of requests, and manage / share them + a nice interface, I'd recommend it very highly. – ocodo Jul 16 '13 at 16:01
  • Postman we can upload file requests too as multipart data – Ramesh sambu Dec 29 '16 at 07:52
  • Dead link. I guess [this app](https://www.postman.com/) is it? I’m not sure. – Guildenstern Apr 22 '20 at 07:25
  • 1
    @Guildenstern yes, that's it. I believe it is no more "only a chrome extension", now also a standalone app. You may also use Firecamp, Postwoman, Insomnia etc. – Yasin Okumuş Apr 22 '20 at 14:59
8

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/

5

A tool I've found useful if you're running OS X Leopard:

HTTP Client

It's a very simple GUI program that allows you to craft http requests to a resource and view the response.

vamin
  • 2,178
  • 6
  • 26
  • 30
4

You can use fiddler's Composer to debug restful services..

Updated JD 12 sep 2013: Rest Builder is now called Composer.

Jan Doggen
  • 8,799
  • 13
  • 70
  • 144
Gulzar Nazim
  • 51,744
  • 26
  • 128
  • 170
4

cURL works just fine.

Hank Gay
  • 70,339
  • 36
  • 160
  • 222
3

I ended up settling on POSTMAN

It supports all REST features I could think of, and the UI is absolutely excellent. The only downside is that it requires Chrome.

Gili
  • 86,244
  • 97
  • 390
  • 689
2

I'm using Soap UI to test my REST API.

It is more complete than any other tools:

  • fine debug requests and responses
  • automated testing
  • all GUI based
  • properties and properties transfer to parameterize your tests
  • conditional testing
  • performance testing

I'm not working for SmartBear. I was already a big fan of SoapUI while using it for SOAP WebServices.

My SoapUI REST Project

Tony Baguette
  • 617
  • 7
  • 14
2

RESTTest for Firefox (an add-on). Fiddler for IE.

system PAUSE
  • 37,082
  • 20
  • 62
  • 59
0

Aside from using one of the tools in Peter Hilton's response, I would have to say that scripting the tests with LWP or some similar tool may be your only option. You could bypass the use of LWP by just opening a socket, sending a raw HTTP request in and examining what you get in return. But as far as I know, there are a dearth of testing tools for this sort of domain-- most look at this problem-space primarily from the lens of a web-site developer, and for them the browser is enough of a testing platform.

rjray
  • 5,525
  • 4
  • 31
  • 37
0

I use restclient, available from Google Code. It's a simple Java Swing application which supports all HTTP methods, and allows you full control over the HTTP headers, conneg, etc.

Ian Dickinson
  • 12,875
  • 11
  • 40
  • 67
0

I tend to write unit tests for RESTful resources using Jersey which comes with a nice REST client. The nice thing is if you implement your RESTful resources using JAX-RS then the Jersey client can reuse the entity providers such as for JAXB/XML/JSON/Atom and so forth - so you can reuse the same objects on the server side as you use on the client side unit test.

For example here is a unit test case from the Apache Camel project which looks up XML payloads from a RESTful resource (using the JAXB object Endpoints). The resource(uri) method is defined in this base class which just uses the Jersey client API.

e.g.

clientConfig = new DefaultClientConfig();
client = Client.create(clientConfig);

resource = client.resource("http://localhost:8080");
// lets get the XML as a String
String text = resource("foo").accept("application/xml").get(String.class);
Jasper
  • 2,166
  • 4
  • 30
  • 50
James Strachan
  • 9,168
  • 34
  • 31
0

If you want free tool for the same purpose with additional feature of multipart form data submission it is here http://code.google.com/a/eclipselabs.org/p/restclient-tool/

Yadu
  • 1
0

because its totally missing here: https://luckymarmot.com/paw

Is worth ever penny...

Toby
  • 2,720
  • 5
  • 29
  • 46
0

Firefox's has RESTClient plug-in to send different request with methods, parameters, headers etc.

Amit Patel
  • 15,609
  • 18
  • 68
  • 106
0

You guys should check poster extension for firefox, it's simple and useful enough to use :)

Gili
  • 86,244
  • 97
  • 390
  • 689
Dzung Nguyen
  • 9,152
  • 14
  • 65
  • 104