使用 Graph API 从 Facebook 页面更新/删除选项卡会返回“(#210) 主题必须是页面。”

发布于 2024-12-23 07:13:40 字数 458 浏览 5 评论 0原文

我正在尝试从 Facebook 页面删除应用程序选项卡。 根据文档,我应该使用 PAGE 访问令牌向“https://graph.facebook.com/PAGE_ID/tabs/TAB_ID”发出 DELETE 请求,但是当我这样做时,我收到错误“(#210)Subject一定是一个页面。” 尝试更新选项卡时也会发生同样的情况。 我已请求用户“manage_pages”权限,并且我有正确的 access_token(添加选项卡效果很好)。 确切的请求是: https://graph.facebook.com/212757048770606/tabs/app_289329597785433(带有访问令牌)

有人吗知道我做错了什么吗?或者有一个开放的错误报告吗?

多谢

I am trying to delete an application tab from a facebook page.
According to the documentation, I should issue a DELETE request to "https://graph.facebook.com/PAGE_ID/tabs/TAB_ID" with a PAGE access token, but when I do so I get the error "(#210) Subject must be a page."
The same happens when trying to update a tab.
I have requested the user for "manage_pages" permission and I have the correct access_token (Adding a tab works perfectly).
the exact request is: https://graph.facebook.com/212757048770606/tabs/app_289329597785433 (with an access token)

Does anyone know what am I doing wrong?? or is there an open bug report?

Thanks alot

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

颜漓半夏 2024-12-30 07:13:40

我没有适合您的解决方案,但我确实知道在删除选项卡时遇到了一些问题,这些问题归结为选项卡的 ID(从调用 get /PAGE_ID/tabs) 已包含页面 ID 和“选项卡”路径。

最初,我通过获取选项卡 ID 并将其粘贴在 /PAGE_ID/tabs/ 的末尾来构建 URL,但这不起作用,因为 URL 最终类似于 /12345 /tabs/12345/tabs/app_4567。当我意识到选项卡 ID 已经是某种“复合”时,我就让“删除”开始工作。

I don't have a solution for you, but I do know that I had some problems with removing a tab that boiled down to the fact that the tab's ID (returned from a call to get /PAGE_ID/tabs) already includes the page ID and "tabs" path.

Initially I was building my URL by taking the tab ID and sticking it on the end of /PAGE_ID/tabs/, but that didn't work because the URL ended up being something like /12345/tabs/12345/tabs/app_4567. Once I realized that the tab ID was sort of "compound" already, I got the Remove to work.

旧时浪漫 2024-12-30 07:13:40

将页面访问令牌添加到 Facebook API 的调用中

var PageAccessToken = 123456789123456789123456789123456789;
FB.api(
    "/{page_id}/tabs",
    "POST",
    {
        "object": {
            "app_id": "{page_id}"
        }
    },{
    "access_token": PageAccessToken
    },
    function (response) {
      if (response && !response.error) {
        console.log(response);
      } else {
        console.log(response.error);
      }
    }
);

Add the page access token to the call of Facebook API

var PageAccessToken = 123456789123456789123456789123456789;
FB.api(
    "/{page_id}/tabs",
    "POST",
    {
        "object": {
            "app_id": "{page_id}"
        }
    },{
    "access_token": PageAccessToken
    },
    function (response) {
      if (response && !response.error) {
        console.log(response);
      } else {
        console.log(response.error);
      }
    }
);
长梦不多时 2024-12-30 07:13:40
  function DeleteTabPage(){  
        var pid = page_id;
        var at = access_tocken;           
        debugger;
        FB.api(pid + '/tabs/app_{your app id}', 'DELETE', { app_id: your app id, access_token: at }, function (response) {
            debugger;
            if (!response || response.error) {
                debugger;`enter code here`
                alert('Facebook add app error ' + response.error);
            } else {
                console.log(response);
                debugger;
                //  alert('App has been added');
            }
        }); /* end of page/tabs*/
    }
  function DeleteTabPage(){  
        var pid = page_id;
        var at = access_tocken;           
        debugger;
        FB.api(pid + '/tabs/app_{your app id}', 'DELETE', { app_id: your app id, access_token: at }, function (response) {
            debugger;
            if (!response || response.error) {
                debugger;`enter code here`
                alert('Facebook add app error ' + response.error);
            } else {
                console.log(response);
                debugger;
                //  alert('App has been added');
            }
        }); /* end of page/tabs*/
    }
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文