the hitchhicker’s guide to windows azure mobile services | falafelcon 2014
DESCRIPTION
Windows Azure Mobile Services provides a straightforward way to connect your data to multiple applications on multiple devices. In this presentation, I will show how to expose cloud data via a REST interface and connect to that data from applications running on Windows Phone, Windows 8, iOs and Android. You will learn how to secure your data and to send push notification to your client application.TRANSCRIPT
![Page 1: The Hitchhicker’s Guide to Windows Azure Mobile Services | FalafelCON 2014](https://reader034.vdocuments.net/reader034/viewer/2022042816/559454651a28ab92118b4577/html5/thumbnails/1.jpg)
A Hitchhiker's Guide to
Azure Mobile Services
![Page 2: The Hitchhicker’s Guide to Windows Azure Mobile Services | FalafelCON 2014](https://reader034.vdocuments.net/reader034/viewer/2022042816/559454651a28ab92118b4577/html5/thumbnails/2.jpg)
@DavidGiard
David Giard
Microso. Technical Evangelist • @DavidGiard • DavidGiard.com • TechnologyAndFriends • [email protected]
![Page 3: The Hitchhicker’s Guide to Windows Azure Mobile Services | FalafelCON 2014](https://reader034.vdocuments.net/reader034/viewer/2022042816/559454651a28ab92118b4577/html5/thumbnails/3.jpg)
@DavidGiard
Agenda
• Why Azure Mobile Services? • Mobile Architecture • Common Data Access • CustomizaCon • Dynamic Data • Client Code • IdenCty and Permissions • Scaling • API Scripts • NoCficaCons
![Page 4: The Hitchhicker’s Guide to Windows Azure Mobile Services | FalafelCON 2014](https://reader034.vdocuments.net/reader034/viewer/2022042816/559454651a28ab92118b4577/html5/thumbnails/4.jpg)
@DavidGiard
Why Azure Mobile Services?
• Frees you from plumbing code • Handles API Changes • Cross-‐PlaLorm soluCon • Choose JavaScript or .NET
![Page 5: The Hitchhicker’s Guide to Windows Azure Mobile Services | FalafelCON 2014](https://reader034.vdocuments.net/reader034/viewer/2022042816/559454651a28ab92118b4577/html5/thumbnails/5.jpg)
@DavidGiard
Mobile Architecture
Windows Phone
Data
Windows 8.1
iPhone
iPad Android
JavaScript
REST API
![Page 6: The Hitchhicker’s Guide to Windows Azure Mobile Services | FalafelCON 2014](https://reader034.vdocuments.net/reader034/viewer/2022042816/559454651a28ab92118b4577/html5/thumbnails/6.jpg)
@DavidGiard
Permissions
Pieces of Azure Mobile Services
SQL Server table
READ
INSERT
UPDATE
DELETE
IdenCty Client Code
![Page 7: The Hitchhicker’s Guide to Windows Azure Mobile Services | FalafelCON 2014](https://reader034.vdocuments.net/reader034/viewer/2022042816/559454651a28ab92118b4577/html5/thumbnails/7.jpg)
@DavidGiard
CreaBng a Mobile Service
![Page 8: The Hitchhicker’s Guide to Windows Azure Mobile Services | FalafelCON 2014](https://reader034.vdocuments.net/reader034/viewer/2022042816/559454651a28ab92118b4577/html5/thumbnails/8.jpg)
@DavidGiard
CreaBng a Mobile Service
![Page 9: The Hitchhicker’s Guide to Windows Azure Mobile Services | FalafelCON 2014](https://reader034.vdocuments.net/reader034/viewer/2022042816/559454651a28ab92118b4577/html5/thumbnails/9.jpg)
@DavidGiard
CreaBng a Mobile Service
![Page 10: The Hitchhicker’s Guide to Windows Azure Mobile Services | FalafelCON 2014](https://reader034.vdocuments.net/reader034/viewer/2022042816/559454651a28ab92118b4577/html5/thumbnails/10.jpg)
@DavidGiard
REST
hUps://Giard.azure-‐mobile.net/Tables/Table1 • GET, PUT, POST, DELETE, PATCH • Extend GET with oData Query syntax
![Page 11: The Hitchhicker’s Guide to Windows Azure Mobile Services | FalafelCON 2014](https://reader034.vdocuments.net/reader034/viewer/2022042816/559454651a28ab92118b4577/html5/thumbnails/11.jpg)
@DavidGiard
REST
Client Endpoint
Request Verb
Data (JSON)
Response
![Page 12: The Hitchhicker’s Guide to Windows Azure Mobile Services | FalafelCON 2014](https://reader034.vdocuments.net/reader034/viewer/2022042816/559454651a28ab92118b4577/html5/thumbnails/12.jpg)
@DavidGiard
REST
HTTP Verb Ac+on SQL GET Read Data SELECT… POST Create Data INSERT… DELETE Delete Data DELETE… PUT or PATCH Update Data UPDATE…
![Page 13: The Hitchhicker’s Guide to Windows Azure Mobile Services | FalafelCON 2014](https://reader034.vdocuments.net/reader034/viewer/2022042816/559454651a28ab92118b4577/html5/thumbnails/13.jpg)
@DavidGiard
oData Query Syntax
Extension Descrip+on
$filter WHERE clause
$inlinecount # items in table
$orderby SORT clause
$select Columns to return
$skip #records to skip
$top #records to return
../Tables/Table1?$filter=AcCve%20eq%20true
../Tables/Table1?$filter=AcCve eq true
../Tables/Table1$filter=AcCve%20eq%20true&$orderby=LastName
![Page 14: The Hitchhicker’s Guide to Windows Azure Mobile Services | FalafelCON 2014](https://reader034.vdocuments.net/reader034/viewer/2022042816/559454651a28ab92118b4577/html5/thumbnails/14.jpg)
@DavidGiard
Dynamic Schema
• “Configure” tab • AutomaCcally adds columns if matching data submiUed • Useful during development • Turn off during producCon
![Page 15: The Hitchhicker’s Guide to Windows Azure Mobile Services | FalafelCON 2014](https://reader034.vdocuments.net/reader034/viewer/2022042816/559454651a28ab92118b4577/html5/thumbnails/15.jpg)
@DavidGiard
Permissions
![Page 16: The Hitchhicker’s Guide to Windows Azure Mobile Services | FalafelCON 2014](https://reader034.vdocuments.net/reader034/viewer/2022042816/559454651a28ab92118b4577/html5/thumbnails/16.jpg)
@DavidGiard
Scripts
• Insert • Update • Delete • Read
![Page 17: The Hitchhicker’s Guide to Windows Azure Mobile Services | FalafelCON 2014](https://reader034.vdocuments.net/reader034/viewer/2022042816/559454651a28ab92118b4577/html5/thumbnails/17.jpg)
@DavidGiard
Demo
![Page 18: The Hitchhicker’s Guide to Windows Azure Mobile Services | FalafelCON 2014](https://reader034.vdocuments.net/reader034/viewer/2022042816/559454651a28ab92118b4577/html5/thumbnails/18.jpg)
@DavidGiard
IdenBty – Single Sign-‐On
Client
Azure Mobile Services API
TwiUer or Facebook or Google
or Microso.
Request
TOKEN
![Page 19: The Hitchhicker’s Guide to Windows Azure Mobile Services | FalafelCON 2014](https://reader034.vdocuments.net/reader034/viewer/2022042816/559454651a28ab92118b4577/html5/thumbnails/19.jpg)
@DavidGiard
IdenBty
![Page 20: The Hitchhicker’s Guide to Windows Azure Mobile Services | FalafelCON 2014](https://reader034.vdocuments.net/reader034/viewer/2022042816/559454651a28ab92118b4577/html5/thumbnails/20.jpg)
@DavidGiard
IdenBty
funcCon insert(item, user, request) { item.CreatedBy = user.userId; request.execute(); }
funcCon read(query, user, request) { query.where ({CreatedBy:user.userId}); request.execute(); }
![Page 21: The Hitchhicker’s Guide to Windows Azure Mobile Services | FalafelCON 2014](https://reader034.vdocuments.net/reader034/viewer/2022042816/559454651a28ab92118b4577/html5/thumbnails/21.jpg)
@DavidGiard
Demo
![Page 22: The Hitchhicker’s Guide to Windows Azure Mobile Services | FalafelCON 2014](https://reader034.vdocuments.net/reader034/viewer/2022042816/559454651a28ab92118b4577/html5/thumbnails/22.jpg)
@DavidGiard
Scaling
![Page 23: The Hitchhicker’s Guide to Windows Azure Mobile Services | FalafelCON 2014](https://reader034.vdocuments.net/reader034/viewer/2022042816/559454651a28ab92118b4577/html5/thumbnails/23.jpg)
@DavidGiard
Scaling
![Page 24: The Hitchhicker’s Guide to Windows Azure Mobile Services | FalafelCON 2014](https://reader034.vdocuments.net/reader034/viewer/2022042816/559454651a28ab92118b4577/html5/thumbnails/24.jpg)
@DavidGiard
API Scripts
![Page 25: The Hitchhicker’s Guide to Windows Azure Mobile Services | FalafelCON 2014](https://reader034.vdocuments.net/reader034/viewer/2022042816/559454651a28ab92118b4577/html5/thumbnails/25.jpg)
@DavidGiard
API Scripts
exports.post = funcCon(request, response) { // Use "request.service" to access features of your mobile service, e.g.: // var tables = request.service.tables; // var push = request.service.push; response.send(statusCodes.OK, { message : 'Hello World!' }); }; exports.get = funcCon(request, response) { response.send(statusCodes.OK, { message : 'Hello World!' }); };
<Mobile Service URL>/api/<API Name>
hUps://giard.azure-‐mobile.net/api/MyApi
![Page 26: The Hitchhicker’s Guide to Windows Azure Mobile Services | FalafelCON 2014](https://reader034.vdocuments.net/reader034/viewer/2022042816/559454651a28ab92118b4577/html5/thumbnails/26.jpg)
@DavidGiard
Scheduler
![Page 27: The Hitchhicker’s Guide to Windows Azure Mobile Services | FalafelCON 2014](https://reader034.vdocuments.net/reader034/viewer/2022042816/559454651a28ab92118b4577/html5/thumbnails/27.jpg)
@DavidGiard
Mobile Services in .NET
![Page 28: The Hitchhicker’s Guide to Windows Azure Mobile Services | FalafelCON 2014](https://reader034.vdocuments.net/reader034/viewer/2022042816/559454651a28ab92118b4577/html5/thumbnails/28.jpg)
@DavidGiard
Mobile Services in .NET
![Page 29: The Hitchhicker’s Guide to Windows Azure Mobile Services | FalafelCON 2014](https://reader034.vdocuments.net/reader034/viewer/2022042816/559454651a28ab92118b4577/html5/thumbnails/29.jpg)
@DavidGiard
Demo
![Page 30: The Hitchhicker’s Guide to Windows Azure Mobile Services | FalafelCON 2014](https://reader034.vdocuments.net/reader034/viewer/2022042816/559454651a28ab92118b4577/html5/thumbnails/30.jpg)
@DavidGiard
Push NoBficaBons
![Page 31: The Hitchhicker’s Guide to Windows Azure Mobile Services | FalafelCON 2014](https://reader034.vdocuments.net/reader034/viewer/2022042816/559454651a28ab92118b4577/html5/thumbnails/31.jpg)
@DavidGiard
Push NoBficaBons
App
Push Service APN (Apple) GCM (Google)
WNS (Windows 8) MPNS (Windows Phone)
Azure Mobile Services
var payload = '<?xml version="1.0" encoding="uL-‐8"?><toast><visual><binding template="ToastText01">' + '<text id="1">Sample Toast</text></binding></visual></toast>'; var push = request.service.push; push.wns.send(null, payload, 'wns/toast', { success: funcCon (pushResponse) { console.log("Sent push:", pushResponse); } }); }
![Page 32: The Hitchhicker’s Guide to Windows Azure Mobile Services | FalafelCON 2014](https://reader034.vdocuments.net/reader034/viewer/2022042816/559454651a28ab92118b4577/html5/thumbnails/32.jpg)
@DavidGiard
exports.post = funcCon(request, response) {
response.send(statusCodes.OK,{ message : 'Hello World!' })
// The following call is for illustraCon purpose only
// The call and funcCon body should be moved to a script in your app
// where you want to send a noCficaCon
sendNoCficaCons(request);
};
// The following code should be moved to appropriate script in your app where noCficaCon is sent
funcCon sendNoCficaCons(request) {
var payload = '<?xml version="1.0" encoding="uL-‐8"?><toast><visual><binding template="ToastText01">' +
'<text id="1">Sample Toast</text></binding></visual></toast>';
var push = request.service.push;
push.wns.send(null,
payload,
'wns/toast', {
success: funcCon (pushResponse) {
console.log("Sent push:", pushResponse);
}
});
}
![Page 33: The Hitchhicker’s Guide to Windows Azure Mobile Services | FalafelCON 2014](https://reader034.vdocuments.net/reader034/viewer/2022042816/559454651a28ab92118b4577/html5/thumbnails/33.jpg)
@DavidGiard
Azure Mobile Services
Push NoBficaBons
Push Service APN (Apple) GCM (Google)
WNS (Windows 8) MPNS (Windows Phone)
NoCficaCon Hub
![Page 34: The Hitchhicker’s Guide to Windows Azure Mobile Services | FalafelCON 2014](https://reader034.vdocuments.net/reader034/viewer/2022042816/559454651a28ab92118b4577/html5/thumbnails/34.jpg)
@DavidGiard
So Long and Thanks!
David Giard • @DavidGiard • DavidGiard.com • TechnologyAndFriends.com