Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Delete facebook post with Graph API - trouble getting this to work

I'm using the following to post a message on my Facebook page:

$attachment =  array(
    'access_token' => $access_token,
    'message' => 'This is a test Message 4:',   
    'name' => "This is a test Name 4",
    'link' => "http://slashdot.org/",
    'description' => "This is a test Description 4"
);

$ret_code=$facebook->api('/me/feed', 'POST', $attachment);

This works great.

How do I delete the same post using the facebook GRAPH api? I read the docs and it says to issue a POST like:

https://graph.facebook.com/COMMENT_ID?method=delete

To test I set this up in a simple form with submit button, POSTing the data to https://graph.facebook.com/COMMENT_ID?method=delete (substituting COMMENT_ID fro the 11111111111_111111111111 id returned from the original publish call. This returns "This API call requires a valid app_id".

What is the correct way to issue a DELETE command?

like image 893
a coder Avatar asked May 09 '11 16:05

a coder


People also ask

Is Facebook Graph API deprecated?

Applies to all versions. Facebook Analytics will no longer be available after June 30, 2021. Additionally, we are deprecating the App Dashboard Plugin for Marketing API. For more information visit the Business Help Center.

How do I get data from Facebook Graph API?

Open the Graph Explorer in a new browser window. This allows you to execute the examples as you read this tutorial. The explorer loads with a default query with the GET method, the lastest version of the Graph API, the /me node and the id and name fields in the Query String Field, and your Facebook App.

How do I remove Facebook API?

You can use a HTTP DELETE request with: From http://developers.facebook.com/docs/reference/api/user/#permissions: You can de-authorize an application or revoke a specific extended permissions on behalf of a user by issuing an HTTP DELETE request to PROFILE_ID/permissions with a user access_token for that app.

Is Facebook Graph API RESTful?

Because the Facebook Graph API is a restful JSON API, you can run queries directly in any standard browser; you'd simply be making HTTP calls.


2 Answers

Since you are using the php-sdk you just issue this call:

$facebook->api("/COMMENT_ID","DELETE");
like image 160
ifaour Avatar answered Sep 21 '22 09:09

ifaour


You can use the following code:

Http::post('https://graph.facebook.com/'.$fb_action_id, array('method'=>'delete', 'access_token'=>$your_app_access_token));

This post will return a boolean value, true if successed and false if failed.

like image 29
Mohammad Anini Avatar answered Sep 19 '22 09:09

Mohammad Anini