I tried to fetch the comments of a post that I did to a Facebook page, but it's returning an empty JSON.
I tried this url: https://graph.facebook.com/514371788579576_526801224003299/comments
After that I tried with an extra access token parameter from my app but it didn't work either...
Any idea why it's return an empty JSON array?
You could use FQL comment table to get the comments.
select text from comment where object_id = <POST_ID> and fromid = me()
Related
How to get the general information listed on the home page?
Facebook makes a request to
https://www.facebook.com/ajax/pagelet/generic.php/LitestandMoreStoriesPagelet?
with params:
ajaxpipe
ajaxpipe_token
no_script_path
data
__user
__a 1
__dyn
__req
__rev
__adt
And although it returns a json (inside a script with conditions...) is not a clean answer.
Is there another way to get that data? I do not want to use the sdk.
If you want the 'News feed', you'll want to use the /user/home/ API endpoint:
https://developers.facebook.com/docs/graph-api/reference/v2.1/user/home
e.g. https://graph.facebook.com/me/home?access_token=VALID_ACCESS_TOKEN will just grab your own News Feed.
You can also filter by any of the 'filter_key' values returned from the FQL query (use the Graph API Explorer and API version 2.0):
SELECT filter_key, name, type, value FROM stream_filter WHERE uid = me()
e.g. adding the query string filter=app_2305272732 will return a feed of things from the 'Photos' app (i.e. photos added to Facebook by your friends)
here cover photos is public album.and acess token is valid. but response returns an empty array.
FB.api(
{
method: 'fql.query',
query: 'SELECT object_id FROM album WHERE owner = me() AND name="Cover Photos"',
access_token: $scope.getCookie("access_token"),
},
function(response)
{
console.log(response);
}
);
According to the FB docs the query should work if you pass a valid Access Token and your album is public.
See https://developers.facebook.com/docs/reference/fql/album/#permissions
I tried this with my user, and the query itself seems fine. I think you have a problem in your JS code. The method parameter should be one of the following: GET, POST, DELETE according to https://developers.facebook.com/docs/javascript/reference/FB.api/ The method "fql.query" is deprecated. Use the Graph API endpoint /fql instead with method GET.
See the answer here to solve your problem: Using facebook javascript sdk to process fql query
I want to get all the comments made on facebook on a particular link.
see this image: http://cl.ly/062k1T380V1V3y2b1t0G, I want to get all 55 commments for that link. Is there any way I can do it?
I have tried graph.facebook.com/search?q=madhyamam.com, but the output is not accurate, or return null value.
You can get the url by querying all of the url's you have linked from your page:
https://api.facebook.com/method/fql.query?query=SELECT link_id, created_time, title, url FROM link WHERE owner = YOUR_FACEBOOK_PAGE_ID&access_token=YOUR_ACCESS_TOKEN
That should give you a list of your urls and their ids. With the id you should be able to get the comments to it:
https://graph.facebook.com/LINK_ID/comments
That will give you all of the info on your comments.
yoo can easily get mobile number of the user by this url https://graph.facebook.com/me?access_token=ACCESS_TOKEN......
the output comes in json format , after that you got the string , in there is value for key ..."mobile_phone"
Otherwise ,,,it is also beneficial for you https://graph.facebook.com/me?fields=address,mobile_phone&
access_token=ACCESS_TOKEN ...in this case you have to take permissions from the facebook api..
Thanks
I made a FB app for page.
and check the user likes the page by the app.
I use two kinds of API. and they work well.
FB.Data.query('SELECT uid FROM page_fan WHERE page_id=$pageid and uid=$userid')
and check number of rows.
FB.api({ method: 'pages.isFan', page_id: '$pageid',uid:'$userid' })
and check it returns 'true'.
but some users appeal to our page. (
They already like our page. but they still handled as not a fan.
Actually API returns false.
You can try and use the new Graph API call to see if you get better results
http://graph.facebook.com/me/likes/PAGEID?access_token=UserAccessTokenWithUserLikesPermissionsEnabled
There is a bug about this. You can see it here:
http://developers.facebook.com/bugs/344295515590822?browse=search_4f5f3563d780d9449526693
More than 1 month later Facebook does not fixed it.
I am trying to get users profile stream via facebook api. I have read all related post that pop up is stackoverflow but did not found the answer. I am using simple fql for this.
SELECT actor_id, message FROM stream WHERE source_id = <user id> limit 50
This fql statement is from facebook developer site So it should work but its not. Note that i am not using facebook connect. But according to the site i should still able to get the public posts, right?
here is the code i am using:
$fql = 'SELECT actor_id, message FROM stream WHERE source_id = <user_id> limit 10';
$query = 'https://api.facebook.com/method/fql.query?query='.urlencode($fql);
$status = file_get_contents($query);
echo $status;
The error i am getting is failed to open stream in php and when i write the url in browser directly i am getting this error 104 Requires valid signature method fql.query query SELECT message FROM stream WHERE source_id =<user_id> limit 10
Also i need to know what command to use in FQL if i want JSON data format.
Facebook has recently updated the API so that it now requires an access_token to query the stream table using FQL. So your query won't work without an access_token.
See this blog post for more information.
To get a JSON response, add "?format=JSON" after your query.