2013-02-20 38 views
1

Graph API中的某些收件箱邮件没有评论数组。注释是线程中的实际消息。 API用户是否无法使用这些消息?Facebook Graph API收件箱邮件无评论数组

例子:

{ 
    "unread": 0, 
    "to": { 
     "data": [ 
      { 
       "id": "666397291", 
       "name": "Miguel Paraz" 
      }, 
      { 
       "id": "xxxxxx", 
       "name": "xxxxxx" 
      } 
     ] 
    }, 
    "id": "56002435955", 
    "updated_time": "2013-01-19T06:33:59+0000", 
    "unseen": 0 
} 

的评论是那里当我打开Facebook网站或移动应用的收件箱。

当我尝试专门检索此线,我得到:

{ 
    "error": { 
    "message": "Unsupported get request.", 
    "type": "GraphMethodException", 
    "code": 100 
    } 
} 

回答

2

我有同样的问题,唯一的办法,我发现解决这个 - 而不是使用图形API FQL multiquery。使用此查询:

{ 
    'messages': 'SELECT body,created_time, author_id FROM message WHERE thread_id IN 
    (SELECT thread_id FROM thread WHERE folder_id = 0) and author_id != me() ORDER BY created_time DESC', 
    'names': 'SELECT uid, name FROM user WHERE uid IN (SELECT author_id FROM #messages)' 
    } 

retuns导致,这样的:

{ 
     "data": [ 
     { 
      "name": "messages", 
      "fql_result_set": [ 
      { 
       "body": "body of message", 
       "created_time": 1344741084, 
       "author_id": 0 
      },... 
      ] 
     }, 
     { 
      "name": "names", 
      "fql_result_set": [ 
      { 
       "uid": "id of user from first query", 
       "name": "user_name" 
      },... 
      ] 
     } 
     ] 
    } 

然后我第一解析第二查询的结果为HashMap和第一查询的这个解析结果到我的数据结构之后,与更换AUTHOR_ID hashmap的名字。

如果您需要关于用户或消息的其他信息 - 只需将列添加到SELECT语句的查询。

希望这会有所帮助。