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

不问归期 提交于 2019-12-06 16:14:57

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.
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!