SlideShare a Scribd company logo
XAMARIN FORMS
NOOB TO MASTER
By Rendy Del Rosario and Charlin Agramonte
Week 5
Objectives
- Understand what is a Web service
- Understand what is a REST API and how to use in Xamarin
- Consume a real API in Xamarin
Web Service
A web service is a collection of open protocols and standards used for exchanging
data between applications or systems.
For transferring data it uses:
- XML
- JSON
SOAP RESTFUL
TYPES
API (Application Programming Interface)
Is a set of defined functions and methods for interfacing with the underlying
operating system or another program or service running on the computer.
RESTful Web Service
What are REST services?
REST (Representational State Transfer) is an architecture for creating distributed
applications which is modeled around the HTTP specification
Definition
URL HTTP methods
A media type for the
data
https://www.some_address.com/customers GET/POST/PUT/PATCH/DELETE JSON/ XML
Rest operations
- Get
- Post
- Put
- Patch
- Delete
Rest operations: GET
This operation is used to retrieve data from the web service.
https://www.some_address.com/users/
https://www.some_address.com/users/5 https://www.some_address.com/users?id=5
Rest operations: POST
This operation is used to create a new item of data on the web service.
https://www.some_address.com/users/5
Rest operations: PUT
This operation is used to update an item of data on the web service.
https://www.some_address.com/users/5
Rest operations: PATCH
This operation is used to update an item of data on the web service by describing
a set of instructions about how the item should be modified.
https://www.some_address.com/users/5
Rest operations: DELETE
This operation is used to delete an item of data on the web service.
https://www.some_address.com/users/5
Media Types
JSON
JSON (JavaScript Object Notation) is a
lightweight format that is used for data
interchanging. It is based on a subset of
JavaScript language (the way objects are
built in JavaScript).
HttpStatus
The REST service sends an HTTP status code in the
HttpResponseMessage.StatusCode property, to indicate whether the HTTP
request succeeded or failed. The common responses for this operation are:
201 (CREATED)
400 (BAD
REQUEST)
500 (SERVER
ERROR)
404 (NOT FOUND)
Example
Security in REST
- Security is ultimately decided by the service
– the client can only conform to what the
service allows
- Should always prefer https to protect the
data peer-to-peer
REST in Xamarin
Xamarin API Options
HttpClient ServiceStack RestSharp Platform Specific
Most common
approach, built into
.NET
Full fledged 3rd party
web services
framework, has client
PCL for consuming
REST services
Full 3rd party client
library that supports
file downloads,
authentication,
chunking, etc
Native Platform Apis
for networking calls
HttpClient
The HttpClient class is used to send and receive requests over HTTP. It
provides functionality for sending HTTP requests and receiving HTTP
responses from a URI identified resource. Each request is sent as an
asynchronous operation.
HttpClient - Get
JsonConvert is a Json.NET class that can serialize and
deserialize data from a JSON string or stream based on a
specified Type
Deserialize object
JsonConvert.DeserializeObject<ObjectoToStrealize>(text);
HttpClient - Post/Put/Delete
Must serialize body and include encoding and content type
HttpClient customizations
Let’s do it step by step
1-Create an Interface IApiService for your call definitions
2-Create a class ApiService to handle your requests and implement the
previously created interface
3-Implement your request calls in your Api Service and define them in your
Interface
4-Do your calls in your ViewModel
5-Show the data in your views
GROUP EXERCISE
Interact with our first API
INDIVIDUAL EXERCISE
Using the Public API
Create an app for get a RNC of a company
TIME: 45 MINUTES
IOS - NSAppTransportSecurity
App Transport Security (ATS) enforces
secure connections between internet
resources (such as the app's back-end
server) and your app.
Mobile Networks
Applications should always determine whether a network is available
before starting a network operation
INDIVIDUAL EXERCISE
Add connectivity handler to your actual project
TIME: 15 MINUTES
Refit
Refit is a library heavily inspired by Square's Retrofit library, and it turns
your REST API into a live interface
https://github.com/paulcbetts/refit
Helpful tools for Json and Request Handlers
- http://json2csharp.com/
- https://www.getpostman.com/docs/postman/launching_postman/navi
gating_postman
HOMEWORK PRACTICE
Using the Public API for Weather
Create an App to get the Weather of Santo Domingo, DR
Recommended Lectures
- Web Service
https://developer.xamarin.com/guides/xamarin-forms/cloud-services/consuming/
- HttpClient in Xamarin Forms
http://blog.xhackers.co/httpclient-with-xamarin-forms/
https://www.youtube.com/watch?v=xNP-K37mssA
By Rendy Del Rosario and Charlin Agramonte
Week 5
THANK YOU!!!

