How to get Likes of Instagram photo posts in Facebook Graph API? - facebook

I am developing an app that processes <used_id>/posts connection to read the posts a user have made and count the likes and comments that have been received.
Yesterday I noticed that Instagram photo posts do not appear in posts connection. After a little search I found this Posts from Instagram not showing up on Facebook Open Graph API after which I was able to see Instagram photos in Feed connection if permission user_actions:instapp was added (or friends_actions:instapp for friend posts).
But two problems remain:
1) The posts still do not appear in Posts connection, which is more convenient for usage in my case because I am not interested in Posts of other users which may appear in Feed.
2) Even if I use Feed connection the posts do not have Likes field filled, does not matter whether I specify it directly or not. I assume that the same goes with Comments. Therefore in my case Feed is also useless because I need Likes data.
The only solution that works is by using <user_id>/instapp:take - there I get all photos also with Likes. So I might use it, but the trouble is - then I need to do double API call, because Instagram posts are not the only in which I am interested in (I still need to call <user_id>/posts).
I have submitted this bug report: http://developers.facebook.com/bugs/131821543664928
Perhaps someone has an idea for a better solution than calling instapp:take?
Thanks!

Related

How do I get users who liked my Instagram post over a period of time? using Instagram graph api

I need the statistics of users who have liked/commented on my Instagram post in a certain period of time.
After hours of searching, I came to the conclusion that I could use Instagram graph API to get a list of users who had commented on Instagram post.
but I need a list of users who had liked too.
in the Facebook Graph API docs it seems that such a possibility has been provided.
if it is possible how can I do that?
I tried to proceed according to the documents, but I think I made a mistake.
here is problem

Is it possible to get information like the reactions or likes from a certain post in a page that isn´t mine from facebook graph API?

I´m doing a special project where I need to get info like comments, likes and reactions from a page´s post in facebook but i don´t know if it´s possible or not. I can get the info from my own page with Facebook Graph API but in the final result I need to get the info from another page that isn´t mine
I´ve been searching on google and stackoverflow if it´s possible to get what I need but it seems that the answers are from a long time ago and I want to know if it´s possible to do it now after the news in the past year about Cambridge Analytica doing nasty things with the data
No, even with Page Public Content Access features you cannot get a public page's post likes or reactions, but only comments (but w/o the actual user details, so only the comment text and date/time).

Facebook Graph API insights

I'm new on working with Facebook and honestly I found it very confusing, terminology and documentation seems to be very ambiguous in many cases. Can somebody please help me out with a plain english explanation on how I can achive the following?
Post and image to Facebook (on the user page) and then check the stats (insights) of that post.
Till now I have managed to:
1) Create an app
2) Post the image on the user page with the desired message
I'm not able to understand how I can retrieve information about the particular image which was uploaded through my app. I want to know how many people have viewed that image, how many likes did it get, how many times it was re-shared.
Is it possible at all?
I'm posting to /photo not too /feed and I will like to keep it this way if it is possible.
Sorry if this was answered already but I spent a few hours trying to find an appropriate answer but wasn't able to get the right documentation.
UPDATE 1
After having a couple of days off from this topic and receiving the first 2 answers, I took another dive into this. Now I have tried the Graph API Explorer as suggested, and using the ID of a POST I can get some details about the POST, but the insights aren't showing anything, just next and previous.
My goal is to be able to gatther some stats about the pictures uploaded through the app. If this is not possible directly what should be the approach I need to take?
I don't believe a personal /photo has /insights attached to it - the Insights Object documentation page suggests that they do not - but you should be able to get likes, shares, and comments via the API.
It would appear FB has launched a redesign/reorganization of its documentation in the last couple of weeks, but the documentation for the /photo graph object is here -- you will need the user's Access Token, and the API endpoints you're looking for each have links to their own documentation pages there, including example code for each type of request.
Edit (summarizing discussion in comments):
There is no method via the Facebook API to gather insights for all photos posted to individual user timelines via an app. The app can gather likes, shares, and comments for each of those objects individually via API requests, and can make API requests for insights for photos posted to its own timeline. Neither of those options solves the intended use case here.
I'd recommend a solution that uses Sharing rather than an app integration, as this allows for better access to insights on the photos being shared. This is also a much simpler integration, and less brittle wrt future Platform changes. The main tradeoff is that the original photos being shared are expected to expire after a couple of months -- if this is unavoidable, I'd suggest implementing a redirect for requests for expired objects on the site.
We are able to get different kind of photos or picture Using Graph API
like as below:
1.Page Photos
Photos for a Facebook Page.A Page Access Token is required for all methods.Find here
2.Page Picture
Picture belonging to a Facebook Page. Find here
3.Photo
Represents an individual photo on Facebook. Find here
4.User Photos
Photos for a person.Find here
I hope it's helps you.

