I'm completely new to Facebook Graph API.
I'm trying to use the Graph API Explorer: https://developers.facebook.com/tools/explorer/
I got the token, I'm using GET method and version 2.5 of FQL, and following is the query itself:
me?fields=id,name,picture,feed
The result from that query unfortunately only includes the id, name and picture but does not include the posts. I also tried to write "posts" instead of "feed", but the result was the same.
This is what I get:
{
"id": "123456789",
"name": "John Smith",
"picture": {
"data": {
"is_silhouette": false,
"url": "https://fbcdn-profile-a.akamaihd.net/very-long-url"
}
}
}
As you can see, nothing about the posts.
I also tried to open a new Chrome tab and go directly to this URL:
https://graph.facebook.com/me/feed?access_token=very-long-token
And this is what I get for that:
{
"data": [
]
}
What am I doing wrong?
Any help will be profoundly appreciated!
Did you try with user_posts permission?
Maybe you forgot this...
https://developers.facebook.com/docs/graph-api/reference/v2.6/user/feed
Your app needs user_posts permission from the person who created the
post or the person tagged in the post. Then your app can read:
Timeline posts from the person who gave you the permission. The posts
that other people made on that person Timeline. The posts that other
people have tagged that person in.
Cheers
Related
I'm using on my website the Facebook plugin for comments in pages/posts:
https://developers.facebook.com/docs/plugins/comments/?locale=en_US
I want to get the URL where the comment was made using the comment ID.
If you try the Facebook Graph API Explorer (https://developers.facebook.com/tools/explorer/) you can get some information through a comment ID. Try, for example, the id:
10150381629441807_10156516790371807
You'll get:
{
"created_time": "2018-03-26T17:04:00+0000",
"from": {
"name": "Zohar Sabari",
"id": "10152863986513871"
},
"message": "great, thanks",
"id": "10150381629441807_10156516790371807"
}
So, does anyone know how to get the comment URL from comment ID?
I am working on some data analysis regarding beverage manufacturers in the US and would like to grab posts from the company facebook pages to mine some data using the standard facebook graph API. I am new to the facebook API and I am hoping to get some clarifications here that I can't find in the developer docs.
For a simple example lets look at 2 companies FB pages:
https://www.facebook.com/CocaColaUnitedStates
https://www.facebook.com/BellsBreweryInc
Now per the API documentation, I should be able to retrieve the posts on those public company pages via a URL as follows:
https://graph.facebook.com/COMPANYFBNAMEHERE/feed?access_token=MYTOKEN
or
https://graph.facebook.com/v2.5/COMPANYFBNAMEHERE/feed?access_token=MYTOKEN
This works for CocaCola: https://graph.facebook.com/v2.5/CocaColaUnitedStates/feed?access_token=MYTOKEN
This returns data as I would expect:
{
"data": [
{
"message": "The French \"yes! yes! yes!\" sounds like \"we! we! we!\" (lettered \"oui.\") \"C'est la vie\" sounds like (homonym) \"say LOVIE\" (like lovie dovie).\n\nSong of (rather than \"by\") Robbie Nevil: C'est La Vie\nhttp://www.youtube.com/watch?v=CGtf9QfITQw",
"created_time": "2016-02-06T02:52:17+0000",
"id": "820882001277849_452698638250376"
},
etc....
However when I try this for Bell's: https://graph.facebook.com/v2.5/BellsBreweryInc/feed?access_token=MYTOKEN
I get this:
{
"error": {
"message": "Unsupported get request. Please read the Graph API documentation at https://developers.facebook.com/docs/graph-api",
"type": "GraphMethodException",
"code": 100,
"fbtrace_id": "AWTxWye6vub"
}
}
I am not understanding why I am getting an error on Bell's page? It's a publicly available company FB page, so I can't imagine it's a restriction, but I can't understand why it wouldn't be returning the posts like CocaCola?
It sounds like the owner of the token you are using is below the legal drinking age. BellsBreweryInc is a page in the alcohol category so no data will be returned for users under the legal age. This is something BellsBreweryInc would have set in their page settings.
Age restircted websites require a user access token from a user account that meets the page requirements. I was using an app access token which is why it didn't work.
I needed to log into my account and generate a user access token and use that token in the URL.
Also, just realized that token expires in a couple hours. Anyone wanting to do this may also want to read this: How to extend facebook access token in python
i am a new comer .Someone suggested me that i will get a solution of my question from this site.So that's why i am posting my question in here.
When i used this facebook fql query:
http://graph.facebook.com/fql?q=SELECT+like_info+FROM+photo+WHERE+object_id=723217944369470
Answer was:
{
"data": [
{
"like_info": {
"can_like": false,
"like_count": 7,
"user_likes": false
}
}
]
}
But when i used this facebook fql query:
http://graph.facebook.com/fql?q=SELECT+like_info+FROM+stream+WHERE+post_id=488253731301614
Answer was:
{
"data": [
]
}
Why?and how to query correctly to get a post's like info?
In graph API, you can do something like this to get a post's likes:
https://graph.facebook.com/POST_ID/likes?access_token=ACCESS_TOKEN
You need to replace POST_ID and ACCESS_TOKEN with actual values.
You can use Graph API Explorer to generate an access_token
https://developers.facebook.com/tools/explorer/ (don' forgot asking for sufficient permission to view the post in question).
Goal:
I want to specify privacy for posts, that are done through my application, when I post to a Page's wall, using Pagetoken.
Problem:
Using page token, I do post to URL "https://graph.facebook.com/me/feed"
with the following body —
{
"message": "from app with security after requesting a username",
"privacy": {
"description": "Amsterdam, Netherlands, Netherlands",
"value": "CUSTOM"
}
}
An receive such a terrible answer —
{
"error": {
"message": "(#100) Posts where the actor is a page cannot also include privacy.",
"type": "OAuthException"
}
}
Even through it is said in documentation, here - https://developers.facebook.com/docs/reference/api/page/#posts,
that Pages#post.privacy is supported.
And explicitly:
"The description field may contain a comma-separated lists of valid country, city and language if a Page's post targeting by location/language is specified."
Please help me out, what am I doing wrong?
I posted the bug in Facebook Developers Bug reporter tool
https://developers.facebook.com/bugs/238365492903384
Subscribe/Comment to push this for a reply
This looks like a documentation bug. I have attached a screenshot of the old version of the docs. Try using "targeting" with the same location format as:
https://developers.facebook.com/docs/adsapi/targeting_specs/
I've also requested a fix for the docs.
This seems like a pretty obvious, basic thing to expect from the Graph API, but I'm having serious difficulty with it. All I want to do is get the ID for any particular URL. They have a method for this:
https://graph.facebook.com/?ids=http://www.imdb.com/title/tt0117500/
And that works great. But if I try another URL, say for my blog,
https://graph.facebook.com/?ids=http://dusda.vox.com
it doesn't give me back a numerical ID like all of the examples do. Instead, this:
{"http:\/\/dusda.vox.com":{"id":"http:\/\/dusda.vox.com"}}
If I try to use that "id", I get jack (probably because the query string looks impossible to parse):
Request: https://graph.facebook.com/http://dusda.vox.com/likes
Response: {"id":"http:\/\/dusda.vox.com\/likes"}
So what's up with this? Is the Graph API just selectively reliable, or am I misunderstanding something? I've tried it on URLs that I know are popular on Facebook, too, and I've gotten mixed results.
Try FQL for this;
http://graph.facebook.com/fql?q=select%20url%2C%20id%2C%20type%2C%20site%20from%20object_url%20where%20url%20%3D%20%22http%3A%2F%2Fkriek.hu%2F%22
returns:
{
"data": [
{
"url": "http://kriek.hu/",
"id": 497425470154,
"type": "link",
"site": "kriek.hu"
}
]
}
For more information, see object_url.
I hope it helps!
The ID is given by Facebook only to pages which have a fbshare/like button. Else the API returns the number of shares and the request URL.
If I use the facebook object debugger page I can scrape every url, for example:
https://developers.facebook.com/tools/debug/og/object?q=ddnl.de
The page give me back an url with ID and so I can get every needed parameters.
In this case https://graph.facebook.com/10150164108649475
But I don't get this ID or url with FQL or otherwise?
Very old question, but here's what I found works for me as none of the answers here really resolved my issue:
If you have a custom object tied to a url, the method suggested by Pepe only gives the id FB assigns to the url where type=link. (Which is not tied to any comments)
In my case, I need my custom object id so that I could pull associated comments from it. You can get the object id using FQL by doing a select on 'comments_fbid' from the 'link_stat' table. (This will return the object id even if no comments have been added so it should work for other cases)
api.facebook.com
At this time no of the suggested solutions work for all urls. Only the Debugger is able to get the Graph ID correctly
For example
Debugger:
https://developers.facebook.com/tools/debug/og/object?q=http%3A%2F%2Fwww.amazon.de%2Fgp%2Fproduct%2F3810510793%2F
For URL:
www.amazon.de/gp/product/3442465583/
Result:
https://graph.facebook.com/10150771435736113
{
"url": "http://www.amazon.de/dp/3810510793/ref=tsm_1_fb_lk",
"type": "book",
"title": "Die unwahrscheinliche Pilgerreise des Harold Fry: Roman",
"image": [
{
"url": "http://ecx.images-amazon.com/images/I/51I4E81xrRL._SL160_.jpg"
}
],
"description": "Die unwahrscheinliche Pilgerreise des Harold Fry: Roman",
"site_name": "Amazon.de",
"updated_time": "2012-12-19T16:54:27+0000",
"id": "10150771435736113",
"application": {
"id": "164734381262",
"name": "Amazon",
"url": "https://www.facebook.com/apps/application.php?id=164734381262"
}
}
I had the same problem here, I was trying to get the same data IMDB gets. After almost bang my head against the wall, I decided to look at the facebook's js function. And look what I get, the explanation is on the link.
Getting limited data from a page which has a Facebook ID
Peace