2012-03-26 16 views
0

我試圖編寫[Ruby ON Rails]規範的新手以確保用戶插入的是Facebook ID,並且我無法在任何地方找到驗證用戶的FB ID和直接鏈接到它一旦點擊。發現https://graph.facebook.com/但仍不確定如何使用它。(Ruby ON Rails)爲Facebook ID編寫規範並驗證FB頁面或組

{ 
    "id": "40796308305", 
    "name": "Coca-Cola", 
    "picture": "http://profile.ak.fbcdn.net/hprofile-ak-snc4/hs236.ash2/50516_40796308305_7651_s.jpg", 
    "link": "http://www.facebook.com/coca-cola", 
    "category": "Consumer_products", 
    "website": "http://www.coca-cola.com", 
    "username": "coca-cola", 
    "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.", 
    "fan_count": 17367199 
    } 

回答

0

您可以通過添加metadata場使用自省的圖形API,同時從圖形API請求對象的信息來發現對象的類型:

http://graph.facebook.com/40796308305?metadata=1 

這將返回額外的對象元數據包括type財產會根據對象類型之一:user,page,group, status, photo等...