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:
- Obtain the device's network capabilities
- Describe the strengths of using REST-based services
- Consume REST services in Xamarin-based applications
- Leverage the platform-specific networking stacks
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
-
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.
-
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.
-
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.