Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Facebook Connect - Graph API vs Old JavaScript SDK (Action Links)

I'm posting some info to a user's wall via Facebook Connect (from my external website).

All working good, but i've noticed some differences in the documentation for wall posts in the Graph API and the Old JavaScript SDK.

With the Graph API, to post to a user's wall you do the following:

  • Make a HTTP POST to https://graph.facebook.com/{0}/feed?access_token={1} (where 0 = the id of the user, and 1 = the oAuth access token for this user).
  • In the HTTP POST, specify the following parameters in the data: message, link, picture, name, caption, description, source.

This is all detailed on this page: http://developers.facebook.com/docs/reference/api/post

Now, contrast this with the FB.Connect.streamPublish method (old JavaScript SDK):

The client-side JavaScript function takes the following parameters:

  • user_message
  • attachment
  • action_links
  • target_id
  • user_message_prompt
  • callback
  • auto_publish
  • actor_id

This operation is detailed on this page: http://developers.facebook.com/docs/reference/oldjavascript/FB.Connect.streamPublish

Now, the operations in the Graph API vs the old JavaScript API are very similar, apart from one important parameter - "action_links".

From the link above:

A dictionary of Action links objects, containing the link text and a hyperlink.

Essentially, this allows you to create extra links alongside the "Comment" and "Like" buttons beneath the wall post. This is what i want to do, i.e i want to have another button called "Do something on MySite".

Why can i not do this using the Graph API??? WTF Facebook, why would you create a new, "RESTful" API that doesn't have all the functionality of your legacy API?

What annoys me is that the "Feed" object does have the collection of "action links" in the JSON (if you were inclined to request this info).

But it's almost like Facebook have removed the ability to create action links using the Graph API. Is that what has happened??

Am i missing something here? I really do not want to have to replace the Graph API calls with using the Old JavaScript API.

Please help!

EDIT:

Well, well well, look what i found: http://bugs.developers.facebook.com/show_bug.cgi?id=11257

It appears there is a 'bug' where the Facebook Graph API does not support Action Links.

When did the definition of a 'bug' become 'something we left out'?

Sigh, back to the old JavaScript SDK.

Facebook, i loathe thee.

like image 803
RPM1984 Avatar asked Jul 27 '10 23:07

RPM1984


2 Answers

Facebook has added this to the graph api now, with the "actions" parameter. See this link for documentation:

Facebook Graph API Post to Feed Method

like image 69
bkaid Avatar answered Sep 22 '22 23:09

bkaid


There is no "Graph API" solution to this problem - as a bug has been filed with Facebook Developers (see my above EDIT).

The only current solution is to revert to the old REST API or JavaScript API to do the posting.

Ridiculous stuff.

like image 36
RPM1984 Avatar answered Sep 19 '22 23:09

RPM1984