简体   繁体   English

使用FQL的Facebook活动

[英]Facebook events using fql

This is an extension of this question here: Getting Facebook Events using fql 这是此问题的扩展: 使用fql获取Facebook活动

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. 我的观察:当为此事件设置位置时,场所atttibute是具有和id属性的json对象。 Please refer below json 请参考下面的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. 请参考下面的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. 我是GSON,它将此响应转换为Java对象,并且由于场地的结构不正确而被取消。 Can someone help me with this issue? 有人可以帮我解决这个问题吗?

Facebook's treatment of venues has changed this past May. 今年五月,Facebook对场馆的待遇发生了变化。 There are several different situations I've get returned by the API, depending on when and how the event was created. API会返回几种不同的情况,具体取决于创建事件的时间和方式。

  1. The id of a known venue is returned. 返回已知场地的ID。
  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. 地点包含有关活动地点的一系列信息,但没有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. 不幸的是,您的脚本必须处理所有这些情况,并为Facebook工程师将来可能遇到的任何情况做好准备。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM