is it possible to get insights for an OpenGraph object? - facebook

I want to get insights for a specific OpenGraph object (such as total impressions, clicks, etc..)
I'm getting the object id for the url by using FQL SELECT id FROM object_url WHERE url=......
Once I have the object id, is it possible to get insights for it ?
I tried with https://graph.facebook.com/objectid/insights without too much success..
according to Facebook's documentation, FQL can be used to get insights for a specific story, but I don't have any story ids..
is it possible to get those insights or do I have to store the action id for each generated action and get insights for those recorded action ids ? (btw - is an action id == story id ?)
btw - I'm doing everything with an app access token.

Related

how to get the top storytellers user id by facebook graph api

I um using facebook insights to get the top story tellers. I can get their cound but cannot get the userid of that particular story teller. Can anyone know the query to get the user ID of a particular story teller?
https://graph.facebook.com/140902935963424/insights/page_storytellers&access_token=[removed Gayan's access token]
No, there is no function in the Insights API which would allow you to retrieve such data.

Getting statuses and wall pictures through single Graph API call

I'm accessing the Facebook API through the JavaScript API and need the users statuses and wall photos. I'm getting the statuses through /me/statuses, but I do not really have a clue how to include the picture statuses instead of merging the data with the pictures that can be found in the album "Wall Photos". It would be great if that would work with a single request to enable proper pagination.
You have to set up an app and get the read_stream permission from the user if you haven't already.
Then you can use me/feed to query all posts on the wall.
The type of the post won't show up as status but as photo, no matter if it has been uploaded to an album and then shared or directly shared via status update. That is probably why you can't get them through me/statuses.
You can use FQL to get that info – the stream table has a field called type, and you can “filter” that for certain types by using the IN operator:
SELECT post_id, message, attachment, type FROM stream WHERE source_id = me()
AND type IN (46, 247)
46 is a status update, 247 is a photo posted to the wall.

Post Id from facebook

I am using Facebook graph API to upload photo to the Facebook and on return I am getting the object id (which is actually the photo id), but I need the POST ID of that particular post in order to get the details such total number of comments and total number of likes of that post.
Is it possible to get the post Id using object id? Or is there any Facebook API to get the comments count and likes count using the object id?
Making a call to https://graph.facebook.com/PHOTO_ID will return to you all the information (that you have permissions to see) for that photo object.
You can use the Graph API Explorer to test these methods out...

What is the difference between a Facebook Page "Like" and an external URL "Like"? And will the "user_likes" permission scope give access to both?

I'd like to pull a list of all Facebook "Likes" for a user, whether they are Facebook pages or external URLs.
Example:
If you "Like" the Facebook Platform, I know I can see it via the /me/likes API call.
However, if you like an external URL, I'm not sure how to pull that. Are both supposed to be pulled via the /me/likes call? Or is there another call to handle external likes?
Further, what about newsfeed / stream likes? For example, if I "Like" a photo, video, status or link that I see in my stream, is that accessible via the API? If so, how is this accessed?
Yes, user_likes will give you access to both.
You can access external likes as you wish through the Graph API endpoint /me/likes, as long as they're not articles. Objects with type "article" do not represent real-world objects and as such, we don't provide on a person's profile. We mention this (albeit obscurely) on the Open Graph documentation page: https://developers.facebook.com/docs/opengraph/#types
So if you go to my fake movie object page at
http://fbsb.hoodlu.ms/so_7436857/video2.html
and click like, that will show up when you access your likes on https://graph.facebook.com/me/likes.
Try it using the Graph API explorer:
https://developers.facebook.com/tools/explorer/?method=GET&path=me%2Flikes
If you want the URLs that someone has liked, use this FQL query:
SELECT url FROM url_like WHERE user_id = me()
More information is available at https://developers.facebook.com/docs/reference/fql/url_like/.
If you want to access the likes from a post, photo, video, etc. you'll need to use the like and stream FQL tables. To just pull out the likes (of posts/photos/videos) for the current user:
SELECT user_id, object_id, post_id FROM like WHERE user_id=me()
From there, you would query the stream table for the post to get more information.
like table documentation: https://developers.facebook.com/docs/reference/fql/like/.
stream table documentation: https://developers.facebook.com/docs/reference/fql/stream/
Facebook now has two ways to read likes. If you would like to get the likes of an external URL you try this:
http://graph.facebook.com/me/og.likes/[ID_FACEBOOKOBJECT]
And if you wish get the likes from an internal Facebook page (fan page,profile,photo like) try this:
http://graph.facebook.com/me/likes/[ID_FACEBOOKOBJECT]
Checkout: https://developers.facebook.com/tools/explorer

Get links that friends have "liked" on facebook

I was wondering how to build a FQL query where i could receive links/urls of my app that an user's friends have liked. I got the link table which looks good but there i need an object id, which i dunno how to retrieve for my urls.
You can get the object id from the object_url table.
https://developers.facebook.com/docs/reference/fql/object_url/