1 request get {12345})/author http/1.1{12345})/author

31

Upload: emory-fowler

Post on 02-Jan-2016

231 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: 1  REQUEST GET {12345})/author HTTP/1.1{12345})/author
Page 2: 1  REQUEST GET {12345})/author HTTP/1.1{12345})/author

Access Xbox LIVE Using RESTful Web ServicesMartin SleemanSenior Program ManagerMicrosoft

Page 3: 1  REQUEST GET {12345})/author HTTP/1.1{12345})/author

Talk Overview

• RESTful Service Introduction • Companion Apps and RESTful Services• RESTful Service overview• Authorizing against Xbox LIVE Services• Example of accessing a profile• Demo• Summary• Questions

Page 4: 1  REQUEST GET {12345})/author HTTP/1.1{12345})/author

What are RESTful Services Anyways?

• RESTful Services:• REST stands for Representational State Transfer• It is not a standard or a RFC, rather it is an architectural style

that the leverages HTTP(s) protocol• Each unique URI is a representation of an resource • APIs based on four http verbs: GET, PUT, POST, DELETE to

manipulate the resources defined by the URI• Responses can use XML or JSON

• JavaScript Object Notation (JSON)• A lightweight text-based human readable open standard

designed for data interchange11 http://en.wikipedia.org/wiki/Json

Page 5: 1  REQUEST GET {12345})/author HTTP/1.1{12345})/author

Hello World RESTful Style I’m modeling a bookshelf where each book’s ISBN number is its unique book id. Let’s Get the author of a book I wrote (ISBN 12345)REQUEST

GET http://www.contoso.com/books/book_isbn({12345})/author HTTP/1.1 Host: contoso.com …

RESPONSEHTTP/1.1 200 OK…Date: Mon, 27 Jun 2011 16:08:26 GMTServer: Microsoft-IIS/7.0…{ "author": "Martin Sleeman"}

Page 6: 1  REQUEST GET {12345})/author HTTP/1.1{12345})/author

Updating an Author RESTfullyLet’s update name of that author by putting a new value there.

REQUEST

PUT http://www.contoso.com/books/book_isbn({12345})/author HTTP/1.1User-Agent: Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0)Host: contoso.com …

Martin John Sleeman

RESPONSE

HTTP/1.1 200 OKProxy-Connection: Keep-AliveConnection: Keep-AliveDate: Mon, 27 Jun 2011 16:08:26 GMTServer: Microsoft-IIS/7.0…

Page 7: 1  REQUEST GET {12345})/author HTTP/1.1{12345})/author

RESTful Access to Xbox LIVE• Why support RESTful Services?

• Simple and easy to use (just construct URLs with sprintf)

• Many clients speak HTTPS • Easy cross platform communication• We can innovate and & release services more

quickly• It scales and caches very well • Focuses design on the cloud with multiple screens

• How can they help me?• 3 screen Title Managed Storage • 3 screen Asynchronous multiplayer

Page 8: 1  REQUEST GET {12345})/author HTTP/1.1{12345})/author

Companion Games

• Companion games extend franchises• Mobile applications, web sites, or even Arcade games

• Companion games can:• Extend the story line• Give starting advantage to players• Give the players more loot or experience points. • Transfer of loot between the companion game and full

game• Allow Abilities or enhanced items

Page 9: 1  REQUEST GET {12345})/author HTTP/1.1{12345})/author

Why Do Them

• Generate pre-launch buzz • Keep players engage over a longer period of time • The continued engagement with the brand generates:• More word of mouth recommendations• Greater revenue opportunity

• Companion games have a much shorter lag between the release date of the companion game and the full game

• Now for some examples…

Page 10: 1  REQUEST GET {12345})/author HTTP/1.1{12345})/author

Fable II: Pub GamesStep 1. Purchase pub gameStep 2. Play the Gambling mini gamesStep 3. Profit… straight to your Fable II character.

Page 11: 1  REQUEST GET {12345})/author HTTP/1.1{12345})/author

Toy Soldiers & MDTSWar Takes Money…• Contributions count toward the same war• Facebook player gets buff after playing the Xbox

360 game• Xbox 360 player gets 50% more health in Survival

from Facebook

Page 12: 1  REQUEST GET {12345})/author HTTP/1.1{12345})/author

Today: Crackdown’s Connections…

Page 13: 1  REQUEST GET {12345})/author HTTP/1.1{12345})/author

Gameplay Specifics

Page 14: 1  REQUEST GET {12345})/author HTTP/1.1{12345})/author

Companion Game Considerations…

• The game lives in the cloud• Each device is a window into the same game

• Simplicity• The experiences work together...period• Experience progress seamlessly across devices

• Everything counts• Even if you only play for 5 minutes, it helps

• Complete experience• It has to stand on its own as a fun game, it’s not just a moving ad• How do you experience the game when your companion device is next to

you?• Inclusive Recruitment

• Make it easy to keep selling the user on the game and tell their friends• Don’t assume simultaneous shipping of all your platforms

Page 15: 1  REQUEST GET {12345})/author HTTP/1.1{12345})/author

Are Companion Games Difficult?

• Cross-platform sharing is hard

• Multiple authentication methods

• Servers required for XLSP

Page 16: 1  REQUEST GET {12345})/author HTTP/1.1{12345})/author

Solution: Xbox LIVE RESTful Services

Page 17: 1  REQUEST GET {12345})/author HTTP/1.1{12345})/author

Companion Games with REST are Much Simpler!

• No XLSP Servers required• Instead use simple HTTP-

