SlideShare a Scribd company logo
The Top Reasons You Need to
Learn about Data Before you
Develop Your Mobile App
CHRIS WOODRUFF
Chris Woodruff
EMAIL
cwoodruff@live.com
SKYPE
cwoodruff
TWITTER
cwoodruff
PHONE
616.724.6885
The Top Tips You need to Learn about Data in your Mobile App
Agenda
The Top Reasons You Need to Learn about Data in Your Windows Phone App
://
HTTP
1 UNDERSTAND HTTP
PROTOCOL
WEB
SERVICES
2 UNDERSTAND WEB SERVICES
REST
3 UNDERSTAND REST
DATA
CACHING
4 KNOW HOW TO CACHE DATA
IN THE APP
MVVM
5 PICK AND USE A GOOD MVVM
FRAMEWORK
DATA
VIZ
6 LEARN HOW TO SHOW
DATA IN YOUR APP
UNDERSTAND HTTP PROTOCOL
The Top Reasons You Need to Learn about Data in Your Windows Phone App
The Top Tips You need to Learn about Data in your Mobile App
WHAT SHOULD YOU KNOW ABOUT HTTP?
Resources
These are the URLs you use to get to pages on the
web
Request Headers
These are additional instructions that are sent with the
request. These might define what type of response is
required or authorization details.
Request Verbs
These describe what you want to do with the resource.
A browser typically issues a GET verb to instruct the
endpoint it wants to get data, however there are many
other verbs available including things like POST, PUT
and DELETE.
Request Body
Data that is sent with the request. For example a
POST (creation of a new item) will required some data
which is typically sent as the request body in the format
of JSON or XML.
Response Body
This is the main body of the response. If the request
was to a web server, this might be a full HTML page.
Response Status codes
These codes are issues with the response and give
the client details on the status of the request.
The Top Reasons You Need to Learn about Data in Your Windows Phone App
HOW DOES HTTP WORK?
GET CODEMASH.COM
http://www.codemash.com/index.html
WHAT DOES THE BROWSER DO?
GET /index.html HTTP/1.0
From: cwoodruff@live.com
User-Agent: HTTPTool/1.0
[blank line here]
WHAT IS THE RESPONSE?
HTTP/1.0 200 OK
Date: Thu, 8 Jan 2015 3:30:00 GMT
Content-Type: text/html
Content-Length: 1354
<html>
<body>
</body>
</html>
The Top Reasons You Need to Learn about Data in Your Windows Phone App
HTTP VERBS
GET
Requests a representation of the specified
Requests using GET should only retrieve
have no other effect.
HEAD
Asks for the response identical to the one
that would correspond to a GET request,
but without the response body.
POST
Requests that the server accept the entity
enclosed in the request as a new
subordinate of the web resource identified
by the URI.
PUT
Requests that the enclosed entity be stored
under the supplied URI.
DELETE
Deletes the specified resource.
PATCH
Applies partial modifications to a resource
The Top Reasons You Need to Learn about Data in Your Windows Phone App
TRACE
Echoes back the received request so that a
client can see what (if any) changes or
additions have been made by intermediate
servers.
OPTIONS
Returns the HTTP methods that the server
supports for the specified URL.
HTTP RESONSE CODES
1XX
Request received, continuing process.
This class of status code indicates a
consisting only of the Status-Line and
and is terminated by an empty line.
2XX
This class of status codes indicates the
action requested by the client was received,
understood, accepted and processed
successfully.
3XX
This class of status code indicates the client
must take additional action to complete the
request.
4XX
The 4xx class of status code is intended for
cases in which the client seems to have
errored.
5XX
The server failed to fulfill an apparently
valid request.
Response status codes beginning with the
digit "5" indicate cases in which the server
is aware that it has encountered an error or
is otherwise incapable of performing the
request.
The Top Reasons You Need to Learn about Data in Your Windows Phone App
COMMON HTTP RESONSE CODES
The Top Reasons You Need to Learn about Data in Your Windows Phone App
101 Switching Protocols - Tells the
client that the server will switch protocols
to that specified in the Upgrade message
header field during the current
connection. For example, when
requesting a page, a browser might
receive a status code of 101, followed by
an "Upgrade" header showing that the
server is changing to a different version of
HTTP.
200 OK - The request sent by the client
was successful.
202 Accepted - The request has been
accepted for processing, but has not yet
been processed.
204 No Content - The request was
successful but does not require the return
of an entity-body.
301 Moved Permanently - The resource
has permanently moved to a different
URI.
302 Found - The requested resource has
been found under a different URI but the
client should continue to use the original
URI.
303 See Other - The requested response
is at a different URI and should be
accessed using a GET command at the
given URI.
304 Not Modified - The resource has not
been modified since the last request.
COMMON HTTP RESONSE CODES
The Top Reasons You Need to Learn about Data in Your Windows Phone App
400 Bad Request - The syntax of the
request was not understood by the server.
401 Not Authorized - The request needs
user authentication.
403 Forbidden - The server has refused
to fulfill the request.
404 Not Found - The document/file
requested by the client was not found.
405 Method Not Allowed - The method
specified in the Request-Line is not
allowed for the specified resource.
407 Proxy Authentication Required -
The request first requires authentication
with the proxy.
500 Internal Server Error - The request
was unsuccessful due to an unexpected
condition encountered by the server.
502 Bad Gateway - The server received
an invalid response from the upstream
server while trying to fulfill the request.
503 Service Unavailable - The request
was unsuccessful due to the server being
down or overloaded.
504 Gateway Timeout - The upstream
server failed to send a request in the time
allowed by the server.
UNDERSTAND WEB SERVICES
The Top Reasons You Need to Learn about Data in Your Windows Phone App
Types of Web Services
01
02
04
03
Simple Object Access protocol (SOAP)
Representational State Transfer (REST)
Remote Procedure Call (RPC)
Calls over HTTP
The Top Reasons You Need to Learn about Data in Your Windows Phone App
EVOLUTION OF WEB SERVICES?
The Top Reasons You Need to Learn about Data in Your Windows Phone App
UNDERSTAND REST
The Top Reasons You Need to Learn about Data in Your Windows Phone App
The Top Tips You need to Learn about Data in your Mobile App
WHAT IS REST?
RESOURCES
VERBS
URL
The Top Reasons You Need to Learn about Data in Your Windows Phone App
WHAT SHOULD YOU KNOW ABOUT REST?
Resources
REST uses addressable resources to define the
structure of the API. These are the URLs you use to
get to pages on the web
Request Headers
These are additional instructions that are sent with the
request. These might define what type of response is
required or authorization details.
Request Verbs
These describe what you want to do with the resource.
A browser typically issues a GET verb to instruct the
endpoint it wants to get data, however there are many
other verbs available including things like POST, PUT
and DELETE.
Request Body
Data that is sent with the request. For example a
POST (creation of a new item) will required some data
which is typically sent as the request body in the format
of JSON or XML.
Response Body
This is the main body of the response. If the request
was to a web server, this might be a full HTML page, if
it was to an API, this might be a JSON or XML
document.
Response Status codes
These codes are issues with the response and give
the client details on the status of the request.
The Top Reasons You Need to Learn about Data in Your Windows Phone App
REST & HTTP VERBS
GET
Requests a representation of the specified
Requests using GET should only retrieve
have no other effect.
POST
Requests that the server accept the entity
enclosed in the request as a new
subordinate of the web resource identified
by the URI.
PUT
Requests that the enclosed entity be stored
under the supplied URI.
DELETE
Deletes the specified resource.
The Top Reasons You Need to Learn about Data in Your Windows Phone App
EXAMPLES OF REST
/Products
RESOURCE EXPECTED OUTCOMEVERB RESPONSE CODE
/Products?Color=green
/Products
/Products/81
/Products/881
/Products/81
/Products/81
GET
GET
POST
GET
GET
PUT
DELETE
A list of all products in the system
A list of all products in the system
where the color is red
Creation of a new product
Product with an ID of 81
Some error message
Update of the product with ID of 81
Deletion of the product with ID of
81
200/OK
200/OK
201/Created
200/OK
404/Not Found
204/No Content
204/No Content
The Top Reasons You Need to Learn about Data in Your Windows Phone App
SWAGGER UI
The Top Reasons You Need to Learn about Data in Your Windows Phone App
BENEFITS
GENERATE CLIENT CODE BASED ON YOUR
SWAGGER
KEEPS YOUR API FULLY DOCUMENTED
UNDERSTAND REST API QUICKLY
UPDATED WHEN YOU BUILD YOUR API
The Top Tips You need to Learn about Data in your Mobile App
The Top Tips You need to Learn about Data in your Mobile App
Testing REST Web Services
The Top Reasons You Need to Learn about Data in Your Windows Phone App
BROWSER
DEVELOPER
EXTENSIONS
Web-based REST/Web Services Clients
FIDDLER
Free web debugging tool which logs all
HTTP(S) traffic between your computer
and the Internet.
LINQPAD
Interactively query SQL databases
(among other data sources such as OData
or WCF Data Services) using LINQ, as
well as interactively writing C# code
without the need for an IDE.
SoapUI
SoapUI is an open-source web service
testing application for service-oriented
architectures (SOA) and representational
state transfers (REST). Its functionality
covers web service inspection, invoking,
development, simulation and mocking,
functional testing, load and compliance
testing.
DEMO
The Top Reasons You Need to Learn about Data in Your Windows Phone App
http://baseball-stats.info/api/Teams
KNOW HOW TO CACHE DATA
IN THE APP
The Top Reasons You Need to Learn about Data in Your Windows Phone App
01
02
04
03
LOCAL
Data that exists on the current device
backed up in the cloud.
APP DATA STORAGE
The Top Reasons You Need to Learn about Data in Your Windows Phone App
LOCALCACHE
Persistent data that exists only on
the current device.
ROAMING
Data that exists on all devices on
which the user has installed the app.
TEMPORARY
Data that could be removed by the
system at any time.
DATA TYPES FOR CACHING
UInt8, Int16, UInt16, Int32,
UInt32, Int64, UInt64, Single,
Double
Boolean
Char16, String DateTime, TimeSpan
GUID, Point, Size, Rect ApplicationDataCompositeValue
The Top Reasons You Need to Learn about Data in Your Windows Phone App
Note that there is no binary type. If you need to store binary
data, use an app file
EXAMPLES OF DATA CACHING
LOCALSETTINGS
The Top Reasons You Need to Learn about Data in Your Windows Phone App
Windows.Storage.ApplicationDataContainer localSettings = Windows.Storage.ApplicationData.Current.LocalSettings;
localSettings.Values["exampleSetting"] = "Hello Windows";
Windows.Storage.ApplicationDataCompositeValue composite = new Windows.Storage.ApplicationDataCompositeValue();
composite["intVal"] = 1;
composite["strVal"] = "string";
localSettings.Values["exampleCompositeSetting"] = composite;
Object value = localSettings.Values["exampleSetting"];
Windows.Storage.ApplicationDataCompositeValue composite =
(Windows.Storage.ApplicationDataCompositeValue)localSettings.Values["exampleCompositeSetting"];
localSettings.Values.Remove("exampleSetting");
EXAMPLES OF DATA CACHING
LOCALFOLDER
The Top Reasons You Need to Learn about Data in Your Windows Phone App
Windows.Storage.StorageFolder localFolder = Windows.Storage.ApplicationData.Current.LocalFolder;
Windows.Globalization.DateTimeFormatting.DateTimeFormatter formatter =
new Windows.Globalization.DatetimeFormatting.DateTimeFormatter("longtime");
StorageFile sampleFile = await localFolder.CreateFileAsync("dataFile.txt",
CreateCollisionOption.ReplaceExisting);
await FileIO.WriteTextAsync(sampleFile, formatter.Format(DateTime.Now));
StorageFile sampleFile = await localFolder.GetFileAsync("dataFile.txt");
String timestamp = await FileIO.ReadTextAsync(sampleFile);
EXAMPLES OF DATA CACHING
The Top Reasons You Need to Learn about Data in Your Windows Phone App
TEMPORARYFOLDER
Windows.Storage.StorageFolder temporaryFolder = Windows.Storage.ApplicationData.Current.TemporaryFolder;
Windows.Globalization.DateTimeFormatting.DateTimeFormatter formatter =
new Windows.Globalization.DatetimeFormatting.DateTimeFormatter("longtime");
StorageFile sampleFile = await temporaryFolder.CreateFileAsync("dataFile.txt",
CreateCollisionOption.ReplaceExisting);
await FileIO.WriteTextAsync(sampleFile, formatter.Format(DateTime.Now));
StorageFile sampleFile = await temporaryFolder.GetFileAsync("dataFile.txt");
String timestamp = await FileIO.ReadTextAsync(sampleFile);
EXAMPLES OF DATA CACHING
The Top Reasons You Need to Learn about Data in Your Windows Phone App
void InitHandlers()
{
Windows.Storage.ApplicationData.Current.DataChanged +=
new TypedEventHandler<ApplicationData, object>(DataChangeHandler);
}
void DataChangeHandler(Windows.Storage.ApplicationData appData, object o)
{
// Refresh your data
}
ROAMINGFOLDER
SQL AND NOSQL DATA SOLUTIONS
SQLite
A relational database management system contained in a C
contrast to other database management systems, SQLite is not
separate process that a client program running in another
is part of the using program.
The Top Reasons You Need to Learn about Data in Your Windows Phone App
PICK AND USE A GOOD MVVM
FRAMEWORK
The Top Reasons You Need to Learn about Data in Your Windows Phone App
BEAUTY OF MVVM
The Top Reasons You Need to Learn about Data in Your Windows Phone App
MODEL VIEWVIEW MODEL
DEMO
The Top Reasons You Need to Learn about Data in Your Windows Phone App
LEARN GREAT UX AND HOW TO SHOW
DATA IN YOUR APP
The Top Reasons You Need to Learn about Data in Your Windows Phone App
EXAMPLES OF DATA VIZ
The Top Reasons You Need to Learn about Data in Your Windows Phone App
BOOKS ABOUT DATA VIZ
The Top Reasons You Need to Learn about Data in Your Windows Phone App
FINALLY!!
The Top Tips You need to Learn about Data in your Mobile App
CHRIS WOODRUFF
SKYPE
CWOODRUFF
TWITTER
CWOODRUFF
WEBSITE
CHRISWOODRUFF.COM
EMAIL
CWOODRUFF@LIVE.COM
PHONE
616.724.6885
LINKEDIN
CHRIS.WOODRUFF
THANK YOU

