2

I just started learning web services and I have a newbie question:

A web service that provides data in json format is necessarily a REST web service?

Thanks in advance! =D

iosDev
  • 61
  • 1
  • 4
  • http://stackoverflow.com/questions/16626021/json-rest-soap-wsdl-and-soa-how-do-they-all-link-together – Karthik Nov 09 '13 at 17:49

1 Answers1

0

Actually, a web service that uses plain JSON is most likely not a REST web service at all. One of the most important (and overlooked) constraints of REST is HATEOAS, or Hypertext As The Engine Of Application State. This simply means that a REST web service should be used just like you use a website, by receiving documents with representations of the resources you're interested in them, with links to other resources, and you use it by following links to do what you want to do.

You'll realize very few "REST" APIs actually do that, with most requiring you to assemble URIs to whatever you want by following templates presented in documentation.

JSON doesn't support links natively, so for a web service using JSON to be RESTful, it will necessarily need some standard for presenting links to other resources in JSON format. One of those formats is HAL, but there are others.

Unfortunately, there's a lot of misinformation and misconceptions around REST, including some very popular questions and answers here on Stack Overflow itself, and most so-called REST APIs aren't RESTful at all. The link below, by the author of REST, summarizes the whole issue in easier language than his academic thesis:

http://roy.gbiv.com/untangled/2008/rest-apis-must-be-hypertext-driven

Pedro Werneck
  • 40,902
  • 7
  • 64
  • 85