Sunday, April 27, 2014

How do I get album pictures using facebook API?

 
  1. From the first call you get all the albums (and the album IDs) '/me/albums'
  2. from there you can get the album picture (cover) '/'+album.id+'/picture'
  3. AND the photos of the album '/'+album.id+'/photos'
 
 
 FB.api("/"+albumid+"/photos",function(response){
    var photos = response["data"];
    document.getElementById("photos_header").innerHTML = "Photos("+photos.length+")";
    for(var v=0;v<photos.length;v++) {
        var image_arr = photos[v]["images"];

        var subImages_text1 = "Photo "+(v+1);

        //this is for the small picture that comes in the second column
        var subImages_text2 = '<img src="'+image_arr[(image_arr.length-1)]["source"]+'" />';

        //this is for the third column, which holds the links other size versions of a picture
        var subImages_text3 = "";

        //gets all the different sizes available for a given image
        for(var j = 0 ;j<image_arr.length;j++) {
            subImages_text3 += '<a target="_blank" href="'+image_arr[j]["source"]+'">Photo('+image_arr[j]["width"]+"X"+image_arr[j]["height"]+')</a><br/>';
        }
        addNewRow(subImages_text1,subImages_text2,subImages_text3);
    }
});

How to Retrieve Facebook Post all Comments Using Graph API

See below example:

You need to call it from a secure request https and provide an access_token:

https://graph.facebook.com/19292868552_118464504835613/comments?access_token=XXX
EDIT:
Added the object from the post document. try clicking the comments connection and then remove the access_token and try and see the difference.


  accepted
It is very simple - all you have to do is query https://graph.facebook.com/POST_ID with a valid access token. You can rad more here :
https://developers.facebook.com/docs/reference/api/