More Related Content

PPTX
Learning How to Shape and Configure an OData Feed for High Performing Web Sit...
PPTX
Learning How to Shape and Configure an OData Service for High Performing Web ...
PPTX
Gaining the Knowledge of the Open Data Protocol (OData) - Prairie Dev Con
PDF
A Look at OData
PPTX
Gaining the Knowledge of the Open Data Protocol (OData)
PPTX
OData and SharePoint
PDF
OData, Open Data Protocol. A brief introduction
PPTX
Learning How to Shape and Configure an OData Feed for High Performing Web Sit...
Learning How to Shape and Configure an OData Service for High Performing Web ...
Gaining the Knowledge of the Open Data Protocol (OData) - Prairie Dev Con
A Look at OData
Gaining the Knowledge of the Open Data Protocol (OData)
OData and SharePoint
OData, Open Data Protocol. A brief introduction

What's hot (19)

PDF
Apache Olingo - ApacheCon Denver 2014
PPT
Building RESTful Applications with OData
PPTX
API Design Tour: Dell
ODP
Introduction to OData
PPTX
REST API Design & Development
PPTX
JAX-RS 2.0 and OData
PPTX
Design Beautiful REST + JSON APIs
PPTX
Introduction To REST
PPTX
Understanding REST APIs in 5 Simple Steps
PDF
Doing REST Right
PPTX
OData: A Standard API for Data Access
PDF
Overview of GraphQL & Clients
PPTX
Introduction to shodan
PDF
The never-ending REST API design debate -- Devoxx France 2016
PDF
Building Beautiful REST APIs in ASP.NET Core
PPTX
Best practices for RESTful web service design
PDF
GraphQL & Relay - 串起前後端世界的橋樑
ODP
The Internet as Web Services: introduction to ReST
PPTX
Learning How to Shape and Configure an OData Feed for High Performing Web Sit...
Apache Olingo - ApacheCon Denver 2014
Building RESTful Applications with OData
API Design Tour: Dell
Introduction to OData
REST API Design & Development
JAX-RS 2.0 and OData
Design Beautiful REST + JSON APIs
Introduction To REST
Understanding REST APIs in 5 Simple Steps
Doing REST Right
OData: A Standard API for Data Access
Overview of GraphQL & Clients
Introduction to shodan
The never-ending REST API design debate -- Devoxx France 2016
Building Beautiful REST APIs in ASP.NET Core
Best practices for RESTful web service design
GraphQL & Relay - 串起前後端世界的橋樑
The Internet as Web Services: introduction to ReST
Learning How to Shape and Configure an OData Feed for High Performing Web Sit...
Ad

