I have a photo id "2296309061879" and it work perfectly in
http://www.facebook.com/photo.php?fbid=2296309061879
I use the Graph API link:
https://graph.facebook.com/2296309061879
get false as ALWAYS......
How about it work with my Access Token generated in my application that create by myself immediately?
https://graph.facebook.com/2296309061879?access_token=AAABnQBRA8V0BAF6Idy3ZBXD0As7kEt3ogZCp5yZB435MaZBVZCUV8xZCawgoHewciScXWDdMuiBk5sIWZCI1uJM64H3oWAl6eenZBlSutDwB9D5sT3kahRcK
still get false as ALWAYS......
So, how to get the photo from facebook with the photo id?
Another serious problem is, I use facebook's api to upload a photo to my account, and it return me the photo id. then I goto my facebook to check the photo: it does not exist in any album!!
What's wrong with facebook?
Because your app doesn't have rights to access it.
This is a public photo from my facebook:
https://www.facebook.com/photo.php?fbid=2651141672758
It also returns false if I try to use https://graph.facebook.com/2651141672758
If I try it in the explorer I also get false:
https://developers.facebook.com/tools/explorer/?method=GET&path=2651141672758
If I click on the "get access token" button, and select the user_photos permission ... it then works.
Edit: Note the first set of bullet points in the Graph API docs for photos: https://developers.facebook.com/docs/reference/api/photo/ - It would appear they're wrong, or there's a bug currently as it states any valid access token should be able to see public images and that's demonstrably not working. In order for the explorer app to list my albums and/or photos I have to explicitly grant it the user_photos permission
Related
To fetch a Facebook page videos I use the code below:
new GraphRequest(mAccessToken, "Page_ID/videos", params, HttpMethod.GET, new GraphRequest.Callback(){}
What I want is to fetch the 'Featured video' of a Facebook page, but according to Facebook documentation in the link below, 'featured_video' parameter is visible only to the page admin, What is the logic behind setting this parameter to be only read by the page admin?
https://developers.facebook.com/docs/graph-api/reference/page/
Where can I report / ask Facebook to get this parameter result allowed to be read by others than the page admin?
Graph API /{page-id}/featured_videos_collection gives Featured Videos Collection for a Facebook Page. You need to use page-access token with page-id.
See for more info. I have not tested that API. Check if it is working.
You need to use {page-id}/featured_videos_collection edge to get featured video with normal user with page-access-token. While authenticating user, you need to get user_pages permission. Admin can get featured_video in directly without giving user_pages permission in {page-d} edge only. May be because of that Facebook have kept different edge for getting featured video of a page and 'featured_video' parameter is visible only to the page admin
I'm trying to tag a person to a photo that has been posted to a Facebook page (not profile).
https://graph.facebook.com/{PHOTO_ID}/tags?to={PERSON_ID}&access_token={ACCESS_TOKEN}
The above works if the Photo_ID is one that has been posted to a profile, however, if I use the id of a photo that was posted to a page then I get
WWW-Authenticate: OAuth "Facebook Platform" "invalid_request" "(#322) Invalid photo tag subject"
I've tried using the Authenticated User's Access Token as well as the Page Access Token (as the documentation states) both produce the same error response.
I'm using the following scopes
publish_stream,photo_upload,manage_pages,user_photos
Is this even possible? If so, what in the world am I doing wrong?
You need the user_photos permission to tag a photo, so I guess it cannot work with page!
I am new to Facebook API but I have to get all photos from a Facebook page. I managed to get a graph api query that returns all pictures of only the first ever created album on the page which is the profile picture album. For example:
https://graph.facebook.com/227843870675663/photos
But I need to do the same for all other existing albums in the page. Any pointers are really appreciated.
Try this and let me know how it goes for you. I've successfully pulled all photos from a Facebook page.
Ensure that you are an Admin of the Facebook Page.
Go to:
http://developers.facebook.com/tools/explorer
In the API Navigator, you can access /me to bring up the basic information of yourself.
Try typing in /me/accounts to see if you can see anything. It should give you an error.
You need to enable certain permissions to make this Graph query. Choose the relevant permissions in the right sidebar. According to this doc you need the pages_show_list and pages_read_engagement permissions for this query.
Click on "Get Access Token" which will give you a new token with the updated permissions. You may get a popup window where you have to confirm which page(s) you would like this access token to be able to see.
Now try /me/accounts again. You should see a list of pages that you enabled access for, inside the viewing window.
Find the Facebook Page you want to query, and click on the "id" field. This ID is needed for making any queries related to this page.
Next, on the left window, you can see "Node: " and a + sign. Click on the + sign to see what options you have.
Click on the + sign and scroll down to "connections" and select "Albums"
The child-level, select "Photos"
The "Photos" child-level, select "source"
Now click "Submit" on the right hand side.
If the above doesn't work, you can try copying the following URL into the API explorer:
YOUR_PAGE_ID/?fields=albums.fields(photos.fields(source))
You will see a JSON returned with the URL of some/all of the photos in your selected Facebook Page.
Click "Get Code" and it will show you the Javascript or raw URL used to access this information.
The "cURL" tab will show the URL which will look something like this:
https://graph.facebook.com/v15.0/YOUR_PAGE_ID?fields=albums.fields(photos.fields(source))&access_token=YOUR_ACCESS_TOKEN_HERE
You can copy that URL and plug it into your browser. You should see a JSON of all your photos, and each photo's corresponding URL on Facebook's CDN.
Getting photos posted to the feed, not just photo albums
To do that, you need to run a slightly different query:
https://graph.facebook.com/v15.0/YOUR_PAGE_ID/feed?fields=attachments
Getting high resolution imagery
Many of the image URLs provided by the queries above will only provide resolutions up to 720px. If you want higher resolution images, then you need to find the target.id for each subattachment, and perform a separate graph query for each image to obtain the other resolutions. It looks like this:
https://graph.facebook.com/v15.0/YOUR_IMAGE_ID?fields=images
Watch out for expiring tokens
The token generated above will only work for approximately 1-2 hours. If you want a longer lasting token, follow the steps in this post here.
When you get your Facebook user, you can:
get the list of all its
albums
get the user's profile
picture
get the
photos
the user (or friend) is tagged in
They respectively need those permissions:
user_photos or friends_photos
not needed
user_photos or friends_photos
UPDATE:
If you want to get those information from a Facebook page:
Photos - The Page's uploaded photos.
Albums -
The photo albums the Page has uploaded.
Permissions are: any valid access_token or user access_token
It is weird sick in this situation. I know the answer but it does not work.
I use php to write a photo upload system. The picture will upload to facebook from my server and it return me the fbid. So I can use this fbid to run a FQL to get the photo's different size. The FQL is:
SELECT src_small, src_big, images FROM photo WHERE object_id=[fbid]
This work good in my php system. It return an array that contain different picture size of url. I save them in database including the fbid. Sometime it get NoPic words, so I decide to check this photo array from facebook. I run the FQL in my system again and also try the facebook graph API tools. Both of them return empty array set.
Then I use the facebook link to check if the object exist, it work.
https://www.facebook.com/photo.php?fbid=220817144722724
This means the object exist, but I cannot get it from FQL anymore...
How can I get it again?
If you successfully uploaded your photo, it means that you undoubtedly set the photo_upload permission. Unfortunately, this permission only allows you to POST photos, but not to GET them.
Therefore, I suppose you forgot to set the user_photos permission. Or perhaps didn't you set it at the right place or wasn't it re-used by your FQL query?
That must be it, because I tried it and everything is OK on Facebook's side.
I've created a timeline app that adds events to user's timelines in the past. I've noticed its simple to add tags, places, and external images to OG objects and actions.
However, I can't seem to find a good way to connect to a facebook photo (i.e. a photo from the user's albums). Adding a link to the photo's picture in the images field doesn't work the expected way without an access token (which will presumably expire)
For example: /namespace:action?image=http://graph.facebook.com/10100111692798728/picture will show a '?' photo (in aggregations and elsewhere) unless you pass a valid access token in too (that can't work permanently). This is presumably because whatever identity is going out to request the photo is not allowed to access it this way.
It doesn't seem like you can connect your own actions to photo objects either. Is there a solution to this that I've missed. I'd really like user's to be able to add a photo from their facebook albums to an action from my app (i.e. them doing the 'action'). It would be nice if you didn't have to point directly at an image on FB's CDN somewhere, it would be even nicer if there was a way to point directly at the FB open graph object.
Thanks,
Grant
It is possible to connect the action with Facebook photo like this:
POST /me/do:action?object=[objectId]&access_token=[valid access token]
If the [objectId] is an object id of existing photo - it will show the picture and correct link to the full size facebook photo on timeline.