Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't delete an article by Facebook Instant Article API's DELETE method

I have an id of created article and I also can get the status of the article by GET method:

{article_id}?access_token={access_token}

I get a response like:

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

But when I try to delete the article by the DELETE method with the same params I'm getting this response:

{
  "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"
  }
}

Everything was done according to the documentation.

I'm using v2.6 graph version whit this permissions:

publish_pages, pages_manage_instant_articles, manage_pages

I use a page token that do not expire, I got it by @Simon.Ponder's answer.

I have the only one admin user for the application and the page.

How can it be solved?

like image 594
whitesiroi Avatar asked Jun 21 '16 06:06

whitesiroi


1 Answers

I was able to delete post by using 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();
     }

Hope it helps someone.

like image 155
whitesiroi Avatar answered Oct 02 '22 18:10

whitesiroi