Viewers also liked (20)

PPT
Investigacion exposicion mozart
DOC
Ghulam Ahmad CV
PPTX
Microworlds jack
PPTX
TTIP - Gozba ili Borba?
DOCX
Examen ensayo del artículo 3ero
PDF
SOC486A Human Rights & Theory
DOCX
Deporte, cultura y recreacion
PDF
Somatodrol
PPT
Current Events Jamilla
DOC
Business CapM IRM v2 0 05.26.2015
PDF
Doubly Decomposing Nonparametric Tensor Regression
DOC
GNS Resume 22.02.16
PPTX
SPATIAL ANALYSIS TO IDENTIFY SUITABLE OFFLINE RETAIL PARTNER
PPTX
Una nuova visione del mondo
DOCX
Resume Ajaya Kumar Das
PPS
Moisture management products--Products For Functional Modification
PPTX
Dove man care products
PPTX
Spatial analysis and Analysis Tools ( GIS )
PPTX
Arrow ppt
Investigacion exposicion mozart
Ghulam Ahmad CV
Microworlds jack
TTIP - Gozba ili Borba?
Examen ensayo del artículo 3ero
SOC486A Human Rights & Theory
Deporte, cultura y recreacion
Somatodrol
Current Events Jamilla
Business CapM IRM v2 0 05.26.2015
Doubly Decomposing Nonparametric Tensor Regression
GNS Resume 22.02.16
SPATIAL ANALYSIS TO IDENTIFY SUITABLE OFFLINE RETAIL PARTNER
Una nuova visione del mondo
Resume Ajaya Kumar Das
Moisture management products--Products For Functional Modification
Dove man care products
Spatial analysis and Analysis Tools ( GIS )
Arrow ppt
Ad

