Is it possible to search the Graph API for posts a Facebook member has written where post.length > n ?
Or would I have to pull posts and parse/filter them in my code?
You can use FQL to make filtered Graph API calls.
This query will get you posts with a message containing the word "this" which are more than 50 characters long.
SELECT message, post_id FROM stream WHERE CONTAINS("this") and strlen(message) > 50 LIMIT 100
The CONTAINS() function is not documented. From my experimentation with it, it searches multiple fields and is optimized to return matches that are based on full names.
Related
I have used the call
GroupId?fields=feed{full_picture,place,from,comments{message},message,likes.limit(0).summary(true)}
to get the stated data for my application. But this only returns 25 feeds/posts. I also tried and limit number &limit=number (number like 1000) appending to the above. Yet it returns only 25. How to get all the posts?
Search for "Traversing Paged Results" in the docs:
https://developers.facebook.com/docs/graph-api/using-graph-api#reading
https://developers.facebook.com/docs/php/howto/example_pagination_basic
Some API calls have a max limit, so paging would be the only reliable way to get all items.
I did this query: SELECT id, username, name, pic_square FROM profile WHERE contains('Restaurants in Vilnius, Lithuania'), as a result I got only 23 results. Hovewer if I search for Restaurants in Vilnius, Lithuania search box, in facebook, I get around 200-400 results. Why is that so ?
Facebook limits the API result to 25 items max and you need to use paging to get the next batch: https://developers.facebook.com/docs/graph-api/using-graph-api/v2.2#paging
You really shouldn´t use FQL anymore, it will be gone for good after August 2016. Always use the Graph API: https://developers.facebook.com/docs/graph-api/using-graph-api/v2.2#search
I am trying to use limit along with since and until in Graph Api call. In between a certain time interval, I have 2 uploaded photos. The query looks like this:
me/photos/uploaded?since=2009-12-31T18%3A30%3A00.000Z&until=2010-12-31T18%3A30%3A00.000Z&limit=200
This query has limit set as 200 , and it correctly returns the 2 photos. But the problem arises when I have a smaller value of limit, lets say 100. So basically a query:
me/photos/uploaded?since=2009-12-31T18%3A30%3A00.000Z&until=2010-12-31T18%3A30%3A00.000Z&limit=100
return me an empty json. Even though there are only two photos, a limit of 100 returns null. Any insights?
I want to get comments count, likes count and shares count for a page posts. I have their IDs and I'm trying to figure something out with the Graph API or FQL, but in vain.
For regular posts I can query the stream FQL table and I get the comment_info, like_info structures and shares_count variable.
For posted photos I can query the photo table and I get from there comment_info and like_info, but it lacks the shares_count.
I tried using Graph api like that: GET /550045508388715 and it returns a ton of information, but nothing related to share count.
I've googled that issue, but did not found any relevant solution.
Instead of GET /ID use GET /POST_ID to get the shares count (if >1). You'll get the result as-
"shares": {
"count": x
}
Note- the Post ID is generally: USERID_PHOTOID ORPAGEID_PHOTOID
I'm trying to query every object which the user has liked since joining facebook by running this query:
SELECT user_id, object_id, post_id FROM like WHERE user_id=me()
This query runs fine and returns some results, but the number of them is a lot less than I estimated. I tried it on different, real user accounts, and for a friend of mine who has joined facebook around 2006 the number of returned results is still only around 65.
I tried this query through the official javascript sdk and through the graph api explorer which gave identical results.
The documentation doesn't state any limit imposed upon querying the like table.
Is there anything, I should be aware when doing a query on this table?
Thank you very much!
According to this documentation :
Each query of the stream table is limited to the previous 30 days or
50 posts, whichever is greater, however you can use time-specific
fields such as created_time along with FQL operators (such as < or >)
to retrieve a much greater range of posts.
Although not explicitly mentioned in the doucmentation for likes, I guess this will be the same limit. So try to add created_time in a where clause.