How do you retrieve the “Place” field of a Facebook Graph Post object?

浪尽此生 提交于 2019-12-12 01:59:17

问题


I am trying to retrieve the "Place" field of a Facebook Graph Post object from a Facebook friend. After obtaining an access token with the friends_status and read_stream permissions, I request from the Graph API like so:

http://graph.facebook.com/[user_id]_[post_id]

What is returned are some of the fields described in the Graph API docs for Post:

{
  "id": "1164358582_2458311174854", 
  "from": {
    "name": "Joe Blo", 
    "id": "1164358582"
  }, 
  "message": "Is pretty bummed today", 
  "actions": [
    {
      "name": "Comment", 
      "link": "http://www.facebook.com/1164358582/posts/2458311174854"
    }, 
    {
      "name": "Like", 
      "link": "http://www.facebook.com/1164358582/posts/2458311174854"
    }
  ], 
  "type": "status", 
  "application": {
    "name": "Facebook for Android", 
    "id": "350685531721"
  }, 
  "created_time": "2011-11-20T03:23:04+0000", 
  "updated_time": "2011-11-20T12:12:49+0000", 
  "comments": {
    "data": [
      {
        "id": "1164358582_2458311174852_2962531", 
        "from": {
          "name": "Sue Candy", 
          "id": "1056617421"
        }, 
        "message": "OMG I'm so sorry!!!", 
        "created_time": "2011-11-20T03:25:06+0000"
      }
    ], 
    "count": 1
  }
}

This is all fine and dandy, except for the fact that when I see this Post within my Facebook stream, it also shows a location accompanying the post:

9 hours ago near El Reno, OK

I expected the El Reno, OK Place object returned as a field within this Post, but I don't see it.

In the Facebook Graph API Explorer, I've tried enabling almost every permission and I am not seeing any difference in the response (no "Place" field returned). Am I going about this incorrectly?


回答1:


Not 100% sure but I think you can only get the "place" info if it is of type "checkin". I totally get where you are coming from, I wondered about that myself.

https://developers.facebook.com/tools/

Try the Graph API Explorer Tool if you haven't already looked at it.



来源:https://stackoverflow.com/questions/8201554/how-do-you-retrieve-the-place-field-of-a-facebook-graph-post-object

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!