MySpace Open Platform

A Place For Developers

Welcome Developers!

in

Welcome!

in

How do I fetch data by ID?

Last post 10-15-2009 4:15 AM by John. 8 replies.
Page 1 of 1 (9 items)
Sort Posts: Previous Next
  • 03-12-2008 6:18 PM

    How do I fetch data by ID?

    For example, i see from the docs that there is a getById() function, but to which object does this function belong?

           var thumbnailRequest = dataRequest.newFetchPeopleRequest(opensocial.Person.Field.THUMBNAIL_URL.getById(PersonID)); 

    This doesn't work - the error is:

            opensocial.Person.Field.THUMBNAIL_URL.getById is not a function

    Can someone point me in the right direction?

    Thanks... 

  • 03-12-2008 6:45 PM In reply to

    Re: How do I fetch data by ID?

    It's for collections, not single objects or fields.

    For example, say you've sent out a FetchPeopleRequest with a request for VIEWER_FRIENDS, called 'viewerFriends':

    dataRequestCallback(response) {

      var ownerId = gadgets.views.getParams().ownerid; // get the owner's id from the app's environment
      var vFriends = response.get('viewerFriends').getData(); // get viewer's friend list
      var test = vFriends.getById(ownerId);

      if( test != null) {
          alert("You are a friend of this person!");
      } else {
          alert("This person does not like you. I suggest you go away.")
      } 
    }

    The function exists, but I haven't tested it much (I just ran through this code above with owner as viewer -- since the Owner is never on their own Friend's list, it told me to go away), but it's there.

  • 03-12-2008 6:53 PM In reply to

    Re: How do I fetch data by ID?

    Okay thanks - but in my example I just want the thumbnail of an app user? All I have is their ID...

    So I need the thumbnail for user 123 for example...? 

    (Assuming that user 123 has installed the app and given premission to use their data)

     

     

  • 03-12-2008 7:12 PM In reply to

    Re: How do I fetch data by ID?

    You can't, unless you can retrieve the user first from a group, either OWNER_FRIENDS or VIEWER_FRIENDS -- if user 123 isn't in one of those two lists, your App does not have access to their thumbnail from where it is. It's layered privacy -- first, your app only ever has access to data from installed Users. Next, your app, at any one time, only has access to data it can retrieve directly from the Owner or the Viewer, no one else. Lastly, it has to pass through that person's own settings (for example, I can set it so my name never appears in any of my friends' friends lists. Does that make sense?).

  • 03-12-2008 7:26 PM In reply to

    Re: How do I fetch data by ID?

    Sure - but can this be correct?

    If someone installs our app and requests to be intorduced to other installed members - say everyone with the same name as them. I need to select other installed app users (ie, not their friends) and display their details to the viewer.

    So if soemone called 'James' installs the app and requests to be introduced to all other people called 'James' - I search our db for the ID's of all the users called 'James' and display their details - I can't fetch additional data about these people? Surely when they install the app they provide permission for us to do this?

     


  • 03-12-2008 11:08 PM In reply to

    Re: How do I fetch data by ID?

    Nope -- they agree to nothing more than the ability to use your service and that may require access to their information (and that MySpace is not liable for anything).

    It's also important to note that what you propose above can't be done, either. You said "search our DB" -- I assume you mean a database you maintain offsite. You can't store DisplayNames off-site. You can cache them, for that user's convienence, for up to 24 hours, but you can't store them. That's not a MySpace limitation - it's the law; those users legally own those names; keeping a duplicate is tantamount to copyright theft.

    The only I can think of, and I'm not sure how MySpace will handle this (and it applies to the above solution, as well, I guess) is to have the user agree to a Terms of Service or Usage for your application before they start using your service. I honestly don't know if MySpace will allow you to extend your own Terms to it's users. I haven't seen anything that says you can't (as long as your Terms do not conflict with MySpace's), but I haven't seen anything that says you can, either. Those terms can spell out how you'll be using their thumbnail picture and display name (and storing them) as part of how your service operates.

  • 03-12-2008 11:49 PM In reply to

    Re: How do I fetch data by ID?

    Right, okay - well that not an issue really - "name" is perhaps a bad example.

    I am surprised that we cannot fetch data about the installed app users though - seems somewhat overly restrictive to me...

  • 04-24-2008 8:42 AM In reply to

    Re: How do I fetch data by ID?

    please tell me can I fetch the data of my friends if they installed my application? 

  • 10-15-2009 4:15 AM In reply to

    • John
    • Not Ranked
    • Joined on 10-10-2009
    • Posts 2

    Re: How do I fetch data by ID?

     hey there,

    i am having same que?

    can you give me answer if u already got it?

    thnaks in advance.

Page 1 of 1 (9 items)