3

I read tons of posts, questions and answers on the REST vs SOAP debate. I read a few REST supporters that claim that "well designed" REST Web Services are self explanatory and hardly need any documentation.

Can anyone point me to such a Web Service? Preferably a somewhat complicated one.

jheddings
  • 26,717
  • 8
  • 52
  • 65
idophir
  • 212
  • 3
  • 15
  • what language are you using? in .net SOAP is easier, and fairly self documenting. On say PHP be prepared to hand code stuff the wsdl should describe for you. – Byron Whitlock Nov 17 '09 at 19:19
  • This seems like a good candidate for a community wiki... – jheddings Nov 17 '09 at 19:28
  • My question is general and not language dependent. I am very familiar with SOAP consumed from .NET and I think the WSDL makes it very easy to integrate with SOAP Web Services. However I am interested to know why RESTful advocates claim that a RESTful WS is easier to handle and understand (when "well defined"). I guess I'm looking for that well defined service that does not require a manual. – idophir Nov 17 '09 at 19:56

3 Answers3

1

Here is an example of a complex API for a network video camera... I recommend looking at the VAPIX HTTP 3.0 API. It is pretty straightforward to follow, assuming you are familiar with the terms. Granted, it is about 60 pages, but much of it is just boilerplate to get the reader familiar with using a network API.

The Yahoo! Weather Feeds are an example of a simple, RESTful way to pull information from a service.

There are also examples of REST API's that essentially send XML-structured data back and forth. While these are technically REST, if you are going through the trouble to define an API using XML, I'd consider using web services.

jheddings
  • 26,717
  • 8
  • 52
  • 65
  • I don't get it. The Yahoo API is just using one resource. I don't think it is a good example of a RESTFUL WS. The network camera is using POST and GET and a few different resources but I don't think you can move one inch without the manual. I don't think it is qualified as "well defined". At least not in a way that would render REST as more straightforward than SOAP. – idophir Nov 17 '09 at 19:52
  • Not that i'm claiming to fully understand REST, but the VAPIX HTTP API doesn't seem to adhere to REST. It is HTTP-based however VAPIX URL's identify actions rather than resources, so to delete a user is a GET to http://myserver/axis-cgi/pwdgrp.cgi?action=remove&user=joe whereas under REST it would be a DELETE to something like http://myserver/axis/user/joe. – jon hanson Nov 17 '09 at 20:08
  • @PostalMethods: if you are looking for an API that requires no documentation to get you started, you've got a hard problem in front of you. The VAPIX API is quite well-defined, but expects some understanding of the industry. As for the Yahoo! API, it is simply an example of a well-defined API... I'm not sure why it wouldn't be a good example of a RESTful API. – jheddings Nov 17 '09 at 21:13
  • @jon hanson: I'm not an expert either... I've heard folks debate on the usage of verbs in the request line versus the HTTP action. From my understanding, it does adhere to the constraints of a RESTful API. There may be other generally-accepted principles that are debateable in the API... – jheddings Nov 17 '09 at 21:19
  • @jheddings: The Yahoo! API is just simplistic. There are no much us of resources. I'm looking for a WS that utilizes POST, GET, DELETE and PUT and also uses multiple resources (e.g., www.domain.com/userid/123123//) – idophir Nov 18 '09 at 07:49
  • @jheddings, why is a Rest API that defines an XML interface not considered restful? Rest is about using puts and posts to insert/update data. So you can specify that data be supplied as name/value pairs, XML, Json or whatever. No? – Marcus Leon Nov 18 '09 at 14:48
  • @Marcus: I agree that it is RESTful, but having complex XML structure just seems to lend itself well to SOAP. And the debate about whether SOAP is RESTful goes on... – jheddings Nov 18 '09 at 15:25
1

I found Netflix's documentation to be very good and help you understand what goes into designing an API. The API is not perfect, but I think it is a good combination of practical and thoughtful.

The idea of a self documenting REST API is that one can be given a single entry point into a system and be able to discover all functionality available through the returned documents, combined with understanding of standard usage of the REST verbs (GET, PUT, DELETE). So that if you pulled up a list of employees from a RESTful system, the individual entries would point to the URL of that entry and the employer field would point to the URL for the employer. Do a search on HATEOAS for more details. But you might call "/employee" on a service and get:

<employees>
  <employee id=132 name=bob url="/employee/132" employer="/employer/176"/>
  <employee id=179 name=carl url="/employee/132" employer="/employer/122"/>
</employees>

You could view the complete employee record at /employee/132 and view the record of their employer at /employer/176. By convention, if you had permission, you could update the employee bob using PUT against /employee/132 or create a new employee with a POST to /employee. The content types accepted are queryable through the interface, also (using HEAD, I believe).

Tim
  • 6,851
  • 11
  • 42
  • 46
0

Check out Amazon S3.

Gandalf
  • 9,648
  • 8
  • 53
  • 88