O'Reilly logo

Programming ASP.NET 3.5, 4th Edition by Jesse Liberty, Dan Hurwitz, Dan Maharry

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Introducing REST and JSON

SOAP is just one standard for implementing web services, but it is not the only one. Another popular style of implementation is to use REST to define a service’s location and make calls to the service, and JSON to define the data. REST is a simple style of calling web services that is closely tied to the verbs (e.g., GET and POST) provided by HTTP, and JSON is a simple alternative to XML that is based on how data is defined in JavaScript. One important advantage of SOAP is that it is strictly defined, and when it is coupled with WSDL, it is easier to write tools that automatically generate proxies. REST and JSON are very simple protocols which are easy to code against in any language without the need for tools, and parsing of JSON is built into JavaScript. JSON also often uses less bandwidth than XML.

REST

REST stands for Representational State Transfer, and it is a style of service rather than an exact specification. REST services consist of a number of uniquely identifiable “resources,” and there are only four operations one can perform with a resource: read it, modify it, delete it, or create a new one.

When REST services are exposed over HTTP (as is typically the case), URIs are used to refer to server-side resources, and operations on those resources are represented as the HTTP verbs GET, POST, DELETE, and PUT.

A simple example is a book database. A URI to a book could be:

http://bookdatabase.oreilly.com/books/ISBN/<isbn_id>

where isbn_id is the unique identifier ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required