myspace developer platform dive into opensocial maxwell newbould development manager opensocial...

24
MySpace Developer Platform Dive Into OpenSocial Maxwell Newbould Development Manager OpenSocial Container Team, MySpace Seattle

Upload: xavier-robinson

Post on 26-Mar-2015

229 views

Category:

Documents


4 download

TRANSCRIPT

Page 1: MySpace Developer Platform Dive Into OpenSocial Maxwell Newbould Development Manager OpenSocial Container Team, MySpace Seattle

MySpace Developer PlatformDive Into OpenSocial

Maxwell NewbouldDevelopment Manager

OpenSocial Container Team, MySpace Seattle

Page 2: MySpace Developer Platform Dive Into OpenSocial Maxwell Newbould Development Manager OpenSocial Container Team, MySpace Seattle

Overview

Page 3: MySpace Developer Platform Dive Into OpenSocial Maxwell Newbould Development Manager OpenSocial Container Team, MySpace Seattle

First Steps…

• Apply for developer account on http://developer.myspace.com

• Demo Code and Editor http://myspace.com/OpenSocialEditor

• OpenSocial on MySpace Developer Platform(MDP)– Container– Owner– Viewer– Profile View– Home View– Canvas View

Page 4: MySpace Developer Platform Dive Into OpenSocial Maxwell Newbould Development Manager OpenSocial Container Team, MySpace Seattle

MySpace Developer Platform

• OpenSocial – MySpace applications written in JavaScript and/or

Flash

• REST API provides functionality for desktop, mobile, offline, and server to server.

