Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting only those Facebook events which haven't expired graph api

I am trying to get only those facebook events that haven't expired yet(Upcoming events).

When i use the following query i get all the events including those that have expired long ago.

FBRequestConnection startWithGraphPath:@"/me/events"
                                     parameters:nil
                                     HTTPMethod:@"GET"
like image 953
Win Coder Avatar asked Dec 02 '14 06:12

Win Coder


2 Answers

You can make use of the since parameter as described in

  • https://developers.facebook.com/docs/graph-api/reference/v2.2/user/events/#read
  • https://developers.facebook.com/docs/graph-api/using-graph-api#paging

if you set the timestamp to the current time, you should only see future events:

/me/events?since=1417508443
like image 160
Tobi Avatar answered Nov 02 '22 10:11

Tobi


You can use time_filter=enum{upcoming,past}. e.g. if you want upcoming events that have not expired yet, send a request like this

/page_name_or_id/events?time_filter=upcoming

In this way you don't have to handle timezone issues as with since=timestamp query.

like image 21
Zohaib Ijaz Avatar answered Nov 02 '22 08:11

Zohaib Ijaz