FQL or Facebook API: Get only my events created - facebook-fql

i have this query:
select eid from event where creator = 100000956216009
Return this error:
error: 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://wiki.developers.facebook.com/index.php/FQL_Tables
How i can get all My Created events? TIA
I need to print my events created on my fb account and print it on my External Site.

solved, my problem is the permission:
https://developers.facebook.com/docs/reference/api/permissions/

You should read http://developers.facebook.com/docs/reference/rest/events.get

Related

Search facebook group using the name as a search term on Facebook FQL

I've tried using the Facebook Graph API. But the results came out, it did not show up to 150 groups. I'm not sure that it is a limitation of Facebook or not.
An example URL that I tested.
Now, I would like to test the FQL Query. But did not succeed. I have the following error
(#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
This is a SQL statement
SELECT gid, name, privacy FROM group WHERE strpos(name, "programming") >= 0

Use Facebook API to list group members' join date and inviter

I can use the Facebook Graph API to get a list of group members. The simplest way to do this is to go to the Graph API Explorer and do a GET request of the form {group_id}/members. Is there a way to similarly obtain the members' join date and who they were invited by?
The relevant Graph API doc doesn't seem to mention it. But I know the information is stored by Facebook because it is possible to list all of the group members and their inviters through Facebook itself. Is there a way to get this information through the API?
EDIT: Nothing in the FQL group or group_member API either.
While this information is not available on the API, you can get it by using Selenium to scrape the members page.
First, instantiate a driver and use it to get the members page:
driver.gethttps://www.facebook.com/groups/your group number/members
Then, look for the member information:
containers = driver.find_elements_by_tag_name('td')
Finally, iterate through the web elements, extracting text and parsing resulting list for joined date information:
member_info = container.text.split('\n')
name = member_info[0]
member_since = member_info[-1]
You'll still have to map this information to the user ids, which you can do by looking for another element in the container and using REGEX.
`def parse_id(self, container, name):
hovercard = container.find_element_by_link_text(name).get_attribute('data-hovercard')
regex_id = re.compile('php\?id=(\d*)')
member_id = regex_id.search(hovercard).group(1)
return member_id`
It is indeed stored by Facebook and retrieved for use with internal APIs. For the Graph API however it is not possible to get this information.
All the fields available for a group_member are listed at SELECT column_name FROM column WHERE table_name = "group_member"

FQL NoIndexFunctionException on indexed field

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

FQL search public posts

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

Get a list of events owned by a facebook page

Does anyone know how I can get a list of events owned (created) by a Facebook page?
I seem to be able to use the "graph api" to generate a list of the events an entity is attending. I also looked at FQL, but it seems to require that the 'where' clause is an indexable field (and, naturally, the id is the only indexable field).
For bonus points, we'd be able to do this without any authentication. (Though I'm resigned to the fact that I'm likely going to need at least a permanent access_token.)
If anyone knows how to do this I'd be eternally grateful.
All FQL data access requires authentication, so forget about those "bonus points".
This is going to require some post-query handling as, like you said, the FQL WHERE clause only respects indexible fields and the owner.id field is not indexible. Thus, we first begin by identifying events the user is a "member" of and loading the owner information for those events.
SELECT id, name, owner.id FROM event WHERE id IN (SELECT eid FROM event_member WHERE uid = XXX)
Once the query returns a dataset, we must manually check for rows in which owner.id is equal to uid.
Looks like you have to first query the event_member table, using the uid
http://developers.facebook.com/docs/reference/fql/event_member
and then once you got the eid of the events you can query the events table where the eid is indexed
http://developers.facebook.com/docs/reference/fql/event
and I'm sure you can use the first as a subquery of the second query like var query = FB.Data.query("select name from event where eid in (select eid from event_member where uid = {0})", user_id);
This one does it
select eid from event where creator=".$facebookPageId." and eid in (select eid from event_member where uid=".$facebookPageId.") ORDER BY start_time DESC
This link has a good tutorial on FB events and many more on C#.
http://blog.impact-works.com/2011/07/
But he uses a dll which he created. But as soon as you get the idea out of the blog, you can use Facebook c# Sdk to develop whatever you want to develop.
And all these info is valid for you IFF you are developing in c# my friend.
use this get request
https://graph.facebook.com/'your facebook page ID'/events?access_token=' your application token'&limit='number of events wanted'&after=1&fields=owner,name,description,cover,id
first you must create a facebook application and get its "app token"
In the fileds column you can specify the details you want about the event using the names in facebook API https://developers.facebook.com/docs/graph-api/reference/event/