• Secured using oAuth (http://www.oauth.net)

Page 5: MySpace Developer Platform Dive Into OpenSocial Maxwell Newbould Development Manager OpenSocial Container Team, MySpace Seattle

How does OpenSocial fit into MDP?

• OpenSocial is implemented using a container, entirely client-side.

• The container is a JavaScript wrapper, which allows applications to communicate with the MDP REST API and MySpace.Com.

• Applications run inside a jail domain so they are isolated from MySpace.Com.

Page 6: MySpace Developer Platform Dive Into OpenSocial Maxwell Newbould Development Manager OpenSocial Container Team, MySpace Seattle

OpenSocial 0.7/0.8 Basics

• Javascript container adheres to OpenSocial standard and wraps our RESTful API

• All extensions live in MyOpenSpace• All reference types, property names and

defined values are Enums• gadgets namespace provides generic support

for apps• Obtain reference to current container via

singleton - opensocial.Container.get()

Page 7: MySpace Developer Platform Dive Into OpenSocial Maxwell Newbould Development Manager OpenSocial Container Team, MySpace Seattle

MyOpenSpace – our Container

• Exposes extension types and methods• Balances XmlHttpRequest connections for you• Wraps extended entities and their fields• Full docs on developer.myspace.com

Page 8: MySpace Developer Platform Dive Into OpenSocial Maxwell Newbould Development Manager OpenSocial Container Team, MySpace Seattle

DataRequests – Basics

• Obtain a reference to the Container• Create a new DataRequest object• Add multiple types of requests to your

DataRequest, with optional unique keys• Call send()• Receive data in your callback

Page 9: MySpace Developer Platform Dive Into OpenSocial Maxwell Newbould Development Manager OpenSocial Container Team, MySpace Seattle

DataResponse – Basics

• DataResponse.get(‘keyname’).getData()• getField(FIELD enum) for individual fields

Page 10: MySpace Developer Platform Dive Into OpenSocial Maxwell Newbould Development Manager OpenSocial Container Team, MySpace Seattle

DataRequests – FetchPerson

• newFetchPersonRequest(idSpec, param)

param[opensocial.DataRequest.PeopleRequestFields.PROFILE_DETAILS] = [opensocial.Person.Field.ID,MyOpenSpace.Person.Field.ABOUT,MyOpenSpace.Person.Field.BOOKS];

Page 11: MySpace Developer Platform Dive Into OpenSocial Maxwell Newbould Development Manager OpenSocial Container Team, MySpace Seattle

DataRequests – FetchPeople

• newFetchPeopleRequest(idSpec, param)

opensocial.DataRequest.Group.VIEWER_FRIENDSopensocial.DataRequest.Group.OWNER_FRIENDS

param[MyOpenSpace.DetailType.GET_ONLINE] = true;param[MyOpenSpace.DetailType.GET_STATUS] = true;param[MyOpenSpace.DetailType.GET_MOOD] = true;param[opensocial.DataRequest.PeopleRequestFields.SORT_ORDER] = opensocial.DataRequest.SortOrder.TOP_FRIENDS;

Page 12: MySpace Developer Platform Dive Into OpenSocial Maxwell Newbould Development Manager OpenSocial Container Team, MySpace Seattle

DataRequests – FetchPersonAppData

• newFetchPersonAppDataRequest(idSpec, keys)

• VIEWER / OWNER / VIEWER_FRIENDS / OWNER_FRIENDS

• Keys can be “*”, “” or a key name.• Values should be JSON strings

Page 13: MySpace Developer Platform Dive Into OpenSocial Maxwell Newbould Development Manager OpenSocial Container Team, MySpace Seattle

DataRequests – UpdatePersonAppData

• newUpdatePersonAppDataRequest(idSpec, key, value)

• ONLY VIEWER is supported• Key is single key name• Value is JSON-encoded data

Page 14: MySpace Developer Platform Dive Into OpenSocial Maxwell Newbould Development Manager OpenSocial Container Team, MySpace Seattle

DataRequests – DeletePersonAppData

• newFetchDeleteAppDataRequest(idSpec, keys)• Only VIEWER is supported• Keys can be a single or array of key names.• No data in callback

Page 15: MySpace Developer Platform Dive Into OpenSocial Maxwell Newbould Development Manager OpenSocial Container Team, MySpace Seattle

MySpace Extensions• newFetchPhoto(s)Request• newFetchAlbum(s)Request• newFetchVideo(s)Request• newFetchPersonStatusRequest• newFetchPersonMoodRequest• newFetchPersonIndicatorsRequest• newFetchPersonFriendshipRequest• newFetchPeopleFriendshipRequest• What do you want to see come next?

Page 16: MySpace Developer Platform Dive Into OpenSocial Maxwell Newbould Development Manager OpenSocial Container Team, MySpace Seattle

MySpace Extensions

• PostTo– Profiles– Bulletins– Comments– SendMessage– Blog

• See “PostTo Sample – OpenSocial Extensions” app on apps.myspace.com

Page 17: MySpace Developer Platform Dive Into OpenSocial Maxwell Newbould Development Manager OpenSocial Container Team, MySpace Seattle

3rd Party Content – makeRequest()

• gadgets.io.makeRequest(url, callback, opt_params)– gadgets.io.RequestParameters– gadgets.io.MethodType• GET / POST / PUT / DELETE / HEAD

– gadgets.io.ContentType• TEXT / DOM / JSON / FEED

– gadgets.io.AuthorizationType• NONE / SIGNED / AUTHENTICATED

Page 18: MySpace Developer Platform Dive Into OpenSocial Maxwell Newbould Development Manager OpenSocial Container Team, MySpace Seattle

Viral Methods

• NO INCENTIVIZATION ALLOWED!• requestSendMesage– Only message friends– Requires user action– Only send one message per user action

• requestShareApp– Coming soon– Sends invite to install application to specified

recipient

Page 19: MySpace Developer Platform Dive Into OpenSocial Maxwell Newbould Development Manager OpenSocial Container Team, MySpace Seattle

View Navigation – requestNavigateTo

• Views are found in opensocial.getEnvironment().getSupportedSurfaces()

• Home, Profile, and Canvas views • gadgets.view.requestNavigateTo(supported_vi

ew, params);• params is an object to pass around views –

retrieve using gadgets.view.getParams()

Page 20: MySpace Developer Platform Dive Into OpenSocial Maxwell Newbould Development Manager OpenSocial Container Team, MySpace Seattle

Prefs – Localization Support

• gadgets.Prefs()• getLang() – “en” for English• getCountry() - “US” for USA• Full Localization support – resources using

“en-US”

Page 21: MySpace Developer Platform Dive Into OpenSocial Maxwell Newbould Development Manager OpenSocial Container Team, MySpace Seattle

Window – adjustHeight/getViewportDimensions• gadget.window.adjustHeight(height)– If no height passed, app will resize to fit content – If height is between 0.0(0%) and 1.0(100%), app

will resize based on browser height– If height is greater than 1, resize to that height

(pixels)– Upper limits are defined per view

• gadgets.window.getViewportDimensions– Returns { width: 0, height : 0}

Page 22: MySpace Developer Platform Dive Into OpenSocial Maxwell Newbould Development Manager OpenSocial Container Team, MySpace Seattle

Environment – getDomain/supportsField

• opensocial.Environment.getDomain()– Returns “myspace.com”

• opensocial.Environment.supportsField(objectType, fieldName)– objectType is opensocial.Environment.ObjectType– fieldName is string for field name

Page 23: MySpace Developer Platform Dive Into OpenSocial Maxwell Newbould Development Manager OpenSocial Container Team, MySpace Seattle

For more help

• http://Developer.MySpace.Com• Irc.freenode.net #myspacedev• http://twitter.com/myspacedevteam• http://Myspace.com/OpenSocialEditor• http://code.google.com/apis/opensocial• http://www.aptana.com/studio– Provides JS auto-completion for OpenSocial

Page 24: MySpace Developer Platform Dive Into OpenSocial Maxwell Newbould Development Manager OpenSocial Container Team, MySpace Seattle

Q & A

• Design Questions?• Policy Questions?• Architectural / Scaling Questions?