2012-02-24 55 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 
     }  
});