Facebook user profile pic no longer accessible? - facebook

(I'm aware of this question, but it's outdated to the point of no longer working, so asking again.)
With the Facebook API it used to be that all profile pictures were considered public, and you could get one for anyone without any access tokens like this:
https://graph.facebook.com/4/picture
Now in 2020 it seems that it only works for public images like Zuck there. I have a tool for Facebook page admins that shows a list of people who liked page posts, but when I try to show user pictures in the list they all now come up blank because "This object does not exist or does not support this action".
The docs now say "This document refers to a feature that was removed after Graph API v3.2". But I could not find any more information about this deprecation. Is it now just impossible to show the picture of a user without having a user access token, or has the way to call it just changed?

The feature has not been removed, but now for users that don't have their profiles set as public, you need to provide an access token.
For instance suppose you use the Page API to list all the people who commented on a post. Previously you could show the profile pics of commenters by just linking to https://graph.facebook.com/<UID>/picture. However now you need an access token for that Page, and to then access the pic as https://graph.facebook.com/<UID>/picture?access_token=<TOKEN HERE>.
I have not tested this with apps, but I would assume that also to get the profile pics of app users based on their app-scoped UID, you'd need to include an access token there as well.

Related

How to get all the pictures my facebook page is tagged in?

I have a page and I want to run a contest for that page I am the admin of that page. I want people to post pictures on their wall and tag my page in their picture. at the end i want to get all the pictures my page is tagged in using graph api. Is there a way to do this ?. I have tried all the things. I created a app the i got the access token with all the permissions including manage_pages. then i got the page access toke using me/accounts endpoint. then using that access token me/photos/tagged. no luck so far. I am not getting all the pictures.
A little help would be appreciated Thanks.
Your question (and additional info in the comments) suggests that this stems from how Facebook deals with privacy. There are many scenarios in which using a page access token people cannot access content that is owned by a personal profile, even if the admin (personal profile) of the page owns that content.
If you have reason to believe that the API is not returning all the information that it should, you can file a bug with Facebook. If you do, please be sure to include all the necessary steps for them to reproduce the issue or they won't be able to fix it.

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.

Starting with facebook app (need guidelines)

i'm trying to make a facebook app, to make draws (like raffles) between the users who like my fan page, or eventually who likes a post.
I've been developing another app which do other stuff, but i'm stuck with this and it's really frustrating to not be able to do something so simple as this.
In the first place, i wish to make it available in a page tab (and that users doesn't need to "install" the app. Maybe this isn't needed if the user is just "looking" at a page that is loaded in my hosting)
Second, i don't know how could i get (assuming the one who enters the app/page tab is an admin) all the users who liked the page/post without using an access_token (because this damn access_token has an expiration time, and if i could, i'd try not to use an access token at all, since i assume the user who gets in into some parts is an admin
Any ideas?
You can't make an app that draws a contest winner from the people who like your page. Facebook does not allow you to query the fans of your pages anymore.
You can still query the users who like a post on your page though so you should set your contest up this way.
To get started, you'll need to create a connector app for your page. Users don't need to register for this app. As long as they like your page, your app will be able to access their public data. Your app will have an API key and secret. Using these, you'll be able to access information about your page.
To find a user who liked a post, you can query this with a variety of languages. I'm not sure which one you are using, so I'll give you instructions to do this from the Graph API Explorer: https://developers.facebook.com/tools/explorer
Make your post on a page, and type PAGE_ID_OR_USERNAME/feed where you replace PAGE_ID_OR_USERNAME with your page's id or username. Find the id of the post you just listed in there. It will look something like this: 213365490637345_40261112079719 (not a real post_id)
Now you can get all the user ids of people who liked that post by typing this into the explorer box:
fql?q=SELECT user_id FROM like WHERE post_id = "213365490637345_40261112079719"
And then choose a random id from that list and contact that particular user. You may have to use Facebook as your page when you try to contact them.

Facebook - public posts not appearing in Graph?

I am currently trying to get the posts for a specific user from Facebook's Graph API. I have done this numerous times before using a php script I have developed; but the problem this time seems to be on Facebook's end, not mine.
I am trying to get the posts from (replacing TOKEN with an access token):
https://graph.facebook.com/100001558773450/feed?access_token=TOKEN
The graph won't show any posts by the owner of that page but will show everyone else's posts, and as far as I can see the posts are marked as public, and there are no privacy settings set on the account that would stop it from adding the posts to the graph.
Any ideas?
Thanks,
Nick
Check that you have requested the manage_pages permission to give you full access to the page (if you need access as the "page owner").
Using the access_token you've got, according to this documentation there are three different things that you can select feed, statuses and posts.
I'd give those three a go from https://graph.facebook.com and if what you get back is what you require.
https://graph.facebook.com/100001558773450/feed?access_token=...
https://graph.facebook.com/100001558773450/statuses?access_token=...
https://graph.facebook.com/100001558773450/posts?access_token=...
You need to check the "profile" privacy settings (what to share with apps). But most importantly, this is against Facebook ToS!
You can't use a user profile to represent your business, you need to use Facebook pages instead!
More can found here:
Why should I convert my profile (timeline) to a Page?
Since profiles
(timelines) are for meant individual people, they aren't suited to
meet your business needs. Pages offer more robust features for
organizations, businesses, brands, and public figures, which you can
learn more about here.
Further, maintaining a profile (timeline) for anything other than an
individual person is a violation of Facebook's Statement of Rights and
Responsibilities. If you don’t convert your profile (timeline) to a
Page, you risk permanently losing access to the profile (timeline) and
all of your content.