2012-02-24 51 views
3

我嘗試發佈了「看」行動,但我總是這樣的錯誤:未知的路徑組件

Error occured 

Type: OAuthException 

Message: Unknown path components: /MyAppName:watch 

這是我的JS功能:

function postWatch() 
    { 
FB.api('/me/MyAppName:watch' + 
    '?video=http//myLink.com','post', 
    function(response) { 
    var msg = 'Error occured'; 
    if (!response || response.error) { 
    if (response.error) { 
    msg += "\n\nType: "+response.error.type+"\n\nMessage: "+response.error.message; 
    } 
    alert(msg); 
    } 
    else { 
    alert('Post was successful! Action ID: ' + response.id); 
    } 
    }); 
    } 

這是我的OG:標籤

<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en-US" 
     xmlns:fb="https://www.facebook.com/2008/fbml"> 
    <head prefix="og: http://ogp.me/ns# fb: http://ogp.me/ns/fb# video: http://ogp.me/ns/video#"> 
    <meta property="fb:app_id" content="MyAppID" /> 
    <meta property="og:title" content="MyTitle" /> 
    <meta property="og:image" content="http://MyUrlImage.com" /> 
    <meta property="og:description" content="MyDescription" /> 
    <meta property="og:url" content="MyLink.com"> 
    <meta property="og:site_name" content="MySiteName" /> 
    <meta property="og:type" content="video.movie" /> 

任何想法?

感謝;)

PS:對不起,我的英文不好,我是法國人;)

問候

回答

4

對於內置操作的語法是不同的。使用video.watches

+1

天啊!完美的工作!非常感謝你 !!! – 2012-02-26 13:23:32

2

實際上是爲你自己的行爲/對象,你可以使用未來的語法:

var params = {}; 
params['video'] = 'http://example.com/myvideo.html'; 
FB.api('me/mynamespace:watch','post',params,function(response){ 
     console.log(response); 
}); 

這會在你的牆上居然發佈與物體的動作,如果你的用戶提供了publish_actions權限。 對於你可能會想,以確保您有權限的權限的事情,你的支票應該是這個樣子:

FB.api('me/permissions','get',function(response){ 
     if (response.data[0].publish_actions){ 
      //do your magic 
     }  
});