Facebook Graph API Search Posts for specific text in message field - facebook-graph-api

Is there a way with graph facebook to search specific text content in the message of a user's posts? The assumption here is that the user id and access token is already available as well as all applicable permissions (ie. the user_posts permissions, etc..).
I read through the search feature on graph:
Facebook Graph Docs-Advanced
The following graph explorer example was provided:
GET graph.facebook.com/search?
q={your-query}&
type={object-type}
The table that lists the available types in the link provided is very limited (place, placetopic, ad_*). Is that the full list of possible types? Can we use POSTS or user posts as a type. I couldn't find the right syntax anywhere.
My goal is to retrieve a user's posts based on a specific message tag or text in their post message. Currently, the only way I know how to do this is highly inefficient. I would have to do the following:
Get user's full list of posts
https://graph/facebook/com/{version}/{userID}/?fields=posts&access_token={token}
Run a coded query to get the posts I need and discard the rest
Thanks in advance.

Related

How to retrieve specific user's posts on a page using graph api

I want to retrieve the posts on a page's wall but only of a particular user. I am unable to query the graph api with filter. Please help
There is no such filtering available. If you need this, you will have to do the filtering on your end.
You will either have to go through the page's feed and check the from field of the posts for the user id, or through the user's posts (requires that you get user_posts permission from the user first) checking the to field for the page id.

How to get general data from facebook graph api

I'm looking into the facebook graph api. I understand that I can retrieve information about a facebook web page by making a get with the current id. It's also clear that after retrieving a access token I can post on the logged in users wall and do other operations.
But what if I want more general data? Can I, for example, get how many swedish user who have used the word "Obama" in their status update the last week?
I don't think that the current search API can be that specific. You can find everything about the search API in this document.

How To Get Historical "Facebook Page Likes" Data via Graph API or FQL

Was wondering if anyone knows how to get the historical data for any Facebook Page.
For example, number of fans for RedBull fan page on a given day in the past or for a given period that ends today so that I can show fan development of any page over a given period.
I tried it with the graph API and FQL (insights) but no luck.
https://graph.facebook.com/{USERNAME}/insights?fields=likes&period('week')&end_time_date('2011-06-26') --> empty result
Pulling the data via FQL also returns no results, plus it seems without a read_insights permission nothing is possible for page data
I'd need this to be available with only a generic user access token. This data is publicly available anyway. Result should be somewhat like this: http://www.socialbakers.com/facebook-pages/australia/
https://graph.facebook.com/{{pagename}}/insights/page_views?access_token={{access_token_key}}&since=1420070400&until=1421625600
Since & until parameter in the above code takes in unix time.
add necessary information in the {{ }} and this code should work.
Without insight permission I recommend that you write something to perform a nightly query on the page graph and record the stats you need. If the page is public most of the information shown on that site is available.
You could also scrape info from http://pagedata.appdata.com if the page has already been listed...

Is the list of cities that can be set for current city or hometown available?

It doesn't look like the input that FB uses for current city and hometown is available as a widget or dialog for developers to use. I'd like to create an autocomplete input field that uses the same names for cities and the corresponding ID's. There's the lists of the cities that FB publishes for post and ad targeting but that is incomplete and appears to be using a different ID space; I'd like the same cities and IDs that are available to users when they edit their current city on their profile. Using jquery to do the autocomplete part is doable but I just can't find an API or data source available to populate it.
Does anybody know how to access that data from the graph API, fql or any other Facebook sanctioned means?
I havn't seen a graph api or fql method for this. The best I have seen from Facebook is this list: https://www.facebook.com/ads/api/autocomplete_data.php which you would want to parse and cache the json since its a pretty big download. If you needed more details about the location, you could call the graph api by the id provided in that file.

GRAPH API - retrieve Posts on a fan page

I am using the Graph API in order to obtain public posts which contain the keyword passed as query parameter (the call syntax is like this :
https://graph.facebook.com/search?type=post&q=%22bwatcher%22&limit=50`)
By reading the results, I think that I only retrieve public statuses.
I wonder if it is possible to obtain some posts on a fan page or a group (considering that the fan page and the groups are public)?
Updated edit from OP
What I would like to know is that if there are conditions or parameters that make the publications on a page fan wall or on a group wall available by querying the graph API ? (Is there a number of fans required, a number of group members ? Are there some privacy settings which make publications unavailable thanks to the graph API ? Are there page fan categories for which publications are avalaible are others for which they are unavailable ? etc...).
Yes, if you have the object id then you can just get the feed and other connections for it. It needs an access token though, so you have to authorize a user for it.
http://developers.facebook.com/docs/reference/api/page/