Welcome Developers!

in

Welcome!

in

newFetchPersonAppDataRequest not working in 0.8

Last post 11-26-2008 3:30 PM by Ryan. 5 replies.
Page 1 of 1 (6 items)
Sort Posts: Previous Next
  • 11-23-2008 9:33 PM

    • Ryan
    • Top 150 Contributor
    • Joined on 06-01-2008
    • Posts 33

    newFetchPersonAppDataRequest not working in 0.8

    Hi,

    I'm currently writing an application using OpenSocial 0.8 which tries to retrieve some app data:

    function init() {
      var idSpec = opensocial.DataRequest.PersonId.OWNER;

      var request = opensocial.newDataRequest();
      var appDataRequest = request.newFetchPersonAppDataRequest(idSpec, 'blockdata', null);
      request.add(appDataRequest, 'blockdata');

      request.send(onGetBlockData);
    }

    function onGetBlockData(dataResponse) {
      var blockDataResponse = dataResponse.getData('blockdata');
      if(dataResponse.hadError()) {
        //Error handling here
      else {
        //Processing here
      }
    }

    This was working until earlier today, however I started getting the error "opensocial.DataRequest.PersonId is undefined". Looking at the 0.8 spec indicated that opensocial.IdSpec.PersonId.OWNER should be used instead, so I changed my code to use that. The error went away, only to be replaced by an bad request error returned as part of the dataResponse: "Invalid idSpec."

    Is anyone else encountering this problem, and if so have you been able to resolve it?

  • 11-24-2008 8:59 AM In reply to

    Re: newFetchPersonAppDataRequest not working in 0.8

    Hi,

    Did you change your app to adapt to .8 by checking that in the app details?

    Regardless, let me check into this :)

    Rhonda

     

  • 11-24-2008 10:13 AM In reply to

    • Scott
    • Not Ranked
    • Joined on 07-22-2008
    • Posts 7

    Re: newFetchPersonAppDataRequest not working in 0.8

     The idspec code is close, but not quite right. This is how you create the idSpec for 0.8:

            var params = {};
            params[opensocial.IdSpec.Field.USER_ID] = opensocial.IdSpec.PersonId.VIEWER;
            var idspec = opensocial.newIdSpec(params);


  • 11-24-2008 2:35 PM In reply to

    • Ryan
    • Top 150 Contributor
    • Joined on 06-01-2008
    • Posts 33

    Re: newFetchPersonAppDataRequest not working in 0.8

    Thanks, that seems to have resolved that particular issue - mind you it seems a little long-winded compared to the old method and there doesn't appear to be anything in the documentation that suggests that's what you need to do. Not only that, but it's inconsistent compared to newFetchPersonRequest (where you can just pass in opensocial.IdSpec.PersonId.VIEWER).

    I now seem to have run across another problem - I'm actually trying to retrieve the app data for the owner, but when I try to retrieve with an OWNER IdSpec (generated by either just setting the USER_ID or also setting the NETWORK_DISTANCE and GROUP_ID as per the breaking changes doc) I get the JS error 'MyOpenSpace.Group is undefined'. Trying to retrieve the app data using VIEWER (this is the canvas, so OWNER == VIEWER) yields different errors:

    * Just setting the USER_ID, or setting the USER_ID, NETWORK_DISTANCE and GROUP_ID results in the JS error 'C is null'
    * Setting USER_ID and GROUP_ID (to opensocial.IdSpec.GroupId.SELF) results in the JS error 'opensocial.IdSpec.GroupId is undefined'

    Any thoughts?

  • 11-24-2008 9:28 PM In reply to

    • Dan S
    • Not Ranked
    • Joined on 10-01-2008
    • Posts 3

    Re: newFetchPersonAppDataRequest not working in 0.8

    Hi,

    Under 0.8, when I try to use newFetchPersonRequest to retrieve viewer information, I get an error stating "Permission denied to all viewer resources". Here's the code I use:

                    function init () {
                        var os = opensocial.Container.get();
                        var request = os.newDataRequest();
                        request.add(os.newFetchPersonRequest(opensocial.IdSpec.PersonId.VIEWER));
                        request.send(getViewerDetailsCallback);
                    }

                    function getViewerDetailsCallback (data) {
                        if (data.hadError()) {
                            debugger;  //break here to read error                 
                        }
                    }

     Is there something I'm missing here? 

  • 11-26-2008 3:30 PM In reply to

    • Ryan
    • Top 150 Contributor
    • Joined on 06-01-2008
    • Posts 33

    Re: newFetchPersonAppDataRequest not working in 0.8

    Does anyone have a solution to this?
Page 1 of 1 (6 items)