Get likes of public photo on facebook - facebook

I'm trying to get photo data (like likes) using the graph api, but it appears that some photos give me the data, but others return "Unsupported get request".
I'm only testing public pictures, using GET /photo-id.
This photo, for example, returns "Unsupported get request", as you can see here.
Other photos do work, this one, for example.
Any ideas? Thanks a lot!

The difference is that one photo is created by a Page and the other one is created by a User. You can only get the User photos with a User Access Token, even if it´s a public one. For Page photos, you can use an App Access Token or a Page Access Token.
See those links for more information about Tokens:
https://developers.facebook.com/docs/facebook-login/access-tokens
http://www.devils-heaven.com/facebook-access-tokens/
Of course you also need to request the user_photos permission in the login process to get access to the User photos.
Btw, the user_photos permissions needs to get approved if you want to make it work for all Users. Without approval, it will only work for App Admins. See changelog and review guidelines:
https://developers.facebook.com/docs/apps/changelog
https://developers.facebook.com/docs/apps/review

Error 100 indicates a syntax error in the URL you are posting to. Are you using a custom graph URL set? If so, double check it.

Related

Graph API Facebook for private profile, no likes, no reactions and no comments

In the Graph API Facebook, for private profile, no more likes, reactions and comments appear. Is there a way to request them again?
For the pages must be administrators, but for private profiles?
Is there a way to request them again?
No, there isn’t. You can only get those made by the current user who’s access token you are using, everything else will be hidden from your app.
https://developers.facebook.com/docs/graph-api/changelog/version3.0#comments-edge:
When read with a User access token, the /comments edge returns empty data for the following nodes: Album, Photo, Post, Video
https://developers.facebook.com/docs/graph-api/changelog/version3.0#reading:
The following edges and fields, when read with a User access token, return only the current user and only if applicable. […]
Regarding the comments, what is says does not seem to be strictly true - I can still see comments made by myself when requesting /me/feed?fields=comments; but everybody else’s don’t show up.

Facebook graph api for photos my page is tagged in?

I have a Page. I am using the graph api (page-id/photos) to get all the photos my page is tagged in. I am the admin of the page. I am using the access token with all the permissions including manage_pages. But the only photo that is returned in json is the page profile picture. Can Some One help me to receive all the photos my page is tagged in?
https://developers.facebook.com/tools/explorer/145634995501895/?method=GET&path=%257Bpage-id%257D%2Fphotos&version=v2.2
Thanks
Finally solved the Issue. https://developers.facebook.com/docs/graph-api/reference/v2.2/page/photos
The document reference is not clear. The end point is page-id/photos/tagged.
Steps
get access token of the person with manage_pages permissions
get access token of the page using me/accounts endpoint/
get all tagged pictures using page-id/photos/tagged endpoint

Facebook API for Share returning empty results set

I am new to Facebook API. I am building a Facebook app to fetch all the name of people who shared, commented and liked a post in a tabular format. I am able to get the like and comment details through Facebook API but can not find and proper API to get the share details.
I am using
https://graph.facebook.com/post_id?fields=sharedposts&access_token=my_access_token.
This API is returning an empty result set. And I have granted all the available permission to the access_tokn. Can anyone tell me ,Is there any other API that I can use. I saw a option of scraping the Facebook page for share,but I don't want to go that way because Facebook keeps on updating every thing.
I'm having the same problem as you, but I think I'm going a little step forward.
Try adding a limit to your sharedposts and maybe it will return some data:
Try this way:
https://graph.facebook.com/post_id/sharedposts?access_token=my_access_token&limit=1000
That should work for a regular post.
EDIT: Maybe the problem could be that althought you have granted all the perms to the token, the people who share that posts have to accept that permission too.
Otherway your JSON won't return any data.
The /sharedposts endpoint will -only- retrieve posts from users who have -also- granted your app. This means that even though a post might be public on a users' timeline, unless they have also granted your app permissions, you will not be able to retrieve that post.
For example: a user posted to a page and the post is public. This post can be retrieved with an access token. Let's assume that the user also shared this post to their own timeline. But, since the user has not granted permissions to your app, you will not be able to see this post using the /sharedposts edge on the original post (on the page). This also holds if the user shared their post publicly to his timeline.
This behaviour is by design; the API is more restrictive in returning user data than the website is. This holds for multiple endpoint and this is one of the examples where it is the case.
Source: https://developers.facebook.com/bugs/1404733043148335

How can I detect if a certain post on a Facebook page has been deleted?

I am planning to build a small side project that stores posts from particular public pages. And detect if they delete the post later. Something similar has been done for Twitter. But I couldn't find similar projects for Facebook.
Like this: http://politwoops.sunlightfoundation.com/
But for Twitter. I will do it in Python or C#
How can I go about it?
Any particular code or projects I can learn from?
The only way to check if a post is not there anymore on Facebook is to search for it with a User Access Token of the User who posted it. Every Object on Facebook gets a specific ID, you only have to check if that ID still exists. If not, you get an Error from the API.
For example: https://developers.facebook.com/tools/explorer/?method=GET&path=10203433018378479&version=v2.0
The path parameter is the ID of the Post.
Keep in mind that you need the read_stream permission for that, and you need to let Facebook approve it for other users or it will only work for Admins/Devs of your App. It is not very likely that you will get the permission approved for this though. It usually only gets approved for Apps on "Platforms without a native Facebook experience".
Edit: My bad, i was thinking about User posts, but your question was about Pages. In that case, all you need is an App Access Token (App-ID|App-Secret). The API Call would be the same, you just need to know the Post ID.
About Access Tokens:
https://developers.facebook.com/docs/facebook-login/access-tokens/
http://www.devils-heaven.com/facebook-access-tokens/
For getting the feed of a Facebook Page, see the Facebook docs (including code samples): https://developers.facebook.com/docs/graph-api/reference/v2.0/page/feed/
You can use graph api for this. If it's a public page, you can follow these steps:
Create your application in Facebook developers site
Setup the basic graph auth mechanism with your favorite language and get unexpired token.
Use your unexpired access token to do these tasks:
Enter the id of the pages you want to crawl http://graph.facebook.com/[insert page id or url here]/feed
Add post title, postID to your database.
Create a scheduled task on your server to do these tasks:
Select all / page based etc posts on your database and send a request to: http://graph.facebook.com/[insert post ID here]
if it returns it means it's still there. otherwise it will return an error.

oauth facebook api access token misses tagged photos

When I fetch tagged photos for a user I only get a certain set even after requesting the friend_photos_videos/user_photos/user_photos_videos tags and basically any other permissions list.
However doing a sample call from the fb oauth overview site gives me the entire list of tagged photos for myself with their generated access token...how is this possible?
Just wondering if anyone else has the same issue.