Facebook FQL - 结合查询以获取相册信息并覆盖粉丝页面中的照片信息

时间:2013-12-12 03:44:21

标签: facebook facebook-graph-api facebook-fql

我正在使用Facebook FQL在Facebook上获取专辑的粉丝页面。使用此查询:

SELECT name, description, cover_object_id, photo_count
    FROM album
    WHERE aid IN (SELECT aid FROM album WHERE owner = myPageID) ORDER BY name

运行查询后。我得到以下JSON有效负载响应,它可以正常工作:

{
  "data": [
    {
      "name": "Cover Photos",
      "description": "",
      "cover_object_id": "654243601289015",
      "photo_count": 1
    },
    {
      "name": "Profile Pictures",
      "description": "",
      "cover_object_id": "630449460335096",
      "photo_count": 1
    },
    {
      "name": "The Artists",
      "description": "Code Sound Studio's Artists, DJ's, and Producers",
      "cover_object_id": "657888117591230",
      "photo_count": 19
    },
    {
      "name": "The Party",
      "description": "Code Sound Studio's Legendary Listening Party's!",
      "cover_object_id": "657361990977176",
      "photo_count": 15
    },
    {
      "name": "The Venue",
      "description": "",
      "cover_object_id": "654241957955846",
      "photo_count": 26
    },
    {
      "name": "Timeline Photos",
      "description": "",
      "cover_object_id": "654235904623118",
      "photo_count": 1
    }
  ]
}

唯一的问题是我还需要获取封面照片 网址 (cover_object_id)

我可以通过运行此查询来实现:

SELECT src FROM photo WHERE object_id IN 
(SELECT cover_object_id
    FROM album
    WHERE aid IN (SELECT aid FROM album WHERE owner = myPageID) ORDER BY name)

响应:

{
  "data": [
    {
      "src": "https://fbcdn-photos-g-a.akamaihd.net/hphotos-ak-ash3/1454787_654243601289015_585991542_s.jpg"
    },
    {
      "src": "https://fbcdn-photos-e-a.akamaihd.net/hphotos-ak-prn1/14172_630449460335096_1873290265_s.jpg"
    },
    {
      "src": "https://fbcdn-photos-g-a.akamaihd.net/hphotos-ak-ash3/1463472_657888117591230_1518187687_s.jpg"
    },
    {
      "src": "https://fbcdn-photos-b-a.akamaihd.net/hphotos-ak-ash4/1457606_657361990977176_792893563_s.jpg"
    },
    {
      "src": "https://fbcdn-photos-a-a.akamaihd.net/hphotos-ak-ash3/541847_654241957955846_1499266298_s.jpg"
    },
    {
      "src": "https://fbcdn-photos-g-a.akamaihd.net/hphotos-ak-frc3/1475898_654235904623118_509667066_s.jpg"
    }
  ]
}

有没有办法将2个查询合并为一个请求?

0 个答案:

没有答案