2

我試圖得到一個OpenGraph對象具有以下FQL對象ID:如何獲取OpenGraph對象的對象ID?

SELECT url,site,id 
FROM object_url 
WHERE url IN ( 
    'http://www.MY_OPENGRAPH_OBJECT_URL' 
) 

我得到的結果ID比這是由https://developers.facebook.com/tools/debug

返回的ID不同,其我無法查詢https://graph.facebook.com/ID(我可以使用從Facebook調試器返回的ID)。

我得到的這個不同的ID是什麼? 我怎樣才能得到正確的對象ID?有使用Facebook Android SDK v3的簡單方法嗎?

回答

3

基於facebook的documentation

id - The ID of the Graph object represented by the URL 

使用URL:

SELECT url, id, type, site FROM object_url WHERE url = "http://www.mashable.com" 

響應:

{ 
    "data": [ 
    { 
     "url": "http://www.mashable.com", 
     "id": 435564669831754, 
     "type": "link", 
     "site": "www.mashable.com" 
    } 
    ] 
} 

使用ID:

SELECT url, id, type, site FROM object_url WHERE id = 435564669831754 

響應:

{ 
    "data": [ 
    { 
     "url": "http://mashable.com/stories/", 
     "id": 435564669831754, 
     "type": "link", 
     "site": "mashable.com" 
    } 
    ] 
} 

在這種情況下搗碎URL,響應值「類型:鏈接」,如果你的U調用圖形API與返回的ID,它不會給任何值。但是如果返回類型是「Page」,那麼返回ID將起作用。

但是,如果嘗試使用此IMDB網址,

SELECT url, id, type, site FROM object_url WHERE url = "http://www.imdb.com/title/tt0117500/" 

響應:

{ 
    "data": [ 
    { 
     "url": "http://www.imdb.com/title/tt0117500/", 
     "id": 114324145263104, 
     "type": "page", 
     "site": "www.imdb.com" 
    } 
    ] 
} 

從文檔 - >

type - The type of object the URL represents (note: 'Page' incorporates any URL with an 'og:type' specified) 

我也嘗試www.imdb.com在

SELECT url, id, type, site FROM object_url WHERE url = "http://www.imdb.com" 

響應:

{ 
    "data": [ 
    { 
     "url": "http://www.imdb.com", 
     "id": 6903354771, 
     "type": "link", 
     "site": "www.imdb.com" 
    } 
    ] 
} 

但是,如果你在FB中調試工具檢查任何網址,在最後一節有ID爲圖形API URL工作正常。我不確定Facebook如何在調試器中獲得此功能。

+0

對於OpenGraph對象,類型爲namespace:object_type,這是從查詢graph.facebook.com/OBJECT_ID而不是從FQL查詢返回的'link'類型返回的。有沒有辦法從給定的URL獲取正確的OpenGraph對象ID? – 2013-03-06 11:37:49

+0

這裏的開放圖形對象的URL應該是什麼? – Kunu 2014-06-18 07:08:55

相關問題