【问题标题】:Can't delete an article by Facebook Instant Article API's DELETE method无法通过 Facebook Instant Articles API DELETE 方法删除文章
【发布时间】:2016-10-22 13:08:20
【问题描述】:

我有一个创建文章的id,我也可以通过GET方法获取文章的状态:

{article_id}?access_token={access_token}

我收到如下回复:

{
  "id": {article_id},
  "status": "SUCCESS"
}

但是,当我尝试使用具有相同参数的 DELETE 方法删除文章时,我收到了以下响应:

{
  "error": {
    "message": "(#240) Requires a valid user to be specified (either via the session or via the API parameter for specifying the user.",
    "type": "OAuthException",
    "code": 240,
    "fbtrace_id": "GsXXXXBjq"
  }
}

一切都按照documentation完成。

我正在使用v2.6 具有此权限的图形版本:

publish_pages, pages_manage_instant_articles, manage_pages

我使用了一个不会过期的页面令牌,我是通过@Simon.Ponder's answer 获得的。

我的应用程序和页面只有一个管理员用户。

如何解决?

【问题讨论】:

  • 你用的是什么类型的令牌?
  • @CBroe 我使用不会过期的页面令牌。
  • 只是好奇,可能是端点没有正确记录。试试DELETE /{page-id}/instant_articles/{article-id}。此part of the graph api docs 与您共享的其他链接冲突
  • 您是否可能需要额外的权限才能发出 DELETE 请求?
  • 你确定你没有混淆你的{article-id}和{access_token}吗? :P

标签: facebook facebook-graph-api facebook-instant-articles


【解决方案1】:

我可以使用facebook-instant-articles-sdk-php删除帖子

     $client = Client::create(
                     $this->options->app_id,
                     $this->options->app_secret,
                     $this->options->access_token,
                     $this->options->page_id,
                     true);

     try {
             $client->removeArticle($my_canonical_url)
     } catch (Exception $e) {
             throw $e->getMessage();
     }

希望对某人有所帮助。

【讨论】:

    【解决方案2】:

    在您的问题中,您在发布文章后会收到这样的回复

    {
      "id": {article_id},
      "status": "SUCCESS"
    }
    

    但这不是article_id 这是import_status_id。所以

    {
          "id": {import_status_id},
      "status": "SUCCESS"
    }
    

    使用import_status_id,如果您的文章发布成功,您可以使用this api 获得article_id。然后您可以像往常一样使用delete api 删除您的文章。谢谢。

    【讨论】:

    • 感谢您的帮助。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-06-14
    相关资源
    最近更新 更多