based RESTful services from more clients much more easily.

Page 18: 1  REQUEST GET {12345})/author HTTP/1.1{12345})/author

XBL RESTful Map

You are here

Users

Avatars

Social StorageFacebook Posting

Multiplayer

RESTful Roadmap

Activities

Aggregation

Page 19: 1  REQUEST GET {12345})/author HTTP/1.1{12345})/author

RESTful API Overview 2011 • Below is the list of 2011 RESTful APIs. We’ll be expanding these services

over time.• Root URL is https://services.xboxlive.com

/Aggregation• It’s a super scalable, near real-time, aggregated key-value store• Currently powers ESPN voting• Enables heat maps and voting scenarios in your game or video application

/Activity• View Leaderboards

/Matchmaking & /Multiplayer • Enables asynchronous matchmaking and multiplayer across platforms.

/Storage• Title Managed Storage. More space accessible, more often

/Users• Get & Set Profile information• Get & Grant achievements• Avatar Read (no writes)• Get Titles played by the user

Page 20: 1  REQUEST GET {12345})/author HTTP/1.1{12345})/author

What I’m Covering in this Talk…

/Users• Get & Set Profile information• Get & Grant achievements • Avatar Read (no writes)• Get Titles played by the user

Other APIs will be covered in depth in other talks

Page 21: 1  REQUEST GET {12345})/author HTTP/1.1{12345})/author

/Users NamespaceBase URI: https://services.xboxlive.com/

URI Description

Profile information /users/xuid({123456789})/profile

Information that a user has entered in about themselves (bio, motto etc.)

Avatars/users/xuid({123456789})/avatar

Provides links to the Avatar manifest

Achievements/users/xuid({123456789})/progress/achievements /users/xuid({123456789})/progress/avatarawards

Shows the achievements unlocked by the user Shows the avatar awardables unlocked by the user

Title Achievement & Awards/users/xuid({123456789})/progress/titleachievements /users/xuid({123456789})/progress/titleavatarawards

Returns all the achievements and awards both locked and unlocked for that title

Title History/users/xuid({123456789})/titlehistory//users/xuid({123456789})/titlehistory/{TitleID}

Title history including a progress overview (250/1000G, 4 of 20 achievements earned, etc.)

Page 22: 1  REQUEST GET {12345})/author HTTP/1.1{12345})/author

22

Reading Titles• https://services.xboxlive.com/users/xuid{xuid}/titlehistory

?skipItems=1&maxItems=2

{

“userTitles": [ { “currentAchievements":0,

“currentGamerscore":0, “lastPlayed":"2011-06-03T15:27:00Z", “titleId":1297287259,“titleName":"Halo: Reach", “totalAchievements":59, “totalGamerscore":1400,

},{ ….}

] }

JSON:

Page 23: 1  REQUEST GET {12345})/author HTTP/1.1{12345})/author

23

Reading Achievements• Read an achievement from the current user

https://services.xboxlive.com/users/xuid({xuid})/progress/achievements?skipItems=1&maxItems=3

{"Achievements":

[{“achievementId":28,“achievementOptions":1114112,“achievementType":1,“description":"You unlocked The Kid!",“gamerscore":10,“imageId":10,“timeAchieved":"2011-06-03T15:27:00Z",“title":"The Kid",“titleId":1480657498,“unachieved":"Find and unlock The Kid."},…]

}

JSON:

Page 24: 1  REQUEST GET {12345})/author HTTP/1.1{12345})/author

Accessing RESTful Xbox LIVE Services

• Console• You may call these new RESTful APIs directly • Existing APIs will continue to be supported through the

XDK• Windows Phone • Existing APIs continue to be supported through XNA• You may call our new RESTful APIs

• Web • Register your web site • Use our new authentication model• Use the new RESTful web services directly

Page 25: 1  REQUEST GET {12345})/author HTTP/1.1{12345})/author

Authentication Model Overview

Client

Security Token Service(STS)

1. Authenticate (prove your identity)

Trust

3. Send STS Token to access services

STS Token

2. Get STS Token

STS Token

WLID ticket

Page 26: 1  REQUEST GET {12345})/author HTTP/1.1{12345})/author

Windows Phone Accessing New XBOX Live Services

Windows Phone App

0. Trust

1. Call Gamer.GetPartnerToken with ‘New’ Audience URI

Security Token Service(STS)

Partner Token

Partner TokenNew audience

URI

WLID ticket

Windows Phone Device cert

2. Get Partner token (works like a STS token)

3. Send STS Token with RESTful callsto access services

Page 27: 1  REQUEST GET {12345})/author HTTP/1.1{12345})/author

Considerations

• We will prevent abuse of our services through TCRs. • Limits on the number of multiplayer messages sent per

day• Work with your Account Manager on your capacity

plan • Each platform version of a title will have its own

titleid.

Page 28: 1  REQUEST GET {12345})/author HTTP/1.1{12345})/author

Web Companion App Demo

Web Site Demo

Page 29: 1  REQUEST GET {12345})/author HTTP/1.1{12345})/author

Call to ActionGet the information you need…

Get started…

Need help?

Get tools & information @ https://developer.xboxlive.com

Talk to your Account Manager to get set up!Start experimentingTell us what you would like to see…

We’re here for you…Contact your Account Manager for assistance

Page 30: 1  REQUEST GET {12345})/author HTTP/1.1{12345})/author

Questions?

Page 31: 1  REQUEST GET {12345})/author HTTP/1.1{12345})/author

www.microsoft.com

© 2011 Microsoft Corporation. All rights reserved.This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.