Facebook Connect - Graph API 与旧 JavaScript SDK(操作链接)
我正在通过 Facebook Connect(来自我的外部网站)向用户墙发布一些信息。
一切正常,但我注意到 Graph API 和旧 JavaScript SDK 中的墙贴文档存在一些差异。
使用 Graph API,要发布到用户的留言墙上,您需要执行以下操作:
- 向 https://graph.facebook.com/{0}/feed?access_token={1}(其中 0 = 用户 ID,1 = oAuth 访问令牌对于该用户)。
- 在HTTP POST中,在数据中指定以下参数:消息、链接、图片、名称、标题、描述、来源。
此页面上有详细说明: http://developers.facebook.com/docs/ Reference/api/post
现在,将其与 FB.Connect.streamPublish 方法(旧 JavaScript SDK)进行对比:
客户端 JavaScript 函数采用以下参数:
- user_message
- attachment
- action_links
- target_id
- user_message_prompt
- 回调
- auto_publish
- actor_id
此操作详细信息请参见此页面: http://developers .facebook.com/docs/reference/oldjavascript/FB.Connect.streamPublish
现在,Graph API 与旧 JavaScript API 中的操作非常相似,除了一个重要参数 - “行动链接”。
从上面的链接:
Action 链接对象的字典, 包含链接文本和 超链接。
从本质上讲,这允许您在墙贴下方的“评论”和“喜欢”按钮旁边创建额外的链接。这就是我想要做的,即我想要另一个名为“在 MySite 上执行某些操作”的按钮。
为什么我不能使用 Graph API 来做到这一点??? WTF Facebook,为什么要创建一个新的“RESTful”API,它不具备旧 API 的所有功能?
令我烦恼的是,“Feed”对象确实具有 JSON 中的“操作链接”集合(如果您倾向于请求此信息)。
但这几乎就像 Facebook 已经删除了使用 Graph API 创建操作链接的功能。是这样的事吗??
我在这里错过了什么吗?我真的不想用旧的 JavaScript API 来替换 Graph API 调用。
请帮忙!
编辑:
好吧,好吧,看看我发现了什么: http://bugs.developers.facebook.com/show_bug.cgi?id= 11257
Facebook Graph API 似乎存在不支持操作链接的“错误”。
“bug”的定义什么时候变成了“我们遗漏的东西”?
唉,又回到了旧的 JavaScript SDK。
脸书,我讨厌你。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
Facebook 现在已将其添加到图形 API 中,并带有“actions”参数。请参阅此链接以获取文档:
Facebook Graph API Post to Feed 方法
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
这个问题没有“Graph API”解决方案 - 因为一个错误已提交给 Facebook 开发人员(请参阅我上面的编辑)。
当前唯一的解决方案是恢复到旧的 REST API 或 JavaScript API 来进行发布。
可笑的东西。
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.