REST-BASED SERVICES

Now that you've seen how to perform HTTP requests and receive HTTP responses, you're most of the way to using RESTful services. You can use exactly the same code from the previous section to do this, with one change: You need to process the data you send and receive so that the service understands it.

Consuming a RESTful Service

To show how easy it is to use a RESTful service, the best thing to do is to try one out. The exact syntax of these services varies between implementations, but it's usually easy to find out what to do.

In this section and in the following Try It Out, you'll see how to use the Flickr REST service application programming interface (API). You can find full details of the available services and ways to call them at www.flickr.com/services/api/. This page includes links to various language implementations, including .NET, but you can also use the simple REST interface.

image NOTE You need an API key in order to use the Flickr services. You need to register with the site at www.flickr.com if you haven't already done so, and then you can get a key at www.flickr.com/services/apps/create/. Basic membership of Flickr is completely free, and you don't need to provide any payment details.

Many of the Flickr API calls require user authentication. Basically, you must direct users to an authentication page provided by Flickr, where they can enter a username ...

Get Beginning Windows® Phone 7 Application Development: Building Windows® Phone Applications Using Silverlight® and XNA® now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.