Agusti
Agusti

Reputation: 13

Error 403 when using Graph API to post a message on a feed:

I'm trying to post a message using the Graph API and a C++ program. I have tried three different methods:

  1. GET with a URL like https://graph.facebook.com/USER_ID/feed?access_token=TOKEN&message=Hello
  2. POST and X-WWW_FORM
  3. POST and FORM-data

In the case 1, I receive the complete list of messages as an answer, but the message doesn't add to the feed.

In the case 2 and 3, I receive an error 403 as the response.

USER_ID and TOKEN are correct and my application has the right permissions. I have reached posting an image to an album with the same application, but it's impossible for me right now to publish messages. Why?

Upvotes: 0

Views: 8114

Answers (1)

Arjuna Del Toso
Arjuna Del Toso

Reputation: 599

The first method won't work because you need to issue an HTTP POST to that endpoint to publish a new feed story, as a commodity facebook provides the "method=post" GET parameter to "fake" a post, this will work

https://graph.facebook.com/USER_ID/feed?access_token=TOKEN&message=Hello&method=post

and as response you'll get the id of the new post

{
   "id": "499801468_1001264776039"
}

Here you can find more details on publishing with the Graph API http://developers.facebook.com/docs/reference/api/#publishing

Upvotes: 2

Related Questions