More Related Content

PDF
Xamarin Workshop Noob to Master - Week 3
PDF
Xamarin Forms - Noob to master - Week 2
PDF
Xamarin Forms - Noob to master - Week 1
PDF
PPTX
Sviluppare applicazioni nell'era dei "Big Data" con Scala e Spark - Mario Car...
PPTX
Sviluppare applicazioni cross-platform con Xamarin Forms e il framework Prism...
PPTX
MVC Training Part 1
PPTX
Introduction ASP
Xamarin Workshop Noob to Master - Week 3
Xamarin Forms - Noob to master - Week 2
Xamarin Forms - Noob to master - Week 1
Sviluppare applicazioni nell'era dei "Big Data" con Scala e Spark - Mario Car...
Sviluppare applicazioni cross-platform con Xamarin Forms e il framework Prism...
MVC Training Part 1
Introduction ASP

What's hot (20)

KEY
MVC on the server and on the client
PDF
AWS ❤ SAM - Serverless on stage #9 (Milan, 20/02/2018)
PPTX
Lesson 02 Introduction to XAML
PPTX
Client Object Model - SharePoint Extreme 2012
PPT
Building Cool apps with flex
PPT
Introduction to Adobe Flex - Zaloni
PDF
iOS Swift application architecture
PPTX
Mule velocity
PDF
Beginning Serverless Applications with AWS SAM
PPT
MVC Pattern. Flex implementation of MVC
PDF
Asp.net mvc basic introduction
PDF
Automated Testing on iOS
PDF
Intro to iOS Application Architecture
PPTX
Angular introduction basic
ODP
Launching Services in Amazon Web Services
PPTX
Intro to EmberJS
PPTX
Late Bound, Early Bound with Demo and Practical in Dynamics 365 Plugin
PPTX
Active server pages
PPTX
ASP .NET MVC - best practices
PPT
Mvc architecture
MVC on the server and on the client
AWS ❤ SAM - Serverless on stage #9 (Milan, 20/02/2018)
Lesson 02 Introduction to XAML
Client Object Model - SharePoint Extreme 2012
Building Cool apps with flex
Introduction to Adobe Flex - Zaloni
iOS Swift application architecture
Mule velocity
Beginning Serverless Applications with AWS SAM
MVC Pattern. Flex implementation of MVC
Asp.net mvc basic introduction
Automated Testing on iOS
Intro to iOS Application Architecture
Angular introduction basic
Launching Services in Amazon Web Services
Intro to EmberJS
Late Bound, Early Bound with Demo and Practical in Dynamics 365 Plugin
Active server pages
ASP .NET MVC - best practices
Mvc architecture
Ad

Similar to Xamarin Workshop Noob to Master – Week 5 (20)

