Chapter 6. Representational State Transfer—REST

In this chapter, we will cover:

  • Consuming RSS feeds
  • Using the Twitter API
  • Building a simple REST service

Introduction

The beauty of the World Wide Web is its simplicity in addressing any resource using a simple URI (Uniform Resource Identifier) wherever it exists or whatever type it may be. This architectural success is the basis of Representational State Transfer (REST).

HTTP (Hypertext Transfer Protocol) is the most simple, scalable, stateless, and open protocol used on the Web. The two most popular verbs used are GET and POST. GET returns a specific resource requested, while POST creates a new resource. REST services provide simple URI access to resources exposed over HTTP. REST supports four HTTP verbs: GET, POST, PUT, and DELETE. Unlike POST, PUT modifies an existing resource. DELETE removes the resource. In this chapter let's explore different providers such as CNN and Twitter, and build a simple REST service.

Different types of content or media are available like the following popular ones:

  • XML—application/xml
  • RSS—application/rss+xml
  • ATOM—application/atom+xml
  • JSON—application/json
  • XHTML—application/xhtml

WebClient and HttpWebRequest are two important classes used in Windows Phone 7 to request services. The following picture illustrates how it works at a high level.

Introduction
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset