最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Unknown path components - Stack Overflow

programmeradmin3浏览0评论

I try to post a "watch" action but I've always this error:

Error occured

Type: OAuthException

Message: Unknown path ponents: /MyAppName:watch

This is my JS function:

function postWatch()
  {
FB.api('/me/MyAppName:watch' + 
    '?video=http//myLink','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);
    }
    });
  }

This is my og:tag

<html xmlns="" dir="ltr" lang="en-US"
      xmlns:fb=""> 
    <head prefix="og:  fb:  video: ">
    <meta property="fb:app_id" content="MyAppID" />
    <meta property="og:title" content="MyTitle" />
    <meta property="og:image" content="" />
    <meta property="og:description" content="MyDescription" />
    <meta property="og:url" content="MyLink">
    <meta property="og:site_name" content="MySiteName" />
    <meta property="og:type" content="video.movie" /> 

Any ideas ?

Thanks ;)

PS: Sorry for my poor english, I'm french ;)

Regards

I try to post a "watch" action but I've always this error:

Error occured

Type: OAuthException

Message: Unknown path ponents: /MyAppName:watch

This is my JS function:

function postWatch()
  {
FB.api('/me/MyAppName:watch' + 
    '?video=http//myLink.','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);
    }
    });
  }

This is my og:tag

<html xmlns="http://www.w3/1999/xhtml" dir="ltr" lang="en-US"
      xmlns:fb="https://www.facebook./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." />
    <meta property="og:description" content="MyDescription" />
    <meta property="og:url" content="MyLink.">
    <meta property="og:site_name" content="MySiteName" />
    <meta property="og:type" content="video.movie" /> 

Any ideas ?

Thanks ;)

PS: Sorry for my poor english, I'm french ;)

Regards

Share Improve this question asked Feb 24, 2012 at 21:44 Kevin PiersonKevin Pierson 891 silver badge8 bronze badges
Add a ment  | 

2 Answers 2

Reset to default 4

For built-in actions the syntax is different. Use video.watches

Actually for your own actions/objects you could use the next syntax:

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

This will actually publish on your wall the action with the object, if your user has provided the publish_actions permission. For the permissions thing you would probably want to make sure you have the permission, so your check should look something like this:

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

评论列表(0)

  1. 暂无评论