Reading user's posts to pages

For a given Facebook user, is there a possibility to read all posts that he's made to any pages? On FB web, these can be found in the activity log, but so far I couldn't find a method to get them via API.
Both /user/posts and /user/feeds only contain status and profile updates, not posts to pages. I know I can read /page/feed and use paging to find this user's posts for any page the user likes, but how about those he doesn't?
No, outside of FQL, there is nothing in the API that accomplishes this. I'd imagine this to be a pretty data intensive call with minimal use cases however, so I don't think this will be introduced anytime soon.

Facebook Graph Api json missing posts

I am developing an web app, which connect to facebook, to get posts, and other stuff liked by users. I have problem with getting all posts from user page using news feed(home connection of Grap API).
When getting access token in my app for user, I ask for read_stream, user_activities and offline access permissions. Then, when I use that token, to get json feed for
https://graph.facebook.com/me/home/?access_token=<retrived_access_token>
some posts(which are show on user page) are missing. I found that posts of my friends, which can be seen only by their friends, are not shown in that feed. The same issue is with posts of users which current I am subscribing.
I was searching on that for a while, and I found, that when I use link from http://developers.facebook.com/docs/reference/api/ to get my news feed, there are much more posts. It's seems to use a token generated for test console app for facebook api.
Then I tried to generate access token which would give me similar results using http://developers.facebook.com/tools/explorer?method=GET. But even when I give to generated token all possible permissions I could not get it working good, there were still some missing posts.
I read answer in that post, Facebook graph API does not return all posts for user, which suggested, that this is because of permissions set by my people who publish posts, who don't want their data to be retrieved by an app. I run some quick test, and I found that changing that setting is working( when somebody change that setting her posts will disappear from both feeds - that using my app token for user, and that under link on api reference page), but it's not the case.
It seems that this token generated on api reference page have an special permission.
I really need to get as much posts from user page as possible. I know that I will not get those blocked by their author, but as many of my users subscribe other users I really need to get access to kind of posts shown on user page.
I also read Facebook graph API: feeds missing in json response but it was also not helpfull.
I will really appreciate any help.
It is impossible to get a full list of posts from the feed / home Graph API, but you can use FQL to query the stream table to get almost every post made by friends, here is a quick example of how you would do that with the javascript sdk:
var query = 'SELECT post_id FROM stream WHERE filter_key = "others"';
FB.api('fql', {'q': query}, function(posts) { console.log(posts.data); });
This will get you the post ids, which you can then use with graph api to fetch the rest of the post info. Or you can get the full list of fields here, you can't select * in FQL so you'll have to list each piece you want and then get comments and likes and names separately.
There is an assigned/medium bug on this at http://developers.facebook.com/bugs/228057243915183. You can bump up the priority by subscribing and indicating you can reproduce it.
Also see http://developers.facebook.com/bugs/231621496918030 where Facebook has said "the stream table and me/graph have limitations. See the documentation for more info. We're trying to make this more clear in the future." Personally I don't think there is really any more info in the documentation though.