How to Use Facebook Graph API to Retrieve Fan Photos Uploaded to Wall of Fan Page

How to use Facebook graph API to retrieve fan photos uploaded to wall of fan page?

You need to retrieve all the albums and then get all the photos. This can be easily done by using FQL:

SELECT pid,owner,src_small,src_big 
FROM photo
WHERE aid IN (
SELECT aid
FROM album
WHERE owner = your_page_id
)

EDIT:
Also you need to query the stream table to get the wall posts then check if you have attachments and the type of the attachment:

SELECT attachment
FROM stream
WHERE source_id = 116860675007039

Result:

[
{
"attachment": {
"media": [
{
"href": "http://www.facebook.com/photo.php?fbid=1801693052786&set=o.116860675007039",
"alt": "test",
"type": "photo",
"src": "http://photos-f.ak.fbcdn.net/hphotos-ak-snc6/185861_1801693052786_1553635161_1863491_4978966_s.jpg",
"photo": {
"aid": "6672812206410774346",
"pid": "6672812206412558147",
"fbid": 1801693052786,
"owner": 1553635161,
"index": 11,
"width": 246,
"height": 198
}
}
],
"name": "",
"caption": "",
"description": "",
"properties": [],
"icon": "http://b.static.ak.fbcdn.net/rsrc.php/v1/yz/r/StEh3RhPvjk.gif",
"fb_object_type": "photo",
"fb_object_id": "6672812206412558147"
}
},
{
"attachment": {
"description": ""
}
},
...etc
]

Python Facebook graph api - Upload photo to fan page

If the post is appearing on your personal user's wall and not on the page's wall, you are using the wrong access token. You need to be using a page access token.

You can read more on the Facebook documentation

Basically, in order to get that access token, you'll need to provide your application with the manage_pages permission. After that you can make a call to /me/accounts and get a list of all the pages that the user administrates. In that list there should be the access tokens for each page.

I'm not 100% sure how you would set the access token with the library you are using, but essentially all you need to do is append the token to the request with the access_token parameter.

https://graph.facebook.com/WHATEVER_YOU_ARE_DOING?access_token=XXX

Facebook graph api photo upload to a fan page album

This seems to be a bug with the Graph API. See this http://forum.developers.facebook.com/viewtopic.php?id=59063 (can't post links, yet)

how to post a photo to a fan page using graph api?

I guess you're not using the Page access token you can receive for your app for this page via

/me/accounts

The docs at https://developers.facebook.com/docs/graph-api/reference/page/feed/#publish state that

  • A user access token with publish_actions permission can be used to publish new posts on behalf of that person.
  • A page access token with publish_actions permission can be used to publish new posts on behalf of that page.

Facebook graph api call for a page's photos?

Sometimes you're unfortunately stuck using FQL calls to get this type of information. Facebook has a lot of inconsistencies with how page data is handled -- I won't get into these, but what you're looking to do can be found here: How to use Facebook graph API to retrieve fan photos uploaded to wall of fan page?

Here's a PHP example:

    $photoQuery = urlencode('SELECT pid,owner,src_small,src_big FROM photo WHERE aid IN ( SELECT aid  FROM album  WHERE owner = your_page_id)');    
$photoFQL = 'https://api.facebook.com/method/fql.query?query='.$photoQuery .'&access_token='.$accessToken.'&format=json';
$photoResults = file_get_contents($photoFQL);

You'll end up with a url like this you can test with:

https://api.facebook.com/method/fql.query?query=SELECT%20pid%2Cowner%2Csrc_small%2Csrc_big%20FROM%20photo%20WHERE%20aid%20IN%20(%20SELECT%20aid%20%20FROM%20album%20%20WHERE%20owner%20%3D%{page_id})&access_token={access_token}&format=json

Replacing the {page_id} and {access_token} with your own, of course. I tested this and it showed my Community/Fan Page's photos in a JSON response. Good luck.

photos from Facebook fan page

I would start with FQL Explorer and FQL documentation.

Then look for some Facebook/FQL API for PHP.

Examplary query is:

SELECT aid, pid, src_big from photo where owner = me()

Facebook. Fan page. Wall. Pictures

  • You can´t post multiple pictures in one API call, at least not right now.
  • Are you sure you looked at the right spot? Keep in mind that there will be a picture posted with a caption, but there will also be a wall post. Maybe you have only changed the photo caption and it´s not visible on the wall. Take a look at the picture directly.

That being said, according to the API reference, you should get more than just "OK", you should get the post id in the result. i´d file a bug: https://developers.facebook.com/bugs/

Upload image to facebook fan page using API

Don't know if this would help but maybe you need to request manage_pages extended permission and then use returned page access_token for posting pictures. You can read briefly about this process here.

Then you can try these links with page access token for posting photos:

/me/photos
/<page_id>/photos
/<album_id>/photos


Related Topics



Leave a reply



Submit