I am learning how to use search on the Facebook Graph API.
I want to format a query that will return all Facebook pages in the category Musician/Band.
Condsider the public page for The Beatles (https://graph.facebook.com/thebeatles), you can clearly see it as a category here.
So far, as I understand it v2.1 of the Graph API does not accept search by category, and I need to use v2.0 FQL. Is this correct?
If so, what would the correct syntax for the following pseudocode:
SEARCH ALL PAGES WITH CATEGORY='MUSCIAN/BAND'.
There's no way to search Pages by Category unfortunately.
The query
select page_id, name from page where categories.name = 'Musician/Band'
fails with
{
"error": {
"message": "(#604) Your statement is not indexable. The WHERE clause must contain an indexable column. Such columns are marked with * in the tables linked from http://developers.facebook.com/docs/reference/fql ",
"type": "OAuthException",
"code": 604
}
}
although the categories.name is marked as indexable (https://developers.facebook.com/docs/reference/fql/page/)
Related
FQL requests fail since wednesday. I have no clue why since FQL is supposed to be deprecated only at the end of April.
Basically, here is the type of requests that worked until wednesday :
https://graph.facebook.com/89240001803405/fql?access_token=<access_code>&q=select+is_published%2C+talking_about_count%2C+access_token%2C+description%2C+emails%2C+fan_count%2C+general_info%2C+location%2C+page_url%2C+pic_square%2C+username%2C+page_id%2Cname+from+page+WHERE+page_id+IN+%28SELECT+page_id+FROM+page_admin+where+uid+%3D+89240001803405%29
And here is the current response :
{
"error": {
"message": "(#100) Tried accessing nonexisting field (fql) on node type (User)",
"type": "OAuthException",
"code": 100
}
}
Any idea how I can fix this before I migrate de non FQL ?
Thanks
The user id you have in there before the fql part is wrong, as far as I know. If that has worked before, then rather by accident, I guess.
FQL calls via API endpoint should be of the form https://graph.facebook.com/fql?q=… – the identifier fql as first path segment, follow by parameters such as q for the query, the access token and what else might be appropriate.
Specifying the user id first doesn’t make sense, because what data you want to select you define inside the query itself.
I'm trying to query the created time for a facebook link by executing the following fql question
SELECT created_time FROM link WHERE owner = me()
according to the developers documentation (https://developers.facebook.com/docs/reference/fql/link) the owner field is indexed but the graph api throws the following exception.
{
"error": {
"message": "Your statement is not indexable. The WHERE clause must contain an indexable column. Such columns are marked with * in the tables linked from http://developers.facebook.com/docs/reference/fql ",
"type": "NoIndexFunctionException",
"code": 604
}
}
what is wrong with my query?
Select the FQL Query button above the text box on the Graph API Explorer and it works fine. The links go to the Graph API editor instead of the FQL editor, which is wrong.
Example
I only know the email, first name and last name of a person. Is it possible to get the User ID through FQL? Thank you.
The columns which u are having from the user table in facebook are not indexable. For fetching using the where clause u must have a indexable column. If u will try with these columns u will get the following error
{
"error": {
"message": "Your statement is not indexable. The WHERE clause must contain an indexable column. Such columns are marked with * in the tables linked from http://developers.facebook.com/docs/reference/fql ",
"type": "NoIndexFunctionException",
"code": 604
}
}
So for getting User ID you need to have any of the indexable columns.
I would like to know how to get a list of id facebook's user from my current location,
I just did that SELECT uid , current_location FROM user WHERE current_location = '115175415163151'
but I get the next error
"{
"error": {
"message": "Your statement is not indexable. The WHERE clause must contain an indexable column. Such columns are marked with * in the tables linked from http://developers.facebook.com/docs/reference/fql ",
"type": "NoIndexFunctionException",
"code": 604
}
}"
Sadly you just cannot get User's location as it requires either user_location or friends_location , quoting from User documentation that means you just can't retrieve any User's location without User allowing you the required permission.
Secondly you cannot query on fql without using an indexable column in WHERE clause, quoting from fql documentation
Your query must also be indexable, meaning that it queries properties that are marked as indexable in the documentation below.
I'm trying to get demographics for fans of a page on Facebook - mostly country and city, but age and gender as secondary.
The primary way to do it is using FQL and doing a query in the insights table. Like so:
FB.api({
method: 'fql.query',
query: "SELECT metric, value FROM insights WHERE object_id='288162265211' AND metric='page_fans_city' AND end_time=end_time_date('2011-04-16') AND period=period('lifetime')"
}, callback);
The problem with this, however, is that the table returns a maximum of 19 records only, both for the country and the city stats. The response for a page I'm testing is as such:
[
{
"metric": "page_fans_city",
"value": {
"dallas": "12345",
"atlanta": "12340",
(...)
"miami": "12300"
}
}
]
So I'd like to know if there's any alternative to that -- to get demographics of the current fans of a page (no snapshot necessary).
Things I've tried:
Using LIMIT and OFFSET on the query do nothing (other than, sometimes, give me an empty list).
One alternative that has been discussed in the past is to use the "/members" method from the Graph API (more here) to get a list of all users, and then parse through that list. That simply doesn't work - a method exists, and it may have worked in the past, but it's not valid anymore (disabled?).
Request:
https://graph.facebook.com/platform/members?access_token=...
Response:
{"error":
{
"type":"OAuthException",
"message":"(#604) Your statement is not indexable. The WHERE clause must contain an indexable column. Such columns are marked with * in the tables linked from http:\/\/developers.facebook.com\/docs\/reference\/fql "
}}
Other solution was to do a query to the page_fan table and filtering by page_id. This doesn't work, either; it may have worked in the past, but now it says that the page_id column is not indexable therefore it cannot be used (same error as above, which leads me to believe /members uses the same internal API that has been disabled). Page_fan query is only useful to check if individual users are fans of a page.
There's also the like table, but that's only useful for Facebook items (like posts, photos, links, etc), and not Facebook Pages.
Going to the insights website about the Page, you can see the data in some nice graphs and tables, and download an Excel/CSV spreadsheet with the historic demographics data... however, it also limits the data to 19 entries (sometimes 20 with a few holes in there as cities trade top positions though).
Any other hint on how to get that data? I'd either like the insights query with more results, or at least a way to get all the page fans so I could do the location query myself later (even if the page I want to get it from has almost 5 million fans... gulp).
The data pipeline for this metric is currently limited to 20 items. This is a popular feature request and something Facebook hopes to improve soon.