Is it possible to get all user id's who have shared a specific post, through graph api or any other resource? - facebook

I am looking for a way to record user id's of a public post for a brand. If there are any resources available, any help would be appreciated.

Retrieving share data with FB API doesn't seem to be officialy supported by Facebook, but you can retrieve posts shares with Graph API, just do the following:
Get the ID of your post (eg. /me/posts query)
Split the ID on underscore character and get the second part (first part indentifies posts author)
Query the shares: [id_2nd_part]/sharedposts
Note that since it's not officialy supported it may stop working at some point in the future
You can test it with Graph explorer - to get shared posts you need read_stream permissions on your access token if I'm not mistaken

Related

How to get my own Facebook user timeline using Graph API?

I would like to get all the posts and updates that are normally displayed in FB official application for MY account (this includes updates from my friends and liked pages).
I wasn't able to find any details how to get that, the only thing I've managed to get is my own posts.
Anyone got any experience with that using current Graph API verion (3.3)?
All the alternate FB clients (ex. Friendly) must be doing this somehow.
There is no way to get ANY data of users who did not authorized your App. Which means, there is no way to get posts of friends. You can only get your own friends, with the user_posts permission and the /me/posts endpoint. If some Apps access friend data without their authorization, they are most likely doing something that is not allowed.
Here is what I found in their API docs:
There are two scopes:
The user feed requires the user's permission
The public feed has fewer capabilities but doesn't require perms

Can I get all posts from instagram based on a specific tag with the new Facebook Graph API?

Right now I am using Instagram API Platform with the "Public Content
- capabilities to read public media on a user's behalf" rights for my app. As it is stated on the website, it will be deprecated on December 11, 2018 and they are pointing to the new Instagram Graph API.
I went through the documentation but could not find what I need. I would like to know if it is possible with the new API to:
Get all posts info (user that posted, the number of followers, caption, likes count and the media itself). With the Mentions API from Instagram Graph API you can get all posts where your Business account is tagged #account, but they require media_id which I don't have, how do I get it?
Get all posts with a specific hashtag, of a specific user (non-business account) within a timeframe. From the comments it is clear that this is not possible for now. Still hope to get an answer to my first question.
I would like to know if the above mentioned are possible with the new API and it would be nice if you can point me to the right API. Thank you in advance
but they require media_id which I don't have, how do I get it?
You can get the list of media id's on which an account has been tagged using the tags endpoint.
v4.0/<account id>?fields=tags
Once you have the list of media items in which the account has been tagged, you can cycle through them and return the following fields each media post.
Returnable Fields: caption, comments, comments_count, like_count, media_type, media_url, owner — The ID of the user who owns the object., timestamp, username
With the owner ID of the post you might be able to look up more of the fields you are looking for, but you will likely run into some permission issues.

List of shares in FB graph api

I am trying to get a list of all users who share a given object on Facebook using the graph api.
There's been some useful info in this regard on stack exchange, here: Getting which users shared a post and here: List of people who shared on facebook
I experimented with the graph api's /{object-id}/sharedposts endpoint on the api. When I make the api call with a given object id which I have verified has been shared over 100 times (according to the /{page-id}/feed endopoint I am getting the object id from for said post), the api result invariably returns as such:
{
"data": [
]
}
So I am getting an empty array...is this because my access token will not allow me to get this information? I am not friends with any of the users sharing the post nor have I 'liked' the page in which the post originates from.
Just wondering if this is an authentication issue or if there's a different problem that I am running into. I've tried it with a few object IDs so I would like to ascertain exactly why there is no data when I use the /{object-id}/sharedposts endpoint.
Thanks!
There was a comment recently added to a response on the List of people who shared on Facebook post you referenced that solved this issue for me.
An access token with read_stream permissions is required, even if you have other permissions like read_insights. I was getting the same results as you until I added the read_stream permission.
However, you still may not get all or any of the shared posts. To see a share, it either has to be shared publicly or you must have permission to view that person's shared post.

How to get insights on a Facebook fan page without user login