Similar to The Top Tips You need to Learn about Data in your Mobile App (20)

PDF
HTTP Status Codes Cheat Sheet: An Exhaustive List
PDF
REST 101: An Overview To Representational State Transfer.
PDF
WebApp #3 : API
PPTX
Rest Webservice
PDF
Servlets http-status-codes
PPTX
Module 5.pptx HTTP protocol on optical and wireless communication
PDF
Webservices Testing PPT.pdf
PPT
Open Id, O Auth And Webservices
PPTX
BITM3730Week9(1).pptx
PPTX
Apache error
DOCX
SEO HTTP Response Codes List
PDF
What are restful web services?
PDF
Great webapis
PPTX
POSTMAN.pptx
PPTX
Api testing
PDF
Simplify QA Automation: Master API Testing with HTTPClient in C#
PPTX
PDF
A Simple Guide to Proxy Error and Troubleshooting Issues
PPTX
Web Application Technologies
PPTX
BITM3730 11-1.pptx
HTTP Status Codes Cheat Sheet: An Exhaustive List
REST 101: An Overview To Representational State Transfer.
WebApp #3 : API
Rest Webservice
Servlets http-status-codes
Module 5.pptx HTTP protocol on optical and wireless communication
Webservices Testing PPT.pdf
Open Id, O Auth And Webservices
BITM3730Week9(1).pptx
Apache error
SEO HTTP Response Codes List
What are restful web services?
Great webapis
POSTMAN.pptx
Api testing
Simplify QA Automation: Master API Testing with HTTPClient in C#
A Simple Guide to Proxy Error and Troubleshooting Issues
Web Application Technologies
BITM3730 11-1.pptx

