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...
Related
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.
I am trying to get the user ids of all the users who have liked or commented on a status on a facebook page.
I tried using graph.facebook.com/page_id/posts?access_token=...
but it only gives me 2-4 user ids who have liked and their total count, similarly for comments. Is there any way to get all the ids?
According to The Documentation for the 'Post' object
(and verified by me on my own page using the Graph API Explorer tool), these work:
/POST_ID/comments to fetch the comments
/POST_ID/likesto fetch the Likes
I know both the old Facebook REST API and the new Graph API fairly well. Through the graph api and given maximum permissions I can request a user's photos (its my app and my account):
client.Get("/me/photos");
This returns an array of json encoded graph api photos. The only problem is that it's not the total number of photos in the account. I checked this by painstakingly counting my facebook photos AND comparing it against a simple call from the old REST API:
select pid from photo where aid in (select aid from album where owner=me())
(the above from memory, but what I had worked well)
My count and the REST API confirm that the graph API is NOT returning all the photos in the account (I know about paging as well).
Does anyone know why this is? Also, does anyone know how to convert an old REST API pid (photo id) to a new GRAPH API unique ID. It's the only way I can think of to get all the photos.
FQL is still available in the Graph API
https://graph.facebook.com/fql?q=select pid from photo where aid in (select aid from album where owner=me())
Also, there's another property called object_id on the photo fql table which should correspond (if memory serves) to the id in the photo api table
https://developers.facebook.com/docs/reference/fql/photo/
https://developers.facebook.com/docs/reference/api/photo/
Try:
https://www.facebook.com/photo.php?pid=11504724&l=3f088bdde4&id=99984862969
https://graph.facebook.com/fql?q=select object_id from photo where pid="99984862969_11504724"
Response should be:
{
"data": [
{
"object_id": "10151373634447970"
}
]
}
Using the Facebook Graph API how can find the most liked photo in an album on one of my pages?
I have access to the page insights if that can be used.
There are 200 photos in each album so I don't want to do an api request for each photo.
Subsequently you may also find the most commented on.
Here is the code you request:
http://fivespot.me/fblikes.php
$likes = $facebook->api('/'.$picId.'/likes');
However if you are looking to just find out the most liked there is an app already compiled that will do this for you:
http://apps.facebook.com/imanpic/
The Graph API doesnt support querying for an arbitrary set of photos with some criteria. BUT - you can access the Likes object for each Album, which returns a data set representing all the Liked Photos in that Album. You could then just walk that data set and count the number of times you see the same photo Like.
Thus - you just need to issue a Graph API call for Likes sub-object of an Album.
See "Likes" under "Connections" at:
http://developers.facebook.com/docs/reference/api/album/
By link-like I mean a generic page on the Web (link) that a user likes using a Facebook button (i.e. NOT a Facebook standard page).
The Graph API method /user/feed does not return link-likes.
The Graph API method /user/likes only returns Facebook page likes, but not link-likes.
Do you know of any ways that I could get to link-likes?
When you get this kind of entry you get and id something like:
"id": "1392236262_349397875123264"
The first part of id is user id, the second is the liked link id. You can get an information about it by running other Facebook Graph API call:
https://graph.facebook.com/349397875123264
This way you will get all information about this link.
You can get list of liked urls using fql:
SELECT url FROM url_like WHERE user_id = me()
http://developers.facebook.com/docs/reference/fql/url_like/