Is there anyway to get the total number of times an object has been liked in the Open Graph?
I'm referring to the new Like action: http://developers.facebook.com/docs/opengraph/actions/builtin/likes/
The new Built-In Like is the same action as a normal Like. You query them the same way.
You could query the Graph API:
http://developers.facebook.com/tools/explorer?method=GET&path=%3Fids%3Dhttp%3A%2F%2Fwww.yourpage.com
Or, you could do an FQL Query:
SELECT url, id, type, site FROM object_url WHERE url = "http://www.yourpage.com"
Note:
The object that is Liked needs to correspond to a page that has Open
Graph metatags.
Be aware of the differences between "Like_Count," "Share_Count,"
and "Total_Count" as discussed in this thread.
Related
The following Graph API gets the first checkin for each friend. How do you get the last checkin?
me/friends?fields=checkins.limit(1).fields(from,message,place.fields(id,name,location,likes,website,phone,description,checkins),tags)
Note that I can remove the limit but that is going to give me all the checkins which is not what I want.
I think this will be helpfull:
https://stackoverflow.com/a/7743148/775109
A graph Api request for that is the following
https://graph.facebook.com/me/friends?access_token=yourToken
&fields=checkins.limit(1)&format=json&offset=0
You can try use checkin api by FQL. I see only one way: use multi query in one request:
1) select post_id from checkin table from your friends (author_uid) order by timestamp (desc)
2) select page_id from location_post table, where posts from query (1)
3) get pages info from table page where page_id is set from (2)
As result, you get last checkins, but issue: this checkins don't grouped by friends. For example, you can get last (by date) checkins, that have one user.
am trying to search the fb posts of a given keyword but need only results with condition of having more than a specific comments count or likes count, i mean the results will only have posts which have a minimum of given value in comments count and likes count.
i tried with many developers but all are saying that its not possible, as the graph api don't offer this kind of method or http call functions.
but what my point is, there will be a possible way to mix both fql and graph and get the results, something like this, but i don't know the exact schema to use.
https://api.facebook.com/method/fql.query?format=JSON
&query=select comments from comment where object_id in
(select comments_fbid from link_stat where url ='http://developers.facebook.com/docs/reference/fql/comment/')
&pretty=1
You can mix Graph API and FQL requests in a single call using batch requests. You have to use the new Graph API url instead of the REST API url you show in your question. You will also need an access_token to get this data.
Facebook does have a comments.count and a likes object for the comment FQL table. That give a numerical comment count you can query against:
SELECT comments, likes FROM comment WHERE object_id IN
(SELECT comments_fbid FROM link_stat WHERE url ='http://developers.facebook.com/docs/reference/fql/comment/')
AND (comments.count > 5 OR likes > 5)
i'm using new Facebook SDK 3.0 but it's not relevant since Graph API Explorer has the same behavior.
The problem is that when i try to fetch some user photo tags, like "me/photos" or the equivalent FQL query, i get a response of max 400 elements, using either graph or fql.
I already tried using LIMIT field (for example the FQL query is "SELECT src, src_big FROM photo WHERE pid IN (SELECT pid FROM photo_tag WHERE subject=me() LIMIT 1000) LIMIT 1000")
but nothing change.
I also tried with SINCE and UNTIL, but i understood that FB returns a table of 400 rows and then shrink it according to your query.
Is maybe another way to bypass this limit or for some unknown reason FB wanted it and it's not a bug?
Thank you
I'm trying to do a search using FQL.
Using the Graph API, it works but there are more options using FQL.
Using something like
https://graph.facebook.com/search?q=myquery&access_token=mytoken
it work fine.
I'm looking for the equivalent in FQL.
What query I must write in here
https://api.facebook.com/method/fql.query?query=SELECT%20post_id%2C%20actor_id%2C%20target_id%2C%20message%20FROM%20stream&access_token=mytoken
The query above give me that
Parser error: unexpected end of query
I want to search in all public posts.
I've been looking everywhere but I did not found any solution.
Thanks.
For searching public posts for a string, you need to use the Graph API, and then filter those posts in your script. I don't think searching all public posts is possible in FQL. While FQL is more powerful, it is also more limited.
You are getting an error because you don't have a "WHERE" clause in your query. This is required in FQL.
The limit comes in because you must use at least one indexed column in your WHERE query. For the stream table you must specify either a post via post_id, a user via source_id or filter_key, or a live stream via xid. The indexed fields are marked with a * on the documentation site.
For instance, [this FQL][1]
SELECT post_id,actor_id,target_id,message FROM stream WHERE filter_key = 'others'
AND strpos(message, 'the') >= 0
will get you all posts that show on your access token owner's wall that have not been posted by the owner, with the string 'the' in them. That is the best you can get. If the post isn't visible on their wall, then you won't get the post.
If you try to leave out an indexed field, FQL will throw a 'Your statement is not indexable' error.
[1]: SELECT post_id,actor_id,target_id,message FROM stream WHERE filter_key = 'others' and strpos(message,'the') >=0
I would like to get work place information of a user using FQL.
When I use the Graph API and get the User object, it contains work information, which is essentially a list of the work history. The list elements contain nodes of employer, location, description, etc...
The nodes appear to be pages internally. If I take the id of a node, e.g. from the employer, and use FQL to query a page with that page_id, I do get an object with corresponding information.
My question now is, how do I use FQL to get the same information without accessing the Graph API? What table stores the work-related information, for example how do I find all the page_id of the employers of a given user?
The reason I insist on using FQL only is performance. Of course I could access the Graph API for all the users in question and get the info that way, but I'm looking for an FQL-only solution.
You can get this information from FQL. Read the "user" table and look for the work field. The JSON data returned should be the same format as the one for Graph, i.e., the result is an array and each result should include an "employer" object with an "id" and "name" field.
You will need user_work_history or friends_work_history to access this field.