More from Woodruff Solutions LLC (14)

PPTX
Gaining the Knowledge of the Open Data Protocol (OData)
PPTX
Developing Mobile Solutions with Azure Mobile Services in Windows 8.1 and Win...
PPTX
Connecting to Data from Windows Phone 8
PPTX
Pushing Data to and from the Cloud with SQL Azure Data Sync -- TechEd NA 2013
PPTX
Developing Mobile Solutions with Azure and Windows Phone VSLive! Redmond 2013
PPTX
Connecting to Data from Windows Phone 8 VSLive! Redmond 2013
PPTX
AzureConf 2013 Developing Cross Platform Mobile Solutions with Azure Mobile...
PPTX
Connecting to Data from Windows Phone 8
PPTX
Sql Azure Data Sync
PPTX
Producing an OData feed in 10 minutes
PPTX
Build Conference Highlights: How Windows 8 Metro is Revolutionary
PPTX
Sailing on the ocean of 1s and 0s
PPTX
Breaking down data silos with OData
PPTX
Breaking down data silos with the open data protocol
Gaining the Knowledge of the Open Data Protocol (OData)
Developing Mobile Solutions with Azure Mobile Services in Windows 8.1 and Win...
Connecting to Data from Windows Phone 8
Pushing Data to and from the Cloud with SQL Azure Data Sync -- TechEd NA 2013
Developing Mobile Solutions with Azure and Windows Phone VSLive! Redmond 2013
Connecting to Data from Windows Phone 8 VSLive! Redmond 2013
AzureConf 2013 Developing Cross Platform Mobile Solutions with Azure Mobile...
Connecting to Data from Windows Phone 8
Sql Azure Data Sync
Producing an OData feed in 10 minutes
Build Conference Highlights: How Windows 8 Metro is Revolutionary
Sailing on the ocean of 1s and 0s
Breaking down data silos with OData
Breaking down data silos with the open data protocol

Recently uploaded (20)

PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PDF
Empathic Computing: Creating Shared Understanding
PPTX
sap open course for s4hana steps from ECC to s4
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PPTX
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PPTX
Cloud computing and distributed systems.
PPTX
Programs and apps: productivity, graphics, security and other tools
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PDF
Electronic commerce courselecture one. Pdf
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
Advanced methodologies resolving dimensionality complications for autism neur...
Empathic Computing: Creating Shared Understanding
sap open course for s4hana steps from ECC to s4
Dropbox Q2 2025 Financial Results & Investor Presentation
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Chapter 3 Spatial Domain Image Processing.pdf
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
Building Integrated photovoltaic BIPV_UPV.pdf
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Cloud computing and distributed systems.
Programs and apps: productivity, graphics, security and other tools
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
Understanding_Digital_Forensics_Presentation.pptx
Electronic commerce courselecture one. Pdf
Mobile App Security Testing_ A Comprehensive Guide.pdf
Digital-Transformation-Roadmap-for-Companies.pptx
The Rise and Fall of 3GPP – Time for a Sabbatical?

