Question

I am testing my new iframe app,

trying to get all events of an user, using the graph api.

$tempevent = $facebook->api('/me/events', 'get', array("fields"=>"id, name, start_time"));

so it only returns 25 events .. the farthest events.

Any ideas?

Just checked out the JS-Version.. same result.

FB.api('/me/events', function(response) {
    console.log("event id: " + response.data[0].id); //k
    console.log("event id: " + response.data[24].id);  //k 
    console.log("event id: " + response.data[25].id); //not k 
});
Was it helpful?

Solution

Use FQL:

$tempevent = $this->facebook->api(array(
    'method' => 'fql.query',
    'query' => 'SELECT eid, name, start_time FROM event WHERE eid IN (SELECT eid FROM event_member WHERE uid = me())'
));  

Explanation:
Here you are getting all the events from the event table where the event id (eid) is IN the event_member table where the user me() is linked to, whether he is attending, unsure, declined, or not_replied.

OTHER TIPS

I recomment you try to access the following URL https://graph.facebook.com/me/events?access_token=YOUR_ACCESS_TOKEN. Scroll down. You will see that facebook returns paginated results. Beside the data param (which is returned by the sdk) you have another paging param. This one contains links to more results, called next and previous. Use them to retrieve more events.

Also, if you want to retrieve more events per page you can add the limit param among access_token. For example: https://graph.facebook.com/me/events?access_token=YOUR_ACCESS_TOKEN&limit=50.

Good luck.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top