0

This is an extension of this question here: Getting Facebook Events using fql

I am running into the problem when there is no location/venue set for the events.

Here is the query I am using:

{\"events\":
    \"SELECT eid, name,description, start_time, end_time, pic_small,pic_big, eid,venue,location 
      from event WHERE eid in (SELECT eid FROM event_member WHERE uid = me() 
      and start_time > %s)\" ,
 \"locations\":
     \"select page_id,location from page where page_id IN 
     (select venue.id from #events)\" ,
  \"rsvpStatus\":
     \"select eid, rsvp_status from event_member where eid IN 
      (select eid from #events) AND uid = me()\" }

My observation : when there is location set for this event, the venue atttibute is a json object with and id property. Please refer below json

 {
          "eid": 34343434322,
          "name": "Another yo you",
          "description": "",
          "start_time": 1347699600,
          "end_time": 1347786000,
          "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",
          "venue": {
            "id": 34243242
          },
          "location": "Airbiquity"
        }

When there is no location set, it is an empty array. Please refer below json.

{
          "eid": 441320552577649,
          "name": "Meeting",
          "description": "",
          "start_time": 1347491700,
          "end_time": 1347502500,
          "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",
          "venue": [

          ],
          "location": null
        }

It's weird that the type of the venue attribute changes. I am GSON to convert this response for Java object and it's throwing off due to unepected structure for venue. Can someone help me with this issue?

Community
  • 1
  • 1
akd
  • 1,427
  • 3
  • 16
  • 21

1 Answers1

1

Facebook's treatment of venues has changed this past May. There are several different situations I've get returned by the API, depending on when and how the event was created.

  1. The id of a known venue is returned.
  2. The venue field is blank and an arbitrary location string is returned.
  3. Venue contains an array of information about the event venue, but no id.

Unfortunately, your script has to deal with all of these cases and be ready for whatever future cases the Facebook engineers may come up with.

cpilko
  • 11,792
  • 2
  • 31
  • 45