I'm developing an app that retrieves events via FQL from facebook Pages.
it happens sometimes that the owners of these pages do not create these events from the Page profile, but from their own profile and just link the event to the page as the field Venue (since the pages I'm looking for are public places)
is it possible via FQL or any other mean to get all the events ID that have as venue a specific facebook page ID??
now i can get all the events only if the page owners insert the events via the page profile with the following code:
$fql = "SELECT eid, creator, name, pic, timezone, start_time, end_time, location, description
FROM event WHERE eid IN ( SELECT eid FROM event_member WHERE uid IN ($clubsstring) )
AND start_time > $today
AND start_time < $nextweek
ORDER BY start_time asc";
$param = array(
'method' => 'fql.query',
'query' => $fql,
'callback' => ''
);
$fqlResult = $facebook->api($param);
thanks
Luca
Well, you can indeed search based on venues, but that can only be a secondary condition since the venue field is not indexable.
This means that you first have to search based on eid (the only indexable field in the Event table), and then filter those results based on the venue.
The problem is that the venue field is an array, and the fields in it are not always there, for example one event might have this as venue:
"venue": {
"id": VENUE_ID
}
But another will have:
"venue": {
"street": "",
"city": "",
"state": "",
"country": ""
}
You should be able to get what you want with something like:
SELECT eid, creator, name, pic, timezone, start_time, end_time, location, description
FROM event
WHERE
((eid IN (SELECT eid FROM event_member WHERE uid IN ($clubsstring)))
OR
(eid IN (SELECT eid FROM event_member WHERE uid IN (OWNERS_IDS_STRING)))
AND
venue.id IN (VENUE_IDS_STRING))
AND start_time > $today
AND start_time < $nextweek
ORDER BY start_time asc;
I haven't tested this query, and you might need to modify it a bit to work, also you can use a different field of venue other than the id.
Hope this helps.
I use this, it´s currently working.
{"eventos":"SELECT start_time, end_time, name, eid, pic,venue.id, location, creator, description
FROM event WHERE eid IN (SELECT eid FROM event_member WHERE uid IN ( SELECT uid2 FROM friend WHERE uid1=me() LIMIT 150)
OR uid = me() AND rsvp_status = 'attending') AND venue.id <>''
AND location <> '' AND location <> '#data'","lugares":"SELECT latitude,longitude
FROM place WHERE page_id IN (SELECT venue.id FROM #eventos)"}
Related
When I execute the following FQL query
SELECT uid, rsvp_status FROM event_member WHERE uid = me()
I get a list of events I'm attending. When I execute either of the following FQL querys
SELECT uid, rsvp_status FROM event_member WHERE uid = "{my uid written out}"
SELECT uid, rsvp_status FROM event_member WHERE uid IN ("{my uid written out}")
I get the following empty object
{"data": []}
I want to query for my friends public events using. When I trying to do this using either of the following queries
SELECT uid, rsvp_status FROM event_member WHERE uid = "{my friends uid written out}"
SELECT uid, rsvp_status FROM event_member WHERE uid IN ("{my friends uid written out}")
I once again get the following empty object
{"data": []}
Any suggestions?
I have a question about FQL query.
I can not take the Owner information of an event:
I get this error:
"error": {
"message": "(#602) owner is not a member of the event table.",
"type": "OAuthException",
"code": 602
}
For example for this query:
SELECT name,description, owner.id from event
WHERE eid in (SELECT eid FROM event_member WHERE uid = me()
AND start_time > '2013-02-23T00:20:00')
This happens exactly because owner is not a member of the event table. See http://developers.facebook.com/docs/reference/fql/event
But you can use field creator to find creator of the event, thus, your query will become
SELECT name,description, creator from event
WHERE eid in (SELECT eid FROM event_member WHERE uid = me()
AND start_time > '2013-02-23T00:20:00')
Trying to retrieve facebook events through fql using the query below. I am unable to get venue details other than "id".
fql?q=SELECT name,description, pic_small,pic_big, eid,venue,location from event WHERE eid in (SELECT eid FROM event_member WHERE uid = me())
output :
{
"data": [
{
"name": "HappyHour",
"description": "Let's have fun !!!",
"pic_small": "http://profile.ak.fbcdn.net/static-ak/rsrc.php/v2/yy/r/XcB-JGXohjk.png",
"pic_big": "http://profile.ak.fbcdn.net/static-ak/rsrc.php/v2/yn/r/5uwzdFmIMKQ.png",
"eid": ......,
"venue": {
"id": .......
},
"location": "The Crab Pot Seattle"
}
]
}
The graph api doc says "The venue where the event being queried is being held. Contains one or more of the following fields: street, city, state, zip, country, latitude, and longitude." but I don't see any of these except venue id.
Do I have to make another request to graph API to get the venue location details? Is there a better way to get the location details in one query itself?
You can get the locations for events using this FQL Multiquery.
This will get your events and information about their venues. You'll have to write a script on your end to combine them into something usable.
fql?q={
"event_info":
"SELECT name,description, pic_small,pic_big, eid,venue,location
FROM event WHERE eid IN
(SELECT eid FROM event_member WHERE uid = me())",
"event_venue":
"SELECT name, username, page_id, location
FROM page WHERE page_id IN
(SELECT venue.id FROM #event_info)"
}
Facebook changed the default encoding for events sometime in April. It used to be that all location data always used to be returned. Since then only the id of the location has been returned.
I am getting Facebook comments data for particular posts using FQL. FQL returns only fromid however i need fromname as well. I am using batch request for getting comments of 50 posts at same time.
My query is
SELECT object_id,post_id,fromid,time,text,id,reply_xid,post_fbid,is_private FROM comment WHERE post_id='".$postID."'
How can I do this?
you need to make an additional query, something like this:
$multiQuery_postInfo = array(
"posts" => "SELECT post_id, actor_id, message, message_tags, likes, comments, share_count, attachment, action_links, type FROM stream WHERE source_id=$pageID",
"users" => "SELECT uid, username, first_name, last_name, profile_url, pic FROM user WHERE uid IN (SELECT actor_id FROM %23posts)"
);
I am trying to achieve the following via Facebook's Multiquery FQL, get a list of all Fan Page Events that i am 'Attending'.
I have the below logic, and have tried to implement something similar with the FQL statement below.
get list of all events created by / from a Fan Page (using specific id)
get a list of all my (the users) events attending
Match eid's from event_member FQL Table
If they match ids, and rsvp_status is equal to attending
display result.
FQL Multi
{"query1":"SELECT eid FROM event WHERE
eid IN (SELECT eid FROM event_member
WHERE uid
=$fanpageID)","query2":"SELECT rsvp_status FROM event_member WHERE
uid = $uidAND eid IN
(SELECT eid FROM #query1)"}
I know the statement is incorrect, but i am struggling on trying to do this. I have achieved this via Graph API using a very messy set of foreach loops in my PHP code.
Using a single multiquery FQL statement would be far more efficient.
Any suggestions would be great.
EDIT
Problem im having now, is ifaour's FQL statement works within the FQL Query console (Returns Results), however when i run the following, and empty array is returned.
When i dissect the statement to just ( SELECT eid FROM event WHERE creator =$fanPageID) the FQL Console highlights that eid in non indexable.
Here is my PHP
function usersEventsPoints($uid,
$facebook, $fanpageID){
$events = "SELECT eid FROM event WHERE creator=$fanpageID AND eid
IN (SELECT eid FROM event_member WHERE
uid=$uid AND rsvp_status =
\"attending\")";
$eventsAttendance = $facebook->api(array(
'method' => 'fql.query',
'query' =>$events, ));
$eventsAttendingcount = 0;
foreach
($eventsAttendance as $eventsAttendanceFetch) {
if($eventsAttendanceFetch['eid'] == true){
$eventsAttendingcount++;
}
}
return $eventsAttendingcount;
}
Blockquote
Any Ideas?
It's a very simple task:
SELECT eid FROM event WHERE creator = $fanpageID AND eid IN (SELECT eid FROM event_member WHERE uid = me() AND rsvp_status = "attending")
This will return all events' Ids that are created/owned by the page that has $fanpageID id and you are a member in (me()) and your status is attending.
EDIT:
You are looping the returned array just to get the count?! you can simply use:
$eventsAttendingcount = count($eventsAttendance);
Also make sure that the user you are matching, has authorized your application and granted you the correct permission!
I'm not sure I understand what the problem is - I ran your FQL statement and it returns a list of events and then your RSVP status?
On another note, why not use the events.get method. You pass in the UserId and it will display the event information for you. You can filter by RSVP status.
Just checked and the events.get method is in the process of being deprecated.
You should use the new Graph API which gives you a list of attendees for your event:
http://developers.facebook.com/docs/reference/api/event
You get the list of attendees by using
https://graph.facebook.com/EVENT_ID/attending
If you want to get the next 10 events of the facebook logged user where events are set a attending then you can build your Swift query like this:
let graphPath = "/me/events?limit=10&type=attending&since=now"
let params = ["fields": "id, name, category, start_time, end_time, timezone, updated_time, type, attending_count, owner, place"]
let request = GraphRequest(graphPath: graphPath, parameters: params, accessToken: accessToken, httpMethod: .GET, apiVersion: apiVersion)
request.start {}