4

I was recently reading the Wikipedia article for Resource-Oriented Architectures (ROA) and stumbled across an article that made the assertion that, although REST is a technology that is very-well suited for web applications and web services, that it is nevertheless a standalone technology that can be used in non-web applications.

This is the first I've ever heard of such a thing! I thought REST was a SOAP competitor, but that the two were strictly web service solutions.

My question: can someone provide an example for how REST is used in something that isn't a web app? Like a Swing client, or a command line tool, or an EJB.

5
  • 1
    Related: stackoverflow.com/questions/1581190/…
    – yannis
    Feb 4, 2012 at 23:36
  • I've not used it myself but I believe that Androids' ContentProvider API is RESTful. See here for a blog entry with an example: Android Content Providers
    – Matt
    Feb 5, 2012 at 0:07
  • 3
    Your confusion is understandable. While some REST concepts are easy to understand and comply with (e.g. use of common verbs such as POST, GET, etc), other concepts are still baffling people. According to Roy Fielding, REST APIs must be hypertext-driven; anything else is simply not REST. He also has pretty strong opinions on how a RESTful API must be discovered by the client.
    – Andres F.
    Feb 5, 2012 at 0:48
  • 3
    How do define "web app"? Is a desktop client that accesses a server via the internet using a RESTful interface a web app? Feb 5, 2012 at 1:34
  • have seen server to server non giu apps make restful calls to send alerts etc
    – tgkprog
    Apr 10, 2013 at 18:38

2 Answers 2

3

I used a REST API for a communications server that was used in a radio devices. I'd say SMTP is a REST API too (ie you connect to a resource on port 25 and have verbs like MAILTO, SEND, TO, etc to build up a message)

2
  • 3
    In the past I would have thought the same, but according to Roy Fielding, who first described the REST architecture, hypermedia is a mandatory requirement of REST. Also note that no-one besides Fielding seems to know exactly what REST means.
    – Andres F.
    Feb 5, 2012 at 0:42
  • I think SMTP isn't a good example, because the server has intermittent state, which is much more core to common uses of REST than the hypermedia point. The whole point is that there's many resources, with few verbs. SMTP, by your description, has many verbs on a single resource.
    – skrebbel
    Apr 10, 2013 at 13:08
0

I'm not aware of a good non-HTTP-based protocol example that fits the "many resources, few verbs; transfer all state" aspects of REST.

However, plain ROA/HTTP-style REST is used in plenty places outside the web itself. For example, I've been involved in the development of software for an industrial LED production machine, where the various components communicated with one another (within the same computer, and over an internal network between controllers inside the machine) via plain common HTTP-ish REST.

The non-realtime parts of the controller code were written in C#, and I believe one of Microsoft's WCF incarnations was used to make RESTful endpoints. Using plain HTTP and resources made debugging and message logging a charm, since all web-enabled tools (curl, browser, Fiddler2, http logs) were at our disposal.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.