简体   繁体   中英

Facebook Graph API: Getting latitude/longitude of a Checkin via Fields API (optimized calling)

I'd like to know whether there is a way to directly get the latitude/longitude fields via the Facebook Graph API.

The background is that I want to reduce the amount of data which is returned by the Graph API by getting rid of fields which are not of interest for my application.

I know there's something like this working in the Graph API Explorer:

me/?fields=id,checkins.fields(id,place.fields(id,location),created_time)

It returns the following:

{
"id": "12345", 
"checkins": {
"data": [
  {
    "id": "101511234546244", 
    "place": {
      "id": "170048419682121", 
      "location": {
        "street": "", 
        "city": "Frankfurt", 
        "state": "", 
        "country": "Germany", 
        "zip": "", 
        "latitude": 50.108641831527, 
        "longitude": 8.6654729704433
      }
    }, 
    "created_time": "2012-11-08T08:30:48+0000"
  }
]
}

As I don't need the address parts of the location, I'd really like to get rid of them as well. If I try this the follwoing way, it doesn't work:

me?fields=id,checkins.fields(id,place.fields(id,location.fields(latitude,longitude)),created_time)

The result is

{
"id": "12345", 
"checkins": {
"data": [
  {
    "id": "101511234546244", 
    "place": null, 
    "created_time": "2012-11-08T08:30:48+0000"
  }
]
}

Did somebody have success in doing something similar? If so, I'd be great if you could let me know. Thanks!

根据API文档和Graph API资源管理器, Subfields are not supported by location因此您无法仅从位置对象中提取latitudelongitude

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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