Facebook Graph API: how do I delete a status message (of mine) - facebook-graph-api

I've written a small facebook client app which can post and retrieve status messages.
Now I want to be able to delete this status messages I have posted. I tried to achieve this by opening the following URL:
"https://graph.facebook.com/" + postID + "?method=delete&access_token=" + AccessToken;
If I do this I get an error message 403 (invalid).
I can delete a status message, if it was posted by my program. But I can't delete it if it was posted by some other program. But this is what I need to do :(
Do I need special rights to remove a status message? Which? Or do I need to use another call to remove it?

I think i'm late with my answer, but i hope someone can still use it. But i think you have to prepend your userid to the ID of the status message you want to delete.
Like this: https://graph.facebook.com/64568227_27863456432483453?access_token={access_token} where 64568227 is the userID and 27863456432483453 is the status message id.

Related

Google oAuth request

I try to add an event in my calendar by an installed application.
The problem: I didn't get the success-code to change for an access token.
My request seems like following:
accounts.google.com:80/o/oauth2/auth?scope=https:%2F%2Fwww.googleapis.com%2Fauth%2Fcalendar&redirect_uri=urn:ietf:wg:oauth:2.0:oob&response_type=code&client_id=73561***.apps.googleusercontent.com
If i send this request at the browser it works. Like the example.
But i wanted my application to do everything for me. That means, that the User only give his login dates and he is able to add as an example an event. Without giving the agreement. Well, if my application send the same request i get an answer: "moved temporarily". But i need the key (success code) from the title bar.
I should add, that i use c++ so i can't use the Google Api. Therefore, i use cURL to send my request.
Anyone able to help me?

Publish to friends wall doesn't work with specified access token

We have an application that allows to users publish content to their friends wall.
It uses the user's access_token given our application.
It works stable usually, but for some reason for one of our clients it doesn't work at all.
We've checked permissions several times, removed-added them again, but still no result.
There is no error message or something, everything looks fine, complete the action, but no posts published in fact. And it doesn't work only for one person.
What possibly can be a problem?
Updated: The problem is actually in this OAuthException:
Error validating access token: Session does not match current stored
session. This may be because the user changed the password since the
time the session was created or Facebook has changed the session for
security reasons.
We tried to get access token one more time, but that didn't help. Somebody familiar with this issue?
your user might forbid people/applications to post on his wall.
"There is no error message or something, everything looks fine, complete the action, but no posts published in fact."
Are you sure about this? You should be getting back a unique stream id of the feed item just posted.
Facebook frequently changes its policies that sucks!
Now, you need permission to access the wall.
You need to check if the user has permission to access your application / wall page. if user hasn't got permission then you need to ask for permission before message is streamed. Yes, that's true, it won't display any error message, unless you manually debug this to see where it is stopping.
My suggestion is:
1. use FB.login method to verify, if the user is not logged in then he should login
2. verify the user permission for the wall page
FB.api('/id', function(response){});
3. publish / stream the comments on wall
FB.api("/id/feed", 'post', { ... blah blah blah !
edits:
At FB.login method, you should ask for permisions
e.g. FB.login(function(response) {..} ... ,{scope: 'offline_access,publish_stream'});

Facebook subscription API

When making a POST to subscribe to Facebook, Facebook issues a GET with the callback URL with the following query parameter:
hub.mode
hub.challenge
hub.verify_token
Once we verify the mode and the token and return the hub.challenge does Facebook respond with a status message? It is not clear in the docs...
You are correct it is not clear in the documentation. What happens on your end when you subscribe? If you get something viable, then click the Report Documentation Bug at the bottom of https://developers.facebook.com/docs/reference/api/realtime/ and log the issue.

Fetching one's old Facebook status messages

I want to fetch one's old Facebook status. I have written the code for the same but it looks like it is not working for me. The steps that I have followed are as follows:
First I use the below API to seek the code from Facebook (by prompting user to log in to the Facebook page)
https://www.facebook.com/dialog/oauth?client_id=xxyy&redirect_uri=http://xxyy/home.aspx&scope=publish_stream,read_stream";
Then I seek the AccessToken by passing the code obtained in the above point to the below api as:
https://graph.facebook.com/oauth/access_token?client_id=xxy&redirect_uri=http://xxyy/home.aspx&client_secret=xxyy&code=zzz"
Now there is a problem. I am not able to understand which API I need to use to fetch the old status of the logged in user. I guess I have the access token which is the key to fetching the info. But I am not able to find the relevant API.
I would recommend that you use FQL.
//PHP example:
$fql_query_url = 'https://graph.facebook.com/'
. '/fql?q=fql?q=SELECT status_id, message FROM status WHERE uid=me()'
. '&' . $access_token;
$fql_query_result = file_get_contents($fql_query_url);
The graph API and "post" feed is what you need. I don't usually do this but I need my old statuses!
Following code works for me for fetching Facebook Conversation:
String s = facebook.request("me/inbox");
System.out.println("Message...."+s);

Facebook API Graph - posting a status update to a Facebook Page

I am following the Facebook developer documentation for making a post to a Facebook 'Page' as the Page itself, which according to the docs requires impersonation. I've gotten the access token for the page itself, as well as the Page's ID, by making a call to the "accounts" feed for the user who's the admin for the Page. I then POST to
https://graph.facebook.com/[Page_ID]/feed
With the post items
access_token
and
message
containing the access token and the message, and I get a JSON string back with a post ID. Which all seems to indicate that it is posting the message to the page. HOWEVER, when I go to the particular Page, it doesn't display the posted status.
Does anyone perhaps have any idea why that might be?
Thanks in advance everyone!
Did you make sure to get the "publish_stream" permission from the user?
http://developers.facebook.com/docs/authentication/permissions