I am making GET request to Facebook graph API like:
https://graph.facebook.com/Yahoo?fields=likes
It is returning the likes count even if I am not logged in.
But for URLs like: https://graph.facebook.com/CaraSutrasPage?fields=likes
I am NOT getting the Facebook likes when I am not logged-in. The reason here is, this Facebook page is age-restricted.
From this question, I tried including the User access_token like:
https://graph.facebook.com/CaraSutrasPage?fields=likes&access_token=CAAGRLGYz...User_access_token
But this works only when that user is logged into developer.facebook.com site. After logged-out it is returning "Error validating access token: This may be because the user logged out or may be due to a system error." message.
I want to get the Facebook likes for a list of Facebook page URLs(e.g. https://www.facebook.com/TheRedheadBedhead and https://www.facebook.com/pages/Sexational/382577001850507?ref=hl) which are stored in database. I have not idea about which are age-restricted and which are not!
Is there any way if I can get the likes count using FQL?
I am looking for a way to get the facebook likes by any method: GET request(e.g. https://graph.facebook.com/CaraSutrasPage?fields=likes), POST request or FQL!
Any help is highly appreciated!
You can simply hit the url and pass your pageId and token
https://graph.facebook.com/<YOUR_PAGE_NAME>/?fields=fan_count&access_token=<YOUR_ACCESS_TOKEN>
It will return a Json object.
Related
I'm trying to download every comment on a public facebook post (it's one of those "can you do this basic algebra problem" posts - I want to see what percent of the comments get it right).
The Graph API Reference shows that I should be able to just GET graph.facebook.com/v2.5/{object-id}/comments.
I believe the object-id of this post is {user-id}_{post-id}, where post-id is the id in the url. So given this url:
https://www.facebook.com/beth.mansfield.9/posts/10207885721596563
The user-id of facebook.com/beth.mansfield.9 is 1101752663 (from findmyfbid.com), and the post-id is 10207885721596563 (from the url), which makes the object-id="1101752663_10207885721596563".
When I try graph.facebook.com/v2.5/1101752663_10207885721596563/comments in the Graph API Explorer, though, I get:
{
"data": [
]
}
What am I doing wrong? Is there another way to get the comments? There are close to a million so loading them all in the browser and scraping with javascript would be unfeasible.
That is a user profile. You can only get data of a user profile if that specific user authorized your App. In that case, you would need to authorize with the user_posts permission. Just because it is public, does not mean you can get the data - that would only work for Pages.
I encounter a problem about to verify facebook user id and access token. In the app you need to register with facebook to get started. When an user get authenticated with facebook, we send the token and user_id to backend to insert into related table. But we have to know that the token belongs to the user. We saw a couple soution about it:
https://stackoverflow.com/a/8608017/1664109
And this
https://stackoverflow.com/a/20518868/1664109
So how to verify a token and user_id without send request to facebook ? Is there a way ?
based on Facebook's documentation:
as Facebook makes changes to what is stored in them and how they are
encoded.
I would say it's not possible to reliably "parse" a token.
Without sending a request to Facebook? No. But you can use the Access Token with a call to the /me endpoint. You will get the ID, and you can compare it to your stored one.
I would like to show the posts from my Facebook page in another website using Graph API:
https://graph.facebook.com/[pageID]/feed?access_token=[accesstoken]
My question is, which access token should I use?
I have tried using my App Token, but I feel like I should be using other access tokens, how would I be able to obtain another Access Token?
Depending on your use case there a three different options when it comes to the question of which access_token to use:
Use any sort of access_token to get all posts that are public
Use an user access_token to get all posts visible to the user the token belongs to
Use a page access_token to get all posts
As far as I understand you, you want to get all posts from your page, regardless of any restrictions that may apply to a user that is viewing the feed (example: age restrictions, country restrictions). In that case use the page access_token for the page you want to get the feed from.
You can get the page token by calling /me/accounts [1], look for the page object and get the access_token for that page.
You can also read about it in the Graph API documentation [2] for pages.
[1] https://developers.facebook.com/tools/explorer/?method=GET&path=me%2Faccounts&version=v2.0
[2] https://developers.facebook.com/docs/graph-api/reference/v2.0/page/feed#read
I have a user who can manage some Facebook Page. I've got access token with all permissions, including publish_actions as written here.
When I send a POST request from Graph API Explorer to <page-id>/feed specifying message and access_token of course, my post appears in Page Feed and author of this post is Page. But when I send a POST request with link instead of message it appears in 'recent publications from others' with my name.
What have I done wrong?
I'm seeing the same thing. If I send a message to <page-id>/feed it will work fine. But if I send a link to the same endpoint it posts on the
I am following the Facebook developer documentation for making a post to a Facebook 'Page' as the Page itself, which according to the docs requires impersonation. I've gotten the access token for the page itself, as well as the Page's ID, by making a call to the "accounts" feed for the user who's the admin for the Page. I then POST to
https://graph.facebook.com/[Page_ID]/feed
With the post items
access_token
and
message
containing the access token and the message, and I get a JSON string back with a post ID. Which all seems to indicate that it is posting the message to the page. HOWEVER, when I go to the particular Page, it doesn't display the posted status.
Does anyone perhaps have any idea why that might be?
Thanks in advance everyone!
Did you make sure to get the "publish_stream" permission from the user?
http://developers.facebook.com/docs/authentication/permissions