PPTX
Hitchhicker's Guide to Using Xamarin Forms with RESTful Services
PDF
Integrando un rest api con refit
PDF
Android App Development 06 : Network &amp; Web Services
PDF
Zyncro rest api feb 2013
PPTX
Tutorial_Rest_API_For_Beginners_125.pptx
PPTX
80068
PPTX
Rest webservice ppt
PDF
Алексей Веркеенко "Symfony2 & REST API"
PPTX
rest-api-basics.pptx
PPTX
Mini-Training: Let's have a rest
PDF
There is REST and then there is "REST"
PDF
Writing RESTful Web Services
PDF
REST APIS web development for backend familiarity
PDF
Creating Restful Web Services with restish
PDF
Build REST APIs like a Jedi with Symfony2
PPTX
Beginner's Guide REST Basics - 101 by Smartbear
PDF
Building sustainable RESTFul services
PPTX
Austin Day of Rest - Introduction
PPT
ROA.ppt
PPTX
ASP.NET Mvc 4 web api
Hitchhicker's Guide to Using Xamarin Forms with RESTful Services
Integrando un rest api con refit
Android App Development 06 : Network &amp; Web Services
Zyncro rest api feb 2013
Tutorial_Rest_API_For_Beginners_125.pptx
80068
Rest webservice ppt
Алексей Веркеенко "Symfony2 & REST API"
rest-api-basics.pptx
Mini-Training: Let's have a rest
There is REST and then there is "REST"
Writing RESTful Web Services
REST APIS web development for backend familiarity
Creating Restful Web Services with restish
Build REST APIs like a Jedi with Symfony2
Beginner's Guide REST Basics - 101 by Smartbear
Building sustainable RESTFul services
Austin Day of Rest - Introduction
ROA.ppt
ASP.NET Mvc 4 web api
Ad

More from Charlin Agramonte (20)

PDF
State machine in .NET
PDF
Trabajando con máquinas de estados en.NET
PDF
Improving the ux of our xamarin forms apps
PDF
Mejorando el UX de nuestras aplicaciones móviles en Xamarin Forms
PDF
Desenvolvendo Aplicações SOLID
PDF
Mastering XAML in Xamarin Forms
PDF
C# Good practices
PDF
Starting my blog
PDF
C# Best Practices
PDF
Como prepararse y conseguir trabajo como Mobile Developer
PPTX
Desarrollando apps multi plataformas con xamarin forms
PDF
C#good practices in 10 minutes
PDF
Xamarin Forms Best Practices
PDF
Xamarin Forms Evolution
PDF
Why xamarin forms is awesome
PDF
Visual studio 2019 launch
PDF
Prism in xamarin forms from zero to hero
PDF
Xamarin forms - overcloud
PDF
Xamarin forms from zero to hero
PDF
Xaml tips and tricks
State machine in .NET
Trabajando con máquinas de estados en.NET
Improving the ux of our xamarin forms apps
Mejorando el UX de nuestras aplicaciones móviles en Xamarin Forms
Desenvolvendo Aplicações SOLID
Mastering XAML in Xamarin Forms
C# Good practices
Starting my blog
C# Best Practices
Como prepararse y conseguir trabajo como Mobile Developer
Desarrollando apps multi plataformas con xamarin forms
C#good practices in 10 minutes
Xamarin Forms Best Practices
Xamarin Forms Evolution
Why xamarin forms is awesome
Visual studio 2019 launch
Prism in xamarin forms from zero to hero
Xamarin forms - overcloud
Xamarin forms from zero to hero
Xaml tips and tricks

Recently uploaded (20)

PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PPT
Teaching material agriculture food technology
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
DOCX
The AUB Centre for AI in Media Proposal.docx
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
Machine learning based COVID-19 study performance prediction
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
Review of recent advances in non-invasive hemoglobin estimation
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
Dropbox Q2 2025 Financial Results & Investor Presentation
Chapter 3 Spatial Domain Image Processing.pdf
20250228 LYD VKU AI Blended-Learning.pptx
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Diabetes mellitus diagnosis method based random forest with bat algorithm
Teaching material agriculture food technology
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
The AUB Centre for AI in Media Proposal.docx
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
Network Security Unit 5.pdf for BCA BBA.
Machine learning based COVID-19 study performance prediction
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Review of recent advances in non-invasive hemoglobin estimation