The Top Tips You need to Learn about Data in your Mobile App

  • 1. The Top Reasons You Need to Learn about Data Before you Develop Your Mobile App CHRIS WOODRUFF
  • 4. Agenda The Top Reasons You Need to Learn about Data in Your Windows Phone App :// HTTP 1 UNDERSTAND HTTP PROTOCOL WEB SERVICES 2 UNDERSTAND WEB SERVICES REST 3 UNDERSTAND REST DATA CACHING 4 KNOW HOW TO CACHE DATA IN THE APP MVVM 5 PICK AND USE A GOOD MVVM FRAMEWORK DATA VIZ 6 LEARN HOW TO SHOW DATA IN YOUR APP
  • 5. UNDERSTAND HTTP PROTOCOL The Top Reasons You Need to Learn about Data in Your Windows Phone App
  • 7. WHAT SHOULD YOU KNOW ABOUT HTTP? Resources These are the URLs you use to get to pages on the web Request Headers These are additional instructions that are sent with the request. These might define what type of response is required or authorization details. Request Verbs These describe what you want to do with the resource. A browser typically issues a GET verb to instruct the endpoint it wants to get data, however there are many other verbs available including things like POST, PUT and DELETE. Request Body Data that is sent with the request. For example a POST (creation of a new item) will required some data which is typically sent as the request body in the format of JSON or XML. Response Body This is the main body of the response. If the request was to a web server, this might be a full HTML page. Response Status codes These codes are issues with the response and give the client details on the status of the request. The Top Reasons You Need to Learn about Data in Your Windows Phone App
  • 8. HOW DOES HTTP WORK? GET CODEMASH.COM http://www.codemash.com/index.html WHAT DOES THE BROWSER DO? GET /index.html HTTP/1.0 From: cwoodruff@live.com User-Agent: HTTPTool/1.0 [blank line here] WHAT IS THE RESPONSE? HTTP/1.0 200 OK Date: Thu, 8 Jan 2015 3:30:00 GMT Content-Type: text/html Content-Length: 1354 <html> <body> </body> </html> The Top Reasons You Need to Learn about Data in Your Windows Phone App
  • 9. HTTP VERBS GET Requests a representation of the specified Requests using GET should only retrieve have no other effect. HEAD Asks for the response identical to the one that would correspond to a GET request, but without the response body. POST Requests that the server accept the entity enclosed in the request as a new subordinate of the web resource identified by the URI. PUT Requests that the enclosed entity be stored under the supplied URI. DELETE Deletes the specified resource. PATCH Applies partial modifications to a resource The Top Reasons You Need to Learn about Data in Your Windows Phone App TRACE Echoes back the received request so that a client can see what (if any) changes or additions have been made by intermediate servers. OPTIONS Returns the HTTP methods that the server supports for the specified URL.
  • 10. HTTP RESONSE CODES 1XX Request received, continuing process. This class of status code indicates a consisting only of the Status-Line and and is terminated by an empty line. 2XX This class of status codes indicates the action requested by the client was received, understood, accepted and processed successfully. 3XX This class of status code indicates the client must take additional action to complete the request. 4XX The 4xx class of status code is intended for cases in which the client seems to have errored. 5XX The server failed to fulfill an apparently valid request. Response status codes beginning with the digit "5" indicate cases in which the server is aware that it has encountered an error or is otherwise incapable of performing the request. The Top Reasons You Need to Learn about Data in Your Windows Phone App
  • 11. COMMON HTTP RESONSE CODES The Top Reasons You Need to Learn about Data in Your Windows Phone App 101 Switching Protocols - Tells the client that the server will switch protocols to that specified in the Upgrade message header field during the current connection. For example, when requesting a page, a browser might receive a status code of 101, followed by an "Upgrade" header showing that the server is changing to a different version of HTTP. 200 OK - The request sent by the client was successful. 202 Accepted - The request has been accepted for processing, but has not yet been processed. 204 No Content - The request was successful but does not require the return of an entity-body. 301 Moved Permanently - The resource has permanently moved to a different URI. 302 Found - The requested resource has been found under a different URI but the client should continue to use the original URI. 303 See Other - The requested response is at a different URI and should be accessed using a GET command at the given URI. 304 Not Modified - The resource has not been modified since the last request.
  • 12. COMMON HTTP RESONSE CODES The Top Reasons You Need to Learn about Data in Your Windows Phone App 400 Bad Request - The syntax of the request was not understood by the server. 401 Not Authorized - The request needs user authentication. 403 Forbidden - The server has refused to fulfill the request. 404 Not Found - The document/file requested by the client was not found. 405 Method Not Allowed - The method specified in the Request-Line is not allowed for the specified resource. 407 Proxy Authentication Required - The request first requires authentication with the proxy. 500 Internal Server Error - The request was unsuccessful due to an unexpected condition encountered by the server. 502 Bad Gateway - The server received an invalid response from the upstream server while trying to fulfill the request. 503 Service Unavailable - The request was unsuccessful due to the server being down or overloaded. 504 Gateway Timeout - The upstream server failed to send a request in the time allowed by the server.
  • 13. UNDERSTAND WEB SERVICES The Top Reasons You Need to Learn about Data in Your Windows Phone App
  • 14. Types of Web Services 01 02 04 03 Simple Object Access protocol (SOAP) Representational State Transfer (REST) Remote Procedure Call (RPC) Calls over HTTP The Top Reasons You Need to Learn about Data in Your Windows Phone App
  • 15. EVOLUTION OF WEB SERVICES? The Top Reasons You Need to Learn about Data in Your Windows Phone App
  • 16. UNDERSTAND REST The Top Reasons You Need to Learn about Data in Your Windows Phone App
  • 18. WHAT IS REST? RESOURCES VERBS URL The Top Reasons You Need to Learn about Data in Your Windows Phone App
  • 19. WHAT SHOULD YOU KNOW ABOUT REST? Resources REST uses addressable resources to define the structure of the API. These are the URLs you use to get to pages on the web Request Headers These are additional instructions that are sent with the request. These might define what type of response is required or authorization details. Request Verbs These describe what you want to do with the resource. A browser typically issues a GET verb to instruct the endpoint it wants to get data, however there are many other verbs available including things like POST, PUT and DELETE. Request Body Data that is sent with the request. For example a POST (creation of a new item) will required some data which is typically sent as the request body in the format of JSON or XML. Response Body This is the main body of the response. If the request was to a web server, this might be a full HTML page, if it was to an API, this might be a JSON or XML document. Response Status codes These codes are issues with the response and give the client details on the status of the request. The Top Reasons You Need to Learn about Data in Your Windows Phone App
  • 20. REST & HTTP VERBS GET Requests a representation of the specified Requests using GET should only retrieve have no other effect. POST Requests that the server accept the entity enclosed in the request as a new subordinate of the web resource identified by the URI. PUT Requests that the enclosed entity be stored under the supplied URI. DELETE Deletes the specified resource. The Top Reasons You Need to Learn about Data in Your Windows Phone App
  • 21. EXAMPLES OF REST /Products RESOURCE EXPECTED OUTCOMEVERB RESPONSE CODE /Products?Color=green /Products /Products/81 /Products/881 /Products/81 /Products/81 GET GET POST GET GET PUT DELETE A list of all products in the system A list of all products in the system where the color is red Creation of a new product Product with an ID of 81 Some error message Update of the product with ID of 81 Deletion of the product with ID of 81 200/OK 200/OK 201/Created 200/OK 404/Not Found 204/No Content 204/No Content The Top Reasons You Need to Learn about Data in Your Windows Phone App
  • 22. SWAGGER UI The Top Reasons You Need to Learn about Data in Your Windows Phone App BENEFITS GENERATE CLIENT CODE BASED ON YOUR SWAGGER KEEPS YOUR API FULLY DOCUMENTED UNDERSTAND REST API QUICKLY UPDATED WHEN YOU BUILD YOUR API
  • 25. Testing REST Web Services The Top Reasons You Need to Learn about Data in Your Windows Phone App BROWSER DEVELOPER EXTENSIONS Web-based REST/Web Services Clients FIDDLER Free web debugging tool which logs all HTTP(S) traffic between your computer and the Internet. LINQPAD Interactively query SQL databases (among other data sources such as OData or WCF Data Services) using LINQ, as well as interactively writing C# code without the need for an IDE. SoapUI SoapUI is an open-source web service testing application for service-oriented architectures (SOA) and representational state transfers (REST). Its functionality covers web service inspection, invoking, development, simulation and mocking, functional testing, load and compliance testing.
  • 26. DEMO The Top Reasons You Need to Learn about Data in Your Windows Phone App http://baseball-stats.info/api/Teams
  • 27. KNOW HOW TO CACHE DATA IN THE APP The Top Reasons You Need to Learn about Data in Your Windows Phone App
  • 28. 01 02 04 03 LOCAL Data that exists on the current device backed up in the cloud. APP DATA STORAGE The Top Reasons You Need to Learn about Data in Your Windows Phone App LOCALCACHE Persistent data that exists only on the current device. ROAMING Data that exists on all devices on which the user has installed the app. TEMPORARY Data that could be removed by the system at any time.
  • 29. DATA TYPES FOR CACHING UInt8, Int16, UInt16, Int32, UInt32, Int64, UInt64, Single, Double Boolean Char16, String DateTime, TimeSpan GUID, Point, Size, Rect ApplicationDataCompositeValue The Top Reasons You Need to Learn about Data in Your Windows Phone App Note that there is no binary type. If you need to store binary data, use an app file
  • 30. EXAMPLES OF DATA CACHING LOCALSETTINGS The Top Reasons You Need to Learn about Data in Your Windows Phone App Windows.Storage.ApplicationDataContainer localSettings = Windows.Storage.ApplicationData.Current.LocalSettings; localSettings.Values["exampleSetting"] = "Hello Windows"; Windows.Storage.ApplicationDataCompositeValue composite = new Windows.Storage.ApplicationDataCompositeValue(); composite["intVal"] = 1; composite["strVal"] = "string"; localSettings.Values["exampleCompositeSetting"] = composite; Object value = localSettings.Values["exampleSetting"]; Windows.Storage.ApplicationDataCompositeValue composite = (Windows.Storage.ApplicationDataCompositeValue)localSettings.Values["exampleCompositeSetting"]; localSettings.Values.Remove("exampleSetting");
  • 31. EXAMPLES OF DATA CACHING LOCALFOLDER The Top Reasons You Need to Learn about Data in Your Windows Phone App Windows.Storage.StorageFolder localFolder = Windows.Storage.ApplicationData.Current.LocalFolder; Windows.Globalization.DateTimeFormatting.DateTimeFormatter formatter = new Windows.Globalization.DatetimeFormatting.DateTimeFormatter("longtime"); StorageFile sampleFile = await localFolder.CreateFileAsync("dataFile.txt", CreateCollisionOption.ReplaceExisting); await FileIO.WriteTextAsync(sampleFile, formatter.Format(DateTime.Now)); StorageFile sampleFile = await localFolder.GetFileAsync("dataFile.txt"); String timestamp = await FileIO.ReadTextAsync(sampleFile);
  • 32. EXAMPLES OF DATA CACHING The Top Reasons You Need to Learn about Data in Your Windows Phone App TEMPORARYFOLDER Windows.Storage.StorageFolder temporaryFolder = Windows.Storage.ApplicationData.Current.TemporaryFolder; Windows.Globalization.DateTimeFormatting.DateTimeFormatter formatter = new Windows.Globalization.DatetimeFormatting.DateTimeFormatter("longtime"); StorageFile sampleFile = await temporaryFolder.CreateFileAsync("dataFile.txt", CreateCollisionOption.ReplaceExisting); await FileIO.WriteTextAsync(sampleFile, formatter.Format(DateTime.Now)); StorageFile sampleFile = await temporaryFolder.GetFileAsync("dataFile.txt"); String timestamp = await FileIO.ReadTextAsync(sampleFile);
  • 33. EXAMPLES OF DATA CACHING The Top Reasons You Need to Learn about Data in Your Windows Phone App void InitHandlers() { Windows.Storage.ApplicationData.Current.DataChanged += new TypedEventHandler<ApplicationData, object>(DataChangeHandler); } void DataChangeHandler(Windows.Storage.ApplicationData appData, object o) { // Refresh your data } ROAMINGFOLDER
  • 34. SQL AND NOSQL DATA SOLUTIONS SQLite A relational database management system contained in a C contrast to other database management systems, SQLite is not separate process that a client program running in another is part of the using program. The Top Reasons You Need to Learn about Data in Your Windows Phone App
  • 35. PICK AND USE A GOOD MVVM FRAMEWORK The Top Reasons You Need to Learn about Data in Your Windows Phone App
  • 36. BEAUTY OF MVVM The Top Reasons You Need to Learn about Data in Your Windows Phone App MODEL VIEWVIEW MODEL
  • 37. DEMO The Top Reasons You Need to Learn about Data in Your Windows Phone App
  • 38. LEARN GREAT UX AND HOW TO SHOW DATA IN YOUR APP The Top Reasons You Need to Learn about Data in Your Windows Phone App
  • 39. EXAMPLES OF DATA VIZ The Top Reasons You Need to Learn about Data in Your Windows Phone App
  • 40. BOOKS ABOUT DATA VIZ The Top Reasons You Need to Learn about Data in Your Windows Phone App

Editor's Notes

  • #8: Hypertext Transfer Protocol
  • #22: 200 OK -- Standard response for successful HTTP requests. The actual response will depend on the request method used. In a GET request, the response will contain an entity corresponding to the requested resource. In a POST request the response will contain an entity describing or containing the result of the action. 201 Created -- The request has been fulfilled and resulted in a new resource being created. 204 No Content -- The server successfully processed the request, but is not returning any content. Usually used as a response to a successful delete request. 404 Not Found -- The requested resource could not be found but may be available again in the future. Subsequent requests by the client are permissible.
  • #24: http://petstore.swagger.io/#/
  • #25: http://editor.swagger.io/#/
  • #29: LocalFolder – a local folder, used for storing application data, it’s persistent across application updates and gets backed up to the cloud. This folder was already available in Windows Phone 8 and it’s the same folder as Isolated Storage known from Windows Phone 7. TemporaryFolder – also a local folder, but its space is managed by the OS. Whenever the system detects it’s running low on storage space, it will start deleting files in temporary so don’t ever strongly depend on files stored in this folder. It makes a perfect place for storing cached web responses or images that can be recreated any time. This folder does not participate in backups. RoamingFolder – files, stored in this folder, will roam across devices, meaning those files will be synchronized over the cloud whenever possible. Perfect for settings and/or small chunks of state (i.e. for continuous clients). When roaming is disabled on the device, those files (and settings) will get backed up as well. The storage space is limited to 100kB – if application goes over that quota, the synchronization stops (until the total usage falls back under roaming storage quota).
  • #30: Windows.Storage.ApplicationDataCompositeValue -- Represents related app settings that must be serialized and deserialized atomically.
  • #33: https://msdn.microsoft.com/en-us/library/windows/apps/br230562.aspx