views:

398

answers:

3

Is there a way with the Facebook Graph API to get a list of all events created by a single profile? Our client creates a bunch of events and we want to pull a list of them all. I said that they would just have to make sure they set themselves to be attending the event, because then I can easily pull the list of events that profileId is attending, but I'm curious if there's another way. Maybe an FQL query? They look to require a query on the primary key though. And what would that FQL query look like if that's the way to do it??

A: 

Here are docs for that along with examples:

http://developers.facebook.com/docs/api

Also see the section under:

Publishing to Facebook

Sarfraz
I've already looked through the official docs heavily and haven't seen what I had a question about.
jwynveen
A: 

This is one of those "there's no good way to get there from here" problems. You can't use FQL, because the creator column isn't indexed. The best solution I can think of at the moment would be using the Graph API to query the events connection of the creator, and filtering out any events that they aren't the creator for. This won't be terribly efficient, since you'll be downloading info about all the user's events, even the ones they didn't create. So, I'd experiment with breaking it down into two queries:

graph.facebook.com/[user_id]/events?fields=id,owner&limit=1000

and then once you've filtered out all the events they didn't create:

graph.facebook.com/?ids=[event_ids for the user's events]
Daniel Schaffer
You can use FQL, with a where eid in (select eid from event_member where uid=<...>) clause, as described by jcmoney.
Airsource Ltd
+3  A: 

You can use FQL. Just using the creator as your where clause does not work because the creator is not indexable. However a workaround is to include an indexable where clause and throw in the creator in addition. Ex:

SELECT eid, name, pic, creator FROM event WHERE eid IN (SELECT eid FROM event_member WHERE uid=12345) AND creator=12345

jcmoney