I'm trying to figure out how to get the total number of comments, posts, likes and fans for any given Facebook fan page and date range using the Facebook API's. I need to be able to do this without the user having to log into Facebook to give the app permissions. This does seem to be possible, as this site is able to do it https://app.conversocial.com/profiler/ .But I don't know how they are doing it.
I've looked into the 'insights' fql table, but this always seems to return empty results. And I've also looked into the 'link_stats' fql table but this doesn't allow a date range to be set.
Does anyone have any idea on how to do this?
You are right. What they are doing is not possible by using the normal Graph API or/and the FQL.
However, Facebook also provides support for two other APIs:
Public Feed API
Keyword Insights API
Access to these APIs is restricted to a limited set of media publishers and usage requires prior approval by Facebook.
I think that they are using the Public Feed API. The documentation of the Public Feed API lists some of the publishers that have been using this API and the site you've mentioned in the question is not in the list. The documentation also doesn't mention anything about getting the Page Insights, but I think it might support this feature (as I see no other way of doing it).
Or, they might be using any other such restricted API which is not yet available to the public and not even documented on the developers website, but is currently in beta/testing phase.
To get the number of fans and the talkabout count, just query the appropriate Open graph ID for the relevant page. For example, for Coca Cola (https://www.facebook.com/cocacola) this is done via
https://graph.facebook.com/40796308305
To get all public infos (Posts etc) use the following request
https://graph.facebook.com/40796308305/feed?access_token={ACCESS_TOKEN}
where {ACCESS_TOKEN} can either be an App Access Token or a personal one. Consider that you can only see public entries.
The ability to query the date ranges is not provided via Facebook ad far as I know. I guess the https://app.conversocial.com/profiler/ application queries each page that is in its index once a day, and saves the results. That's how they're able to provide historical data.
You can try with the following FQL queries or graph API requests for facebook pages,
Graph API
http://graph.facebook.com/nb4cinema
FQL
SELECT name,about,description, fan_count,talking_about_count FROM page WHERE username= 'stackoverflowpage'
In case of FQL tables:
To read the page table you need
no access_token to get public information, or information about public pages that are not demographically restricted.
any valid access_token to get all information about a page that the current session user is able to see.
We have a test fan page. This has poor figures (<10 fans). Statistics are not available due to the lack of fans and likes on that page.
Allthough, conversocial spits out some statistics. They mixed fans and likes to some extent and so my impression is, that they simply parse the page code in order to get what you see.

What is the difference between feed, posts and statuses in Facebook Graph API?

I'm trying to write a program that retreives a given user's "statuses" (and by statuses I mean the things he posted himself, anything he wrote as I'm mostly interested in textual statuses)
I cannot figure out the difference from the documentation here https://developers.facebook.com/docs/reference/api/user/ so I don't know which connection type to use; feed, posts or statuses
(Another thing I noticed is that statuses requires an access_token while the other 2 require the access_token only for non public stuff)
Thanks
This is documented on the User object of the Graph api. And, as of the Graph API v2.6, there is basically one main endpoint from which you get posts from a user.
/{user-id}/feed includes all the things that a user might see on their own profile feed; this includes, e.g., shared links, checkins, photos and status updates. This also includes posts made by friends on the user's profile.
The following endpoints return subsets of the above:
/{user-id}/posts returns the posts created by the user (on their own profile or the profile of a friend), and it may include any kind of content such as shared links, checkins, photos and status updates.
/{user-id}/tagged returns the posts created by friends and shared on the users's profile.
By default each returned post only includes the story field with a textual description of the post. But you can use the ?fields=... parameter to request as many Post fields as you want.
You'll need the user_posts permission for any of these to work.
The following endpoints are deprecated:
/{user-id}/statuses returns only status updates posted by the user on their own profile. [removed after Graph API v2.3]
/{user-id}/home returns a stream of all the posts created by the user and their friends, i.e. what you usually find on the “News Feed” of Facebook. [removed after Graph API v2.3]
I've found one more difference between /statuses and /posts. /statuses are just text statuses (it doesn't include shared links)
Feed - https://graph.facebook.com/me/feed - gives you the user's feed - meaning the posts he sees when he is visiting facebook (friends important posts) - notice that facebook filters only things it's algorithm marks as significant to the user and not everything.
Status - what the user posts on his own wall
Posts - what the user posts - including on other people's walls