Steps towards Opensocial 0.7 API Support

Get ready for OpenSocial 0.7!  On Monday, we updated our gadget server to support more 0.7 features, and fixed some bugs that prevented proper 0.7 API usage.  Fixes range from better content fetching to new view support and much more.  We highly recommend that every developer upgrade their applications to use 0.7 -- it will be the first supported stable API on Orkut, MySpace and hi5.

So, let's get your app up and running in 0.7.  First you'll want to edit your XML module to require OpenSocial 0.7:

     <Require feature="opensocial-0.7"/>

If you've been using _IG_FetchContent() or opensocial.MakeRequest() now's the time to convert to gadgets.io.MakeRequest().  This new call allows you to fetch XML, JSON or Feed content while also allowing for GET request, POST requests and custom headers.  In a future update, we'll also support signed-requests, so you can be sure that the data you're receiving is valid.  Here's a quick example of POSTing to a REST endpoint and fetching the results:

     gadgets.io.makeRequest("http://api.hi5.com/rest/test/echo",
                 myCallback,
                 {CONTENT_TYPE: gadgets.io.ContentType.DOM,
                  METHOD: "POST",
                  POST_DATA: "message=moooooo"});

If you're using the country/lang fields in opensocial.getEnvironment().getParams() you'll want to switch to using code like the following.

    var lang = gadgets.Prefs.getLang();
    var country = gadgets.Prefs.getCountry();

Note that fetching a Hi5AuthToken is still retrieved in the same manner, except you use gadgets.views.getParams() now.

There's a new way to get user data in 0.7.  Instead of a free form NAME field, we now have an OpenSocial.Name object that includes family name, given name, prefixes and suffixes.  The opensocial.Person.getDisplayName() call remains the same.

In 0.6, you could determine the type of page your gadget was running on by calling various surface calls.  These have now all moved to gadgets.views namespace.  To use these calls, add the proper feature requires tag like so:

   <Require feature="views"/>

In your app you can call gadgets.views.getCurrentView() to get the current view, and gadgets.views.getSupportedViews() to find all supported views.  You can also use separate <Content> tags to target different portions of your gadget XML to specific views.  Here's a snippet which has shared default data and custom content for the profile view:

  <Require feature="views"/>
      .....
  <Content type="html" view="profile">
     Content visible on profile...
  </Content>
  <Content type="html" view="default,profile">
      Content visible on profile and default
  </Content>



Leave a comment

Recent Entries

  • hi5 Announces Support for Facebook® Compatible APIs

    New interfaces minimize integration effort for social game developers San Francisco, CA; Mar. 2, 2010 -- hi5, the largest social entertainment site focused on gaming,...

  • hi5 to Unveil New Game Developer Program at GDC

    Alex St. John, hi5's President & CTO and long-time gaming visionary, will unveil the details of hi5's new Game Developer Program at the Game Developers...

  • Changes to hi5 Profile for OpenSocial Apps

    As you have probably noticed, we are introducing an entirely redesigned user interface for hi5.com. This new release was announced for public beta on October...

  • Hi5 Platform Update - May 2009

    As you may have noticed, hi5 has undergone some changes lately.  We're refocusing on the social entertainment market.  You may have noticed the new hi5...

  • Platform News - November 2008

    We've been busy working on the hi5 platform.  Recent releases include:Flash 9/10 Compatibility -- With Adobe's recent release of Flash 10 we noticed a number...

Close