简体   繁体   English

Rails和Facebook连接API(图)。

[英]Rails and Facebook connect API (graph).

I am developing in Rails 3 and I need to use the Facebook connect API (Graph). 我正在Rails 3中进行开发,我需要使用Facebook connect API(图)。 I am currently trying out the Javascript SDK and it works fine. 我目前正在尝试Javascript SDK,它工作正常。 The problem is I do not know how to "save" and interact with the information I extract in Rails. 问题是我不知道如何“保存”和与我在Rails中提取的信息进行交互。

The best thing would be to use some "native" Rails plugin for Facebook. 最好的办法是为Facebook使用一些“本机” Rails插件。 I have looked a bit on the Facebooker Plugin but I do not know how to get started and use it. 我看了一下Facebooker插件,但是不知道如何开始和使用它。

Does anyone know how to interact with the Facebook API with Rails 3? 有谁知道如何通过Rails 3与Facebook API进行交互?

Facebook Graph API is HTTP based, so it works with any language that has an HTTP library, such as cURL, urllib. Facebook Graph API是基于HTTP的,因此它可与任何具有HTTP库的语言一起使用,例如cURL,urllib。 Just call appropriate url with appropriate data and you will get you data as JSON object.You can use facebook explorer tool for sandbox testing of your api. 只需使用适当的data调用适当的url ,您就可以将数据作为JSON 。您可以使用facebook 资源管理器工具对api进行沙盒测试。 For rails koala gem just makes it easy to call API and extract info from response . 对于Rails, 考拉 gem使其易于调用API并从response提取信息。

You would need to integrate some kind of server-side logic. 您将需要集成某种服务器端逻辑。 For instance, you could use your own JS to call FB's JS and then AJAX submit the data received back from FB to your server for persistence. 例如,您可以使用自己的JS调用FB的JS,然后AJAX将从FB接收回的数据提交给服务器以进行持久化。

Then, you could use something like koala to make server side calls later to the OpenGraph API. 然后,您可以使用像考拉之类的东西在以后对OpenGraph API进行服务器端调用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM