2012-03-20 12 views
0

当我通过FB.api查询的Facebook具有以下:确定哪些字段和连接在一个FB.api查询返回

me/events 

在返回的JSON对象A JSON事件阵列具有用于字段的信息“名称“,”start_tile“,”end_time“,”位置“,”id“和”rsvp_status“。我知道我可以通过解析“id”字段并直接查询单个事件来获取有关其他字段和连接的信息(例如“图片”连接或“所有者”字段),但是有没有办法在初始查询,这样我可以避免额外的FB.api调用?

{ 
    "name": "Example Name", 
    "start_time": "2012-05-04T22:00:00", 
    "end_time": "2012-05-05T01:00:00", 
    "location": "Example Location", 
    "id": "xxxxxxxxxxxx", 
    "rsvp_status": "attending" 
} 

回答

0

https://developers.facebook.com/docs/reference/api/

自省

的图形API的支持对象的反省,使您能够 看到所有的对象具有不知道它的类型 领先的连接时间。要获取此信息,请将metadata = 1添加到对象 URL中,并且生成的JSON将包含元数据属性, 会列出给定对象的所有受支持连接。例如, 通过获取https://graph.facebook.com/331218348435?metadata=1,您可以看到开发者车库事件的所有连接超过 。这 输出:

{ 
    "name": "Facebook Developer Garage Austin - SXSW Edition", 
    "metadata": { 
     "connections": { 
     "feed": "https://graph.facebook.com/331218348435/feed", 
     "picture": "https://graph.facebook.com/331218348435/picture", 
     "invited": "https://graph.facebook.com/331218348435/invited", 
     "attending": "https://graph.facebook.com/331218348435/attending", 
     "maybe": "https://graph.facebook.com/331218348435/maybe", 
     "noreply": "https://graph.facebook.com/331218348435/noreply", 
     "declined": "https://graph.facebook.com/331218348435/declined" 
     } 
    } 
} 
+0

谢谢。您最初给出的答案也起作用,即在查询后添加所需字段(e.x. me/events?&fields = owner,picture,location) – 2012-03-21 06:52:34

相关问题