Welcome Developers!

in

Welcome!

in
Blogs from the OpenSocial JS Container Team
  • FriendPicker widget updated

    You may (or may not) have noticed the FriendPicker (MyOpenSpace.Widgets.FriendPicker) has been updated (now version 0.4).  See the sample in the following app:

    MyOpenSpace.Widget Samples

    What does this include?  A number of bug fixes.  A bootstrap loader to fix IE and Safari timing issues, and more:

    • Bootstrapper added to main Widgets static class for loading Widgets
    • Support for multiple pickers on a page
    • Text-only mode for pickers
    • Keyboard support for search results
    • Fixed IE rendering bug of loading notice
    • Addition of style packs for FriendPicker

    The bootstrap call looks like this:

    MyOpenSpace.Widgets.Bootstrapper.createWidget("MyOpenSpace.Widgets.FriendPicker", 
    function(p){window.friendPicker = p;},
    {
    element: "pickerDivID01",
    buildSelectedUI: true
    });

     Make some noise if you find issues or have suggestions.

  • Security changes to PostTo Send Message and Comment

    In reviewing the reactions of our user base to all the great apps being built by the community, we have been moved to give end users more configuration options in how they interact with apps.  We have added a new privacy communication setting to users' profiles and slightly restricted how apps may send messages and comments. As originally deployed, an application could use the MySpace postTo extension to send messages to any user in the MySpace system, subject to that user's spam and privacy settings.  To curtail abuse (occassionally a spammy app makes it thru the review gauntlet) we have tightened this up so that apps may only send messages to a viewer's friends.

    Additionally, users may now disable communications from all apps (Edit Profile > Account Settings >  Applications > Application Communication Settings).  If an app attempts to send a message/comment to a user who has indicated they do not want communication from apps, upon confirmation of the postTo message the app viewer sees an error dialog "Undeliverable Message or Comment" and if a callback handler is attached it will receive an error response.

  • Intermittent timeouts for some apps

    Hey all, Ben from the MySpace Dveloper Platform here.

    Just wanted to let everyone know that we're hearing some of you are experiencing some intermittent timeouts on apps -- eeek, that's not good!

    A crack-team of engineers are on the case and I'll make updates to this blog post as I get them. Or, you can subscribe to the MySpace Developer Platform twitter account and get them pushed to you directly.

    Update 4:30pm, Mon April 28: We have discovered a miss-behaving process (handling url-rewriting, of all things!) and are in the process of rolling out a fix.

    Update 11:00am, Tue April 29: A patch went out last night which reduced a significant amount of the timeouts.  

  • Application Rendering Cache Changes (Coming Soon!)

    Soon we are enabling both server-side and client-side caching of the app surface content.  This helps performance and creates a better user experience with those who have multiple apps installed on their profiles. Here is a quick break-down of how each type of user will be affected:

     

    MySpace Admins & Developers will be able to:

    • ·         View their own private apps (in development, suspended, or hidden)

    NOTE:  Caching will not be used for these users.

     

    All Other Users (Including Friends of Apps) will:

    • ·         Be unable to view private apps (in development, suspended, or hidden)
    • ·         No longer be able to view a private app, even if you are a friend of the app.

    NOTE: Caching will be enabled for these users.

     

    Cache time will be for one hour initially but is configurable by the team here at MySpace and all users will be able to invalidate the cache with an explicit refresh.

    NOTE: The only group really affected by this change, is developers who use friends of an app to test the app, while the app is private or in development. We do have support for multiple developers coming very soon, which is intended to replace the need to use friends of an app to test while an app is private. In the meantime, private apps will only be viewable by the developer or someone with administrative rights over the application. All other users will be treated as standard users.

  • MyOpenSocial.Widgets - FriendPicker

    In the spirit of making your lives easier, we are introducing...
        drum roll please...

    The MyOpenSocial.Widgets library.

    You may be familiar with FriendPicker from the original PostTo sample application.
    Now, instead of filling your app up with tons of code cruft you can make a few simple calls for the same functionality:

    //at top of file
    MyOpenSpace.ClientLibraries.includeScript(
    MyOpenSpace.ClientLibraries.Scripts.MYSPACE_WIDGETS);

    ...
    //later in a registered init
    var myFriendPicker = new MyOpenSpace.Widgets.FriendPicker(
    {
    element: "pickerDiv01",
    buildSelectedUI: true
    });

    ...
    //and when you want to see what you have
    var pickedPerson = myFriendPicker.selectedFriend;

    http://www.myspace.com/myopensapcewidgetsamples

    This is early in development, so if you find issues leave comments here or in the forums.
    Also, check back in to this app periodically for new widgets as we release them.

  • Container Team Updates: 04/24/2008

    Hello all, we rolled a few additions and updates this morning - here is a summary.

    Lightweight Calls

    We’ve added some lightweight calls so you don’t have to get huge extended person objects.

     

    Note:  id can be owner or viewer and the opt_params parameter is currently not used.

    Indicators

    [edit: proper way to access] 

    MyOpenSpace.DataRequest.newFetchIndicatorsRequest(id, opt_params)

    Moods

    [edit: proper way to access] 

    MyOpenSpace.DataRequest.newFetchPersonMoodRequest(id, opt_params)

    Status

    [edit: proper way to access] 

    MyOpenSpace.DataRequest.newFetchPersonStatusRequest(id, opt_params)

     

    Note: The enums that are currently used to access the results may change, but we'll give ample notice before any change is made and will remain backwards compatible for a time before removal. example: MyOpenSpace.Group.VIEWER_STATUS

     

    Post To

    We made a few bug fixes and added callback functionality

     

    Example Code for All

    Thanks Chris!!! 

     

    <script type='text/javascript'>

    var osContainer;

    var dataReqObj;

    var param;

     

    function init(optResponse) {

          osContainer = opensocial.Container.get();

          param = {};

    }

     

    function getIndicator(stuff){

          if (typeof(stuff) === 'undefined'){

                dataReqObj = osContainer.newDataRequest();

                dataReqObj.add(MyOpenSpace.DataRequest.newFetchIndicatorsRequest(opensocial.DataRequest.PersonId.VIEWER, param));

          dataReqObj.send(getIndicator);

          } else {

                var result = stuff.get(MyOpenSpace.Group.VIEWER_INDICATORS).getData();

                dumpProps(result);

          }

    }

     

    function getMood(stuff) {

          if (typeof(stuff) === 'undefined'){

                dataReqObj = osContainer.newDataRequest();

                dataReqObj.add(MyOpenSpace.DataRequest.newFetchPersonMoodRequest(opensocial.DataRequest.PersonId.VIEWER, param));

          dataReqObj.send(getMood);

          } else {

                var result = stuff.get(MyOpenSpace.Group.VIEWER_MOOD).getData();

                dumpProps(result);

          }

    }

     

    function getStatus(stuff) {

          if (typeof(stuff) === 'undefined'){

                dataReqObj = osContainer.newDataRequest();

                dataReqObj.add(MyOpenSpace.DataRequest.newFetchPersonStatusRequest(opensocial.DataRequest.PersonId.VIEWER, param));

          dataReqObj.send(getStatus);

          } else {

                var result = stuff.get(MyOpenSpace.Group.VIEWER_STATUS).getData();

                dumpProps(result);

          }

    }

     

    function dumpProps(obj, parent) {

       for (var i in obj) {

          if (parent) { var msg = parent + "." + i + "\n" + obj[i]; } else { var msg = i + "\n" + obj[i]; }

          if (!confirm(msg)) { return; }

          if (typeof obj[i] == "object") {

             if (parent) { dumpProps(obj[i], parent + "." + i); } else { dumpProps(obj[i], i); }

          }

       }

    }

     

    function postBlogCallback(){

          var os_token = MyOpenSpace.MySpaceContainer.OSToken;

        var message = opensocial.newMessage("I am a blog post");

                   

        message.setField(opensocial.Message.Field.TITLE, "About Testing");

        message.setField(opensocial.Message.Field.TYPE, MyOpenSpace.PostTo.Targets.BLOG);

                   

        osContainer.postTo(os_token, message, null, ptCallback);

    }

     

     

    function ptCallback(someVal){

        if (someVal == MyOpenSpace.PostTo.Result.ERROR) {

          alert('callback gave error')

          }

        else if (someVal == MyOpenSpace.PostTo.Result.CANCELLED) {

          alert('user cancelled PostTo')

        }

        else if (someVal == MyOpenSpace.PostTo.Result.SUCCESS) {

          alert('WE ARE MEETING WITH GREAT SUCCESS!!!')

        }

        else {

          alert('Unrecognized response: ' + someVal)

          }               

    }

     

    init();

    </script>

          <h1>Indicator, Mood, Status</h1>

          <hr noshade >

          <input type="button" onclick="getIndicator()" value="Show Owner Indicator" />

          <input type="button" onclick="getMood()" value="Show Owner Mood" />

          <input type="button" onclick="getStatus()" value="Show Owner Status" />      

          <div id="selectInsert"></div>

     

         

          <h1>Post To: Call Me Back</h1>

          <hr noshade >

          <button onclick="postBlogCallback()">Blog post with callback</button>

  • Container Updates: 04/21/2008

    Notable Updates from Last Push

    Browser Aware Resizing

        <button onclick="gadgets.window.adjustHeight();">&nbsp;&nbsp;&nbsp;</button>
        <button onclick="gadgets.window.adjustHeight(0.2);">0.2</button>
        <button onclick="gadgets.window.adjustHeight(0.5);">0.5</button>
        <button onclick="gadgets.window.adjustHeight(0.8);">0.8</button>
        <button onclick="gadgets.window.adjustHeight(1);">1.0</button>
        <button onclick="gadgets.window.adjustHeight(200);">200</button>
        <button onclick="gadgets.window.adjustHeight(800);">800</button>
       
    What they do in order:

    1.    Adjust height to content
    2.    Make height 20% of viewable space
    3.    Make height 50% of viewable space
    4.    Make height 80% of viewable space
    5.    Make height 100% of viewable space
    6.    Make height = 200px
    7.    Make height = 800px

    Delete App Data

    You can now delete app data.

    User Type in Person

    You can now determine what a friend's user type is. Some examples are Band and Regular user
    friend.getField(MyOpenSpace.Person.Field.USER_TYPE);

    PostTo and Flash

    We released a fix for the flash issue in PostTo

    Also check out Chad's post regarding encoding urls 

  • Encoding URLs in makeRequest

    Hello everybody, this is a request to everyone out there using the makeRequest function.

    Inside the container we are encoding all URLs and post parameters, so please don't encode them yourselves.  This will result in a double encode which will get mangled by the proxy.

    If you have noticed an issue with your makeRequest function, this may be the cause.

    Good:

    gadgets.io.makeRequest("http://myurl.com?p=yay");

    Bad (for two reasons!):

    opensocial.makeRequest(encodeUriComponent("http://myurl.com?p=yay"));

    The second one is bad because it: a) encodes the URL and b) uses the deprecated opensocial.makeRequest call, which is specific to OpenSocial 0.6, please update your code to be 0.7 friendly!

    Thanks,

    Chad 

  • Heads Up: The non-MDP version of PostTo has been disabled

    I know a few of you are using the non-MDP version of PostTo found here: http://www.myspace.com/posttomyspace - I was just made aware that some issues arose today and it was just disabled until they can be addressed (which could take more than a day).They have a forum here: posttomyspace if you have questions for the team.

    The MDP version is still available - please find information about it here: http://developer.myspace.com/Community/blogs/mdpjavascriptcontainer/archive/2008/04/10/introducing-post-to.aspx

    Hate to be the bearer of bad news – don’t kill the messenger!

    DM


  • Introducing Post To

    In a nutshell, Post To enables you to provide your application users the ability to post things to MySpace. In our initial launch we’ll be offering the following Post To targets: 

    -    Posting to the viewers profile
    -    Posting a bulletin
    -    Posting to the viewers blog
    -    Adding a comment
    -    Sending a message

    Each of the targets can accept different levels of text and markup. For instance, some will accept HTML while others don’t and this is sometimes controlled by the end users privacy settings. Because of this we recommend thoroughly testing your applications.

    This should go without saying but, SPAM will not be tolerated!

    Overview 

    Post To is one of our first features that will enable you to not only help your users communicate with friends but also to start virally spreading news of your application. With just a few lines of code you can start pushing content to your users profile and friends.

    Post To works by allowing you to pass a few parameters to a JavaScript function that then displays an overlay over your application (see screenshots below) . The user can then perform different actions based on the target invoked and then submit or cancel the action.

    Finally, Post To is currently only available on Canvas pages.

    Invoking Post To 

    Below we’ll go through the basics of using Post To starting with a working out of the box code example. For information on things not covered please see the http://developer.myspace.com/community/myspace/referenceIntro.aspx   

    Sample Code

     

    <script type='text/javascript'>

     
    var
    os_token = MyOpenSpace.MySpaceContainer.OSToken;
    var
    osContainer = opensocial.Container.get();

    // gets all supported post to targets
    var
    supported = osContainer.getMySpaceEnvironment().getSupportedPostToTargets();
    var
    recipientPerson;

    // need a person object for add comment and send message

    function init() {

        dataReqObj = osContainer.newDataRequest();

        dataReqObj.add(osContainer.newFetchPersonRequest(opensocial.DataRequest.PersonId.OWNER));

        dataReqObj.send(ownerResponse);

    }

     

    function ownerResponse(data) {

        recipientPerson = data.get(opensocial.DataRequest.PersonId.OWNER).getData();

          loadSupportedTargets();

    }

     

         

    function loadSupportedTargets() {

          var temp = "<select id=\"supportedTargets\">";

          for (var i = 0; i < supported.length; i++)

          {

                temp += "<option value=\"" + supported[ i ] + "\">" + supported[ i ] + "</option>";

          }

          temp += "</select>";

          document.getElementById("selectInsert").innerHTML = temp;

    }

     

    function invokePostTo(){

          var target_is_supported = false;

          var target = document.getElementById("supportedTargets").options[document.getElementById("supportedTargets").selectedIndex].value;

          var subject = "subject text";

          var content = "content text";

          // make sure that the selected target is enabled

          for (var i = 0; i < supported.length; i++) {

                if (supported[ i ] === target) {

                      target_is_supported = true;

                      break;

                }

          }

         

          if (target_is_supported) {

                // create a new message object passing in the content to be posted and then set the subject and target fields

                var message = opensocial.newMessage(content);

                message.setField(opensocial.Message.Field.TITLE, subject);

                message.setField(opensocial.Message.Field.TYPE, target);

                // show post to

                osContainer.postTo(os_token, message, recipientPerson);

          }

    }

     

    init();

    </script>

    <div id="selectInsert"></div>

    <br>

    <input type="button" onclick="invokePostTo()" value="invoke" />

     postTo

     opensocial.Container.get().postTo(os_token, message, opt_person, opt_callback);

    • os_token: The token string, this gets passed up so we can verify who's sending the request.
    • Message:  an opensocial.Message object. The content to be posted, the message type refers to the target of the post.
    • opt_person: an opensocial.Person object. An optional opensocial.Person object, used when a recipient is required, e.g. when posting a comment, this person will get the comment.
    • opt_callback: Callback function, right now just for success/fail. - not yet implemented.

    openSocial.Message

    Below is the function for creating a new opensocial.Message object:

    var message = opensocial.newMessage(body, opt_params);

    The Post To opensocial.Message message allows for three fields:

    1. opensocial.Message.Field.TYPE

    A supported PostTo target type from MyOpenSpace.PostTo.Targets enum. You can check if a particular target is supported by invoking: opensocial.Container.get().getMySpaceEnvironment().getSupportedPostToTargets()
    Currently supported targets:
    -    MyOpenSpace.PostTo.Targets.PROFILE
    -    MyOpenSpace.PostTo.Targets.SEND_MESSAGE
    -    MyOpenSpace.PostTo.Targets.COMMENTS
    -    MyOpenSpace.PostTo.Targets.BULLETINS
    -    MyOpenSpace.PostTo.Targets.BLOG

    Example:
    message.setField(opensocial.Message.Field.Type, MyOpenSpace.PostTo.Targets.PROFILE);

    2. opensocial.Message.Field.TITLE

    A title for the post – this is not used in every target

    Example:

    message.setField(opensocial.Message.Field.TITLE, “Hello World”);

    3. opensocial.Message.Field.BODY

    The content you want to post.

    Example:

    message.setField(opensocial.Message.Field.BODY, “Hello World”);

    Note: Body can also be passed in the constructor.

    Target Screen Shots 

    Below are screen shots of the various targets with links on where you can find the corresponding MySpace feature

    Posting to Profile
    Posting to the users profile copies functionality found here: http://profileedit.myspace.com/index.cfm?fuseaction=profile.interests

    Posting to Bulletin

    Posting a bulletin copies functionality found here: http://bulletins.myspace.com/index.cfm?fuseaction=bulletin.edit

    Posting to Blog

    Making a blog post copies functionality found here: http://blog.myspace.com/index.cfm?fuseaction=blog.create&editor=true


     

    Posting a Comment

    Posting a comment copies functionality found here: http://comment.myspace.com/index.cfm?fuseaction=user.viewProfile_commentForm&friendID=20599042


     

    Sending a Message

    Sending a message copies functionality found here:  http://messaging.myspace.com/index.cfm?fuseaction=mail.message&friendID=20599042

    Sample Application

    Chris has created a handy sample application for you to see Post To in action. You can install it here:  http://profile.myspace.com/index.cfm?fuseaction=user.viewprofile&friendid=364361327


  • Your Application Rocks!

    Last week we announced that we’ll be supporting developers with approved MySpace applications in their press release efforts in an organized way to provide our developers with the best possible visibility and not flood the media. We’re getting great responses and are excited to work with all of you! We’re especially impressed by the creativity and innovation that we are seeing and feel lucky that some of the best developers out there are using MySpace to launch their applications! 

    So excited, in fact, that we’ve decided that beyond supporting developers in their press release efforts, we’d like to partner even more closely with our application developers to help tell their story and get the word out about these great apps to the many media who come to us every day looking for updates.But of course, we want to be fair about it.  We’ll be kicking off what we are calling will the “[Your Application] Rocks Outreach Program”.  So, any developer who meets the criteria to submit a request for a joint MySpace/[Your Application or company] press release, will also be considered for participation in this program.  Each week we will work with different developers on a fun campaign that will aim to reach media and potentially secure articles. We’ll be looking at individual applications/developers as well as really cool categories. Maybe you are a small company with a limited budget, or maybe you are a 19 year-old-college student who needs help figuring out the best way to get the word out about the great work that you’re doing?  As long as we think what you are doing is cool, we want to help.

    Again, if you’d like to be considered for this program and/or are interested in developing and distributing a joint MySpace/[Your Application or company] press release, please drop us an email at myspace@sparkpr.com.

    In your email, please complete the questionnaire that we’ve included below. Also, if there is an application that you love, but you didn’t develop, feel free to drop us a line to suggest it – we’re all ears!
    1. What is the name of your application?
    2. When did/does your application launch on the MySpace Application Gallery?
    3. In less than 50 words, explain how your application is innovative and interesting.
    4. Describe your application, what does it bring to MySpace Users that is new and innovative? (No more than 150 words, please)
    5. Tell us more about you and/or your team?  Where are you from originally?  Where are you now?  How many of you worked on developing the application?
    6. Who is the best contact for our PR team to partner with?  What is their contact information?
     /Kyle

     

  • Travel updates: Where we are spreading the MDP love!

    Hi everyone-

    For those who haven't been following my personal blog, I'm in Australia for the next few days where we will be presenting MDP and all its' goodness down under.

    Later this week, I'll be presenting in Beijing, followed up by Seoul before returning to Seattle.

    If you want to see pics of my travels and some of the folks behind MDP, you can check out my personal blog (www.myspace.com/signalloss). 

     

    I'll see if I can get some of the press releases and articles from these events and post them up.   Stay tuned!

     

    Cheers,

    Max Newbould 

  • Container team updates - Prototype removal, AppData limitations and all around useful bits

    Greetings Developers!

     For those who haven't run into me online or at the DevJams, I'm Max Newbould, the product owner/lead developer for the MySpace OpenSocial container.

    We are always hard at work and try to make it into IRC and the forums as much as possible, and want to make sure no useful information is only disseminated on a single medium.

     Forthcoming bits (I don't like to give dates but I will post when they are live)

        Global AppData Store - you will soon be able to create fetch/update PersonAppDataRequests with an idSpec of MyOpenSpace.Group.GLOBAL_APP_DATA to store key value pairs accessible to all instances of your application.

        Client Lib Selection - as you may have already read, we are removing prototype 1.5.1.1 as an implicit include on the container.  You can still reference it as detailed here: http://developer.myspace.com/Community/forums/t/1330.aspx.  This was done to ween applications off prototype without explicit inclusion, as the new client JS toolkit selection functionality is coming.

        PostTo - the ability to post to different MySpace areas from inside an application; messages, comments, profiles, bulletins, etc.  This is a huge feature and defined as an extension.

    Setting the record straight on AppData  

    We had been getting bug reports regarding either getting stale versions from cache, or an update not being honored when a fetch was sent in the same request.

    Behind the scenes, MySpace has a highly asynchronous nature to meet our scaling requirements.  An update will persist to databases after being sent, but we cannot guarantee the timing of when that happens.  We're talking 300ms - 3s (3s during peak times/issues), but we need developers to understand this limitation and work with it.  It's perfectly fine to send an update and use the local copy of the key value pair until a new fetch is absolutely required.

     

    As always, we love to hear from people using our container and make a huge effort to keep everyone in the loop.  

    Thanks much,

    Max