Xamarin Workshop Noob to Master – Week 5

  • 1. XAMARIN FORMS NOOB TO MASTER By Rendy Del Rosario and Charlin Agramonte Week 5
  • 2. Objectives - Understand what is a Web service - Understand what is a REST API and how to use in Xamarin - Consume a real API in Xamarin
  • 3. Web Service A web service is a collection of open protocols and standards used for exchanging data between applications or systems. For transferring data it uses: - XML - JSON SOAP RESTFUL TYPES
  • 4. API (Application Programming Interface) Is a set of defined functions and methods for interfacing with the underlying operating system or another program or service running on the computer.
  • 6. What are REST services? REST (Representational State Transfer) is an architecture for creating distributed applications which is modeled around the HTTP specification
  • 7. Definition URL HTTP methods A media type for the data https://www.some_address.com/customers GET/POST/PUT/PATCH/DELETE JSON/ XML
  • 8. Rest operations - Get - Post - Put - Patch - Delete
  • 9. Rest operations: GET This operation is used to retrieve data from the web service. https://www.some_address.com/users/ https://www.some_address.com/users/5 https://www.some_address.com/users?id=5
  • 10. Rest operations: POST This operation is used to create a new item of data on the web service. https://www.some_address.com/users/5
  • 11. Rest operations: PUT This operation is used to update an item of data on the web service. https://www.some_address.com/users/5
  • 12. Rest operations: PATCH This operation is used to update an item of data on the web service by describing a set of instructions about how the item should be modified. https://www.some_address.com/users/5
  • 13. Rest operations: DELETE This operation is used to delete an item of data on the web service. https://www.some_address.com/users/5
  • 15. JSON JSON (JavaScript Object Notation) is a lightweight format that is used for data interchanging. It is based on a subset of JavaScript language (the way objects are built in JavaScript).
  • 16. HttpStatus The REST service sends an HTTP status code in the HttpResponseMessage.StatusCode property, to indicate whether the HTTP request succeeded or failed. The common responses for this operation are: 201 (CREATED) 400 (BAD REQUEST) 500 (SERVER ERROR) 404 (NOT FOUND)
  • 18. Security in REST - Security is ultimately decided by the service – the client can only conform to what the service allows - Should always prefer https to protect the data peer-to-peer
  • 20. Xamarin API Options HttpClient ServiceStack RestSharp Platform Specific Most common approach, built into .NET Full fledged 3rd party web services framework, has client PCL for consuming REST services Full 3rd party client library that supports file downloads, authentication, chunking, etc Native Platform Apis for networking calls
  • 21. HttpClient The HttpClient class is used to send and receive requests over HTTP. It provides functionality for sending HTTP requests and receiving HTTP responses from a URI identified resource. Each request is sent as an asynchronous operation.
  • 22. HttpClient - Get JsonConvert is a Json.NET class that can serialize and deserialize data from a JSON string or stream based on a specified Type
  • 24. HttpClient - Post/Put/Delete Must serialize body and include encoding and content type
  • 26. Let’s do it step by step 1-Create an Interface IApiService for your call definitions 2-Create a class ApiService to handle your requests and implement the previously created interface 3-Implement your request calls in your Api Service and define them in your Interface 4-Do your calls in your ViewModel 5-Show the data in your views
  • 28. INDIVIDUAL EXERCISE Using the Public API Create an app for get a RNC of a company TIME: 45 MINUTES
  • 29. IOS - NSAppTransportSecurity App Transport Security (ATS) enforces secure connections between internet resources (such as the app's back-end server) and your app.
  • 30. Mobile Networks Applications should always determine whether a network is available before starting a network operation
  • 31. INDIVIDUAL EXERCISE Add connectivity handler to your actual project TIME: 15 MINUTES
  • 32. Refit Refit is a library heavily inspired by Square's Retrofit library, and it turns your REST API into a live interface https://github.com/paulcbetts/refit
  • 33. Helpful tools for Json and Request Handlers - http://json2csharp.com/ - https://www.getpostman.com/docs/postman/launching_postman/navi gating_postman
  • 34. HOMEWORK PRACTICE Using the Public API for Weather Create an App to get the Weather of Santo Domingo, DR
  • 35. Recommended Lectures - Web Service https://developer.xamarin.com/guides/xamarin-forms/cloud-services/consuming/ - HttpClient in Xamarin Forms http://blog.xhackers.co/httpclient-with-xamarin-forms/ https://www.youtube.com/watch?v=xNP-K37mssA
  • 36. By Rendy Del Rosario and Charlin Agramonte Week 5 THANK YOU!!!