【问题标题】:How to tell if ID is a Facebook App or User如何判断 ID 是 Facebook 应用还是用户
【发布时间】:2011-10-28 13:25:17
【问题描述】:

我有一个页面正在使用 Open Graph 和 FBML 在我的页面上放置一个赞和发送按钮。客户根据我的要求向我提供了两个“用户 ID”;然而,当我在 fb:admins 元标记中提交它们并将其用于 Facebook 调试时,我收到以下错误 Too many app ids specified,尽管没有提供 fb:app_id 元标记。

我的问题很简单,如何判断提供的 ID 是用户 ID 还是应用 ID?

【问题讨论】:

  • 尝试将它们添加到 Facebook 图 URL 并检查结果:https://graph.facebook.com/?ids=XXXXXXX,YYYYYYYY 其中XXXXXXXYYYYYYYY 是 ID。
  • 这似乎可以做到,因为看似应用程序并没有返回任何东西。发表一个答案,我会给予它应得的荣誉。

标签: facebook facebook-graph-api


【解决方案1】:

另一种方法是使用参数 metadata=1 查询 obj ID,

例如查询 123213121232131229?metadata=1&fields=id

在返回的元数据中,检查“类型”字段中的值

【讨论】:

    【解决方案2】:

    尝试将它们添加到 Facebook 图表 URL 并检查结果:https://graph.facebook.com/?ids=XXXXXXX,YYYYYYYY 其中XXXXXXXYYYYYYYY 是 ID,例如:

    https://graph.facebook.com/?ids=579187142,40796308305
    

    查询我的 ID 和 Coca-Cola 的页面 id 将返回:

    {
       "579187142": {
          "id": "579187142",
          "name": "Ibrahim Faour",
          "first_name": "Ibrahim",
          "last_name": "Faour",
          "username": "ifaour",
          "gender": "male",
          "locale": "en_US"
       },
       "40796308305": {
          "id": "40796308305",
          "name": "Coca-Cola",
          "picture": "http://profile.ak.fbcdn.net/hprofile-ak-snc4/203509_40796308305_256509_s.jpg",
          "link": "http://www.facebook.com/coca-cola",
          "likes": 33623022,
          "category": "Food/beverages",
          "website": "http://www.coca-cola.com",
          "username": "coca-cola",
          "founded": "1886",
          "products": "Coca-Cola is the most popular and biggest-selling soft drink in history, as well as the best-known product in the world.\n\nCreated in Atlanta, Georgia, by Dr. John S. Pemberton, Coca-Cola was first offered as a fountain beverage by mixing Coca-Cola syrup with carbonated water. Coca-Cola was introduced in 1886, patented in 1887, registered as a trademark in 1893 and by 1895 it was being sold in every state and territory in the United States. In 1899, The Coca-Cola Company began franchised bottling operations in the United States.\n\nCoca-Cola might owe its origins to the United States, but its popularity has made it truly universal. Today, you can find Coca-Cola in virtually every part of the world.",
          "parking": {
             "street": 0,
             "lot": 0,
             "valet": 0
          },
          "hours": {
             "mon_1_open": 0,
             "mon_1_close": 0,
             "tue_1_open": 0,
             "tue_1_close": 0,
             "wed_1_open": 0,
             "wed_1_close": 0,
             "thu_1_open": 0,
             "thu_1_close": 0,
             "fri_1_open": 0,
             "fri_1_close": 0,
             "sat_1_open": 0,
             "sat_1_close": 0,
             "sun_1_open": 0,
             "sun_1_close": 0,
             "mon_2_open": 0,
             "mon_2_close": 0,
             "tue_2_open": 0,
             "tue_2_close": 0,
             "wed_2_open": 0,
             "wed_2_close": 0,
             "thu_2_open": 0,
             "thu_2_close": 0,
             "fri_2_open": 0,
             "fri_2_close": 0,
             "sat_2_open": 0,
             "sat_2_close": 0,
             "sun_2_open": 0,
             "sun_2_close": 0
          },
          "payment_options": {
             "cash_only": 0,
             "visa": 0,
             "amex": 0,
             "mastercard": 0,
             "discover": 0
          },
          "restaurant_services": {
             "reserve": 0,
             "walkins": 0,
             "groups": 0,
             "kids": 0,
             "takeout": 0,
             "delivery": 0,
             "catering": 0,
             "waiter": 0,
             "outdoor": 0
          },
          "restaurant_specialties": {
             "breakfast": 0,
             "lunch": 0,
             "dinner": 0,
             "coffee": 0,
             "drinks": 0
          }
       }
    }
    

    并查询单个id:

    https://graph.facebook.com/?id=291549705119
    

    CityVille App 是什么:

    {
       "id": "291549705119",
       "name": "CityVille",
       "description": "Grab your hard hats and work boots, 'cause it's time to get building! Welcome to CityVille, where you and your friends can build the city of your dreams!  Play now at: http://zyn.ga/1qJ",
       "category": "Games",
       "subcategory": "Other",
       "link": "http://www.facebook.com/apps/application.php?id=291549705119"
    }
    

    【讨论】:

      猜你喜欢
      • 2021-08-15
      • 1970-01-01
      • 2012-01-27
      • 1970-01-01
      • 1970-01-01
      • 2015-11-15
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多