Query of past events for a "like" page is not returning full list (as shown on actual page) - facebook-fql

The code used to query (below) has not changed since before it was working correctly, but the page suddenly started only displaying one of the many past events. Has the functionality of the QL changed in some way or is this just a bug that I should wait and see if it passes?
SELECT name, pic, start_time, end_time, location, description, eid
FROM event
WHERE end_time < now()
AND eid IN (
SELECT eid
FROM event_member
WHERE uid = XXXXXXXXX )
ORDER BY start_time DESC

I'm not totally sure, but FQL's documentation on event_member might be the key. Have you attempted running only the internal query (SELECT eid FROM event_member WHERE uid = XXXXXXXXX) alone without the wrapper to see what it's returning?
FQL documentation for event_member states that
If you do not specify a start_time, only events in the future will be returned.
EDIT: I take this to mean that you may, currently, need to specify start_time < now() in there, or something of the like.
(Though, if that's case, I'm not sure why you're even getting the one item returned because that would conflict with your end_time < now() statement).
My first suggestion might be to spit it into multiple queries using FQL multiquery and make sure that the event_member query is returning what you'd expect.
Something like:
"event_members":"SELECT eid
FROM event_member
WHERE uid = XXXXXXXXX"
"events":"SELECT name, pic, start_time, end_time, location, description, eid
FROM event
WHERE end_time < now()
AND eid IN (SELECT eid FROM #event_members)
ORDER BY start_time DESC"
See that event_members holds all the entries you're hoping for - if so, find the issue in the 'events' query, if not, find the issue in the 'event_members' query.

Related

Can I get the creator of an facebook event's profile pic, using FQL?

I need to use the following fql to also get the creator's profile pic of an event. The creator column only returns their id, but i'm not sure if there's a way to do both of this nested queries.
SELECT eid, name, location, creator FROM event WHERE eid IN (SELECT eid FROM event_member WHERE uid = me())
First you make sure want you want to retrieve.
If you want the name and profile picture of the creator of an event you are in you can use below code:
SELECT name,pic_big FROM user WHERE uid IN (SELECT creator FROM event WHERE eid IN (SELECT eid FROM event_member WHERE uid = me()))
But if you need event details also (as you already have that fql) you need to query two separate queries it cannot be done using nested queries

Get Facebook Events I don't Own

I am building a site that needs to query Facebook events. I need a list of events I do own, and list of events I don't own. The problem is that querying the Events object via FQL requires that I pass one of the indexable fields. Those are creator, name, and eid. This is fine when I need my events (creator = me()). However, when I need events I don't own I can't seem to use a SQL like statement in (creator <> me()).
Any suggestions on how to do this?
SELECT name,start_time,end_time,location,eid,pic,description FROM event where creator = me() and start_time >= 1370106582
It's not as straightforward as I would like but this query works.
SELECT name,start_time,end_time,location,eid,pic,description FROM event where eid IN
(SELECT eid FROM event_member WHERE uid = {UserId} and inviter and rsvp_status = 'attending')
If you query for event_member by the Users Id the Inviter field with be null for events in which they are the owner. In FQL if you just add 'Where {field}' in a where clause, it returns all the results in which that field's value is not null. I know that's a bit confusing but it works.

FQL multiquery with event CREATOR does not work anymore

I got several iOS apps that make an FQL multiquery to get infos about events by a certain creator.
query1: "SELECT eid, uid FROM event_member WHERE uid = %#"
query2: "SELECT eid, name, venue, location, start_time, creator FROM event WHERE eid IN (SELECT eid FROM #query1) AND start_time>%# AND creator = %#"
up until yesterday, March 12th 2013 this worked just fine.
Now it returns an "unknown error".
if i change query2 to
"SELECT eid, name, venue, location, start_time, creator FROM event WHERE eid IN (SELECT eid FROM #query1) AND start_time>%#"
it works again, but obviously i would have to update all apps to change this query, and i would love to circumvent this.
Is this by design?

Filter facebook events on date in FQL

I'm using a fairly simple FQL-query to query all the events by a page.
SELECT
eid, name, pic_big, start_time, end_time, location, description
, creator, host, venue
FROM
event
WHERE
eid IN ( SELECT eid FROM event_member WHERE uid = {$uid} )
ORDER BY start_time asc
In the time facebook stored it's start_time and end_time in timestamps it was simple to get only future events: ... AND end_time >= {$now} ...
But facebook changed it's fields in timezone format.
Is there an easy way, preferably in fql, to only show the future events?
Unless I'm misunderstanding your problem, I just tried this out on the Facebook Graph API & FQL Explorer and it appeared to work.
The only changes I made to your query was to replace {$uid}and {$now} with me() and now() respectively. The following query returned only future events for my account:
SELECT eid, name, pic_big, start_time, end_time, location, description, creator, host, venue
FROM event
WHERE eid
IN (SELECT eid FROM event_member WHERE uid = me())
AND start_time >= now()
You can view this in action at: Facebook Graph API Explorer Example
And of course be sure you provide the Explorer with a valid access token for your account.

Facebook API: how to get event details

Trying to get the details of all events me/my friends are attending/maybe attending in the coming month (date manipulations in the FQL).
I am also in need of getting those events' feeds for further analysis in my program.
So far I found Facebook API's documentation hardly any helpful.
You can use the event and event_member tables in conjunction with the friend table to get this data.
Eg:
SELECT eid, name, location, start_time FROM event WHERE eid in ( select eid from event_member where rsvp_status != 'declined' and uid = me() or uid in (select uid2 from friend where uid1 = me()) ) AND start_time >= '2012-08-01' and start_time <= '2012-08-31'