Consuming REST-based Web Services (XAM150)

Users expect to access their information anytime from any location using any device. This leads most app developers to store data in the cloud and retrieve it as needed from client devices. REST-based web services are the dominant strategy for this type of device-to-server communication. In this course, you will see how to consume REST-based web services with HttpClient using both the managed networking stack and the platform-specific handlers that boost performance. You will also learn some common strategies for dealing with the unique challenges that mobile devices face when communicating over the network.

Upon completion you will be able to:

Course exercise download

Exercise materials are available from GitHub. The code can be cloned through a desktop Git client or downloaded directly as a ZIP file.

If you are using Windows, try to select a location with a shorter path length to make sure you don't exceed the 260 character limit.

Lecture

Here are the lecture slides.

Exercises

  1. Exercise 1: Determine the network connectivity

    The primary goal of this lab will be to create a new Xamarin.Forms application and utilize the Xam.Plugin.Connectivity component to detect the network availability and state. You will display the current network status on two pages as shown in the screenshots below.

  2. Exercise 2: Communicate with a book service

    In this exercise you will extend a provided Xamarin.Forms application to work with an existing REST service which manages a library of books. You will authenticate with the service, retrieve existing books, add new books, update books and delete books from your bookshelf.

  3. Exercise 3: Use the native platform network stack

    In this final exercise, we will modify the bookshelf client to use the native platform's networking stack to improve the performance of the network activity and allow us to integrate tighter to the platform. You can either continue from the prior exercise, or use the completed project from the prior exercise if you'd like to start fresh.

Additional resources

Additional Resources

Introduction to Web Services Calling a REST API From a .NET Client Microsoft REST API Guidelines Architectural Styles and the Design of Network-based Software Architectures Simulating network failure on a Mac with the Network Link Conditioner