YQL Social Queries (FAQ)

YQL Queries FAQ:

YQL provides tables which let you access the social profiles, connections, contacts as well as updates of a Yahoo User. The actual apis around which YQL builds can be found at http://developer.yahoo.com/social/. A compilation of questions and answers on the various social tables provided by YQL are listed below. More specifically, this post deals with questions about how to get the necessary data (guids) which can then be used for querying the social tables.

  • Whats with a GUID being used in many Yahoo webservices?

A guid is a unique identifier which is NOT the YAHOO ID. Even though your yahoo id is unique, the guid is different and it looks pretty cryptic – example HEMOFFCCOH3MJ5HYPYQQQPI. I do agree that many users have very cryptic yahoo ids; what with all their birthdays and their birth city zipcodes and their lucky numbers right in the id, but the guid is just more uniformly cryptic and unique :-) )

  • How do I get my guid? Do i have to remember and type it in for each table that requires it?

YQL has already done this for you with the identifier me. It can be used anywhere your guid would appear. Just remember to drop the quotes and directly use the identifier me.

select * from social.profile where guid = me

  • How do I get a guid from a yahoo id?

YQL provides the yahoo.identity table which has a one-way mapping between a yahoo-id (yid) and a guid. Currently there is no way to get a yahoo id from a guid. This is prevent any possibility of spam that could have arisen from your Yahoo Id being exposed by such a service.

Given a yahoo id (yid), you can get back the guid by running the following query:

select guid from yahoo.identity where yid = ‘tom’

  • Is there a way to query the social.profile table with a yahoo id instead of a guid?

Yes! You can use a “IN” subselect query to find a the social profile given only a yahoo id

select * from social.profile where guid in (select guid from yahoo.identity where yid=’tom’)

  • How do I list out all the profiles of my connections?

As listed in one of YQL’s examples you can run the following query which first gets all the guids of your connections (friends) from social.connections and then fetches the profiles of each of the guids.

select * from social.profile where guid in (select guid from social.connections where owner_guid = me)

  • Only 10 of my connections show up when querying social.connections but I’d like to see all of them.

To see all your connections, one needs to use an unbounded query listed in the documentation here. The following query returns all the connections. By specifying the (0), you’re telling YQL to do all the necessary paging.

select * from social.connections(0) where owner_guid = me

Similarly you can use the social.contacts table to fetch a guid’s contacts.

Note: To view a guid’s profile or connections, you need explicit access from the guid. This is accomplished via 3 legged oauth. Unless the guid is your connection, you may not be able to see their profile in the yql console.

If you have more specific questions, let me know in the comments and I’ll do my best to answer them.

Share
  • del.icio.us
  • Facebook
  • Digg
  • description

No related posts.

blog comments powered by Disqus