Retrieve events hosted by a group with FQL - facebook

I would like to know how do events hosted by a group connect to that group so I can retrieve all events from a specific group (all I have the group id).
This needs to be done using FQL and PHP SDK (I know my way with these, but I am unable to find anything about connections between groups and events).

Meanwhile, GROUP_ID/events works pretty well for me here.
It was possible with REST API if you look at this:
http://developers.facebook.com/docs/reference/rest/events.get/
They say:
"The uid can be replaced by gid in order to get events hosted by a group instead of by an individual user."
I tried to get events of groups I have joined via the Graph API Explorer and it worked as well as a little restFB (Java) implementation I made.
So, could it be a permission issue at your site?

Doesn't look like you can pull that off.
The documentation of the Group object does not mention a collection of events, and if you try to get /GROUPID/events from the graph api you get an error saying "Unsupported get request".
The fql documentation of the group table also has nothing on events, and the event table is only indexed by the event id which means that there's no way to connect between events and groups.

Up until a couple of weeks ago the following would do exactly what you need
SELECT name FROM event WHERE eid IN
(SELECT eid FROM event_member WHERE uid = <uid from group>)
but the api changed to using group objects so the code does not work anymore. Sadly, I have not found another way to get the events from a specific group.

Facebook has broken this one before. : (
Will see if I can trace down how we got it fixed last time.
In the mean time, the closest I could get is:
https://graph.facebook.com/fql?q=SELECT eid, name, host FROM event WHERE eid IN (SELECT eid FROM event_member WHERE uid = $uid AND start_time > 0) AND host = '$group_name'&access_token=$token
Variables:
$uid = uid of a group admin
$group_name = name of the group
$token = access token for the above group admin with user_events permission
Only downsides I can see are:
An auth token is required (even for a public group); and
The admin used must be invited to all events (this is usually the case anyway). If the admin isn't invited, it appears that the event won't show up.
Update: Facebook bug report - please add your support so we can get this fixed:
http://developers.facebook.com/bugs/197158423732088

Try the updated Wallflux-events: http://wallflux.com/events/115227675156013

Related

github users API Paging not work

when using github users api to return users data through
https://api.github.com/users?page=6&per_page=2
return the same data every one although change page parameter value and per_page
why this and how to fix to change different data
i try to edit header request and add this header
Name Link
Value <https://api.github.com/users?page=1&per_page=2>; rel="next",<https://api.github.com/users?page=50&per_page=2>; rel="last"
But Still not working
After my search
now Github use API V3 and if you want return users with paging you can use this
https://api.github.com/users?since=1&per_page=100
Instead of using "page" and "per_page", that endpoint uses "since" and "per_page".
The since parameter says from which user ID the API should start listing users. For example:
https://api.github.com/users?since=1&per_page=100
will start listing users from the user with ID 1, and
https://api.github.com/users?since=10001&per_page=100
will start listing users from the user with ID 10001.

Facebook graph API: Filter status from feed

I use
http://graph.facebook.com/cocacola/feed?access_token=MY_APP_TOKEN
This works but I would like to exclude the status updates from the result and only get links,photos and videos. There seems to be a filter function as listed here: https://developers.facebook.com/docs/graph-api/reference/v2.0/user/feed
But I don't get how to use it :-(
...cocacola is just an example of course...
I also couldn't get it to work with the Graph API itself, because the docs lack (again) details on how to use it.
You can use FQL to achieve what you desire instead:
select post_id, message, attachment from stream where source_id=me() and type in (80,128,247) limit 50
This will return your 50 most recently posted links, videos and photos. Remember that you'll need read_stream permissions if you access user info. For public page posts, this should be fine without.
Try it: https://developers.facebook.com/tools/explorer?fql=select%20post_id%2C%20message%2C%20attachment%20from%20stream%20where%20source_id%3Dme()%20and%20type%20in%20(80%2C128%2C247)%20limit%2050%0A%0A
To change the subject of the query, change the source_id object_id. For CocaCola, this would be 40796308305 (https://developers.facebook.com/tools/explorer?method=GET&path=cocacola%3Ffields%3Did&version=v2.0).

Facebook Graph API does not return all of the events

Not really sure what happened, but Facebook does not want to return all of the events for a group anymore. It is just returning one last one. The thing is that it was returning everything before, but now just one event. I don't know whether I changed somehing for the permissions or group settings..
Here's the Graph API query I have:
https://graph.facebook.com/[group_id]/events?since=1349654400&fields=name,start_time,location,id,description,picture&access_token=[token]
I included a since parameter that goes back to 2012, but still only get 1 event.
If I go to the FB group page, I can see a list of the events, so they are there..
any idea why this is happening?
EDIT:
The FQL query does return all of the events:
SELECT eid, name, description, pic_big, start_time, end_time, location
FROM event WHERE creator = [group_id]
Makes me even more confusing as to why graph API query is not working
In the Graph API query, try using the limit parameter also.
sometimes you just need to tell graph-API that you want ALL the results. you may need to set the limit of returned results to a bigger number.
try this:
GET /v2.5/[group id]/events?limit=10000 HTTP/1.1
Host: graph.facebook.com
also, try changing both "since" and "until"

get Facebook Group Id using identifier or url

I would like to get a facebook group id by using a URL or specific identifier.
For ex: http://www.facebook.com/groups/chennaifoodies/ should give group id 194462073956868.
Is there way to get the group id by using above URL or identifiers like 'chennaifoodies'?
If I tried https://graph.facebook.com/chennaifoodies, then it gives the fan page id.
I think 'wallflux' has done a wonderful script, so I need a script like that to get group the id.
is there any way to get a group id using graph api or fql?
Thanks.
I don't think you can get the Group ID from the url you mentioned with the group username.
But, you surely can get the same with the url:
http://graph.facebook.com/search?q=chennaifoodies&type=group&access_token=ACCESS_TOKEN
Yes, you'll be needing an active user access token to query this.
Or, the graph API (the same thing)-
/search?q=chennaifoodies
Demo

Facebook: What is the correct way to post a checkin and view checked in friends using the latest API?

/me/checkins is deprecated and no longer works however with the latest API me/feed specifying the place its impossible to post a checkin that can be read back using this query:
me/friends?fields=checkins.limit(1).fields(from,message,place.fields(id,name,location,likes,website,phone,description,checkins),tags)
This graph API will only show checkins created using the old API:
/me/checkins
What is the correct way of specifying a checkin when posting to me/feed and viewing your friends checkins?
So far the only solution for retrieving checked in friends details that I can get to work is:
SELECT source_id, created_time, message, attachment, message_tags, place FROM stream WHERE (source_id IN (SELECT uid2 FROM friend WHERE uid1=me())) AND (with_location=1) AND (created_time>????)
However, I think its unacceptable because it will often return more data than necessary. There doesn't seem to be a way using FQL to limit the query to return only the first record for each source_id
I'm not sure what you mean, you started your question stating /me/checkins is deprecated so why would you query from it here as a field expansion
me/friends?fields=checkins.limit(1).fields(from,message,place.fields(id,name,location,likes,website,phone,description,checkins),tags)
Use location instead.
When retrieving location information via the /locations connection on the User object, or via the location_post FQL table, return Checkin objects prior to February 20, 2011 along with Statuses when you request the user_status permission (newer Checkins are automatically included). Without this migration enabled, you'll have to request user_checkins separately to retrieve these older Checkins.
https://developers.facebook.com/roadmap/status_checkin_perm_migration_migration/
The behavior of Checkins is affected by the "Include Checkins with Statuses" migration setting.
https://developers.facebook.com/docs/reference/api/checkin/