开发者

FQL for returning all album names and object id's of the albums for ALL friends of a user

looking for fql query to grab all albums of all friends,

extra points for 开发者_StackOverflow社区complete js example using FB.Data.query and jQuery to spit out results as they come in. thanks!!


You need the friends_photos permission and then use:
Javascrip:

$("#friends-albums").click(function() {
    FB.api(
        {
            method: 'fql.query',
            query: 'SELECT aid,owner,name FROM album WHERE owner IN (SELECT uid2 FROM friend WHERE uid1 = me()) LIMIT 25'
        },
        function(resp) {
            $.each(resp, function(k,v) {
                console.log(v.name)
            })
        }
    );
});

HTML:

<button id="friends-albums">Get Albums</button>

Note:

  • I'm using jQuery
  • To get the full list, remove LIMIT 25 from the query string
  • console.log is a firebug command, use alert() instead if you don't have firebug.
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