如何判断ID是Facebook应用程序还是用户

时间:2011-08-17 01:29:21

标签: facebook facebook-graph-api

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

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

2 个答案:

答案 0 :(得分:4)

另一种方法是使用param metadata = 1,

查询obj ID

e.g。查询123213121232131229?metadata = 1& fields = id

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

答案 1 :(得分:2)

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

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

查询我的ID和可口可乐的页面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"
}