Search code examples
facebookfacebook-graph-apizend-http-client

Facebook GraphAPI returns "false" on delete


When I want to delete a post made by my application, Facebooks GraphAPI returns "false" though my app has the publish_stream permission.

I tried with HTTP DELETE and HTTP POST (parameter method=delete). Still returns false. Also the Graph API explorer returns false when i try to delete the post.

I tried to delete using the app token and a page access token... nothing works. Any ideas? (on a sidenote: my post-ids don't look the same like some of the examples. i have a plain id, accessing a post via /pageId_postId is not possible. i guess they changed that for newer posts?)

public function deletePost($fbPageName, $postId) {

    //$pageAccessToken = file_get_contents("https://graph.facebook.com/$fbPageName?fields=access_token&access_token=".$this->_accessToken);
    //$pageAccessToken = json_decode($pageAccessToken)->access_token;

    //create a DELETE request to the graph API
    $graph_url = "https://graph.facebook.com/$postId?access_token=".$this->_accessToken;
    $client = new Zend_Http_Client($graph_url);
    $client->setMethod(Zend_Http_Client::DELETE);

    $response = $client->request();
    ...

Solution

  • The problem seems to have resolved itself during lunch-time. While I was not able to access /pageId_postId in the morning (though /postId was giving the right results), now it is possible and deleting posts also works by issuing the DELETE request do /pageId_postId with the application access token.