Joe Van Dyk
2008-Jun-25 23:07 UTC
[Facebooker-talk] Avoiding remote API calls inside controller actions
So, it''s bad to do network API calls to FB inside a controller action, amirite? If I want to display the user''s first name though, how do I do that without making a FB API call? How about the user''s friends that have the application installed? I only have 2 mongrels running and I hate to have them both tied up with Facebook API calls.
Michael Niessner
2008-Jun-25 23:37 UTC
[Facebooker-talk] Avoiding remote API calls inside controller actions
You can use preload fql to get that information. Michael On Jun 25, 2008, at 6:07 PM, Joe Van Dyk wrote:> So, it''s bad to do network API calls to FB inside a controller > action, amirite? > > If I want to display the user''s first name though, how do I do that > without making a FB API call? How about the user''s friends that have > the application installed? > > I only have 2 mongrels running and I hate to have them both tied up > with Facebook API calls. > _______________________________________________ > Facebooker-talk mailing list > Facebooker-talk at rubyforge.org > http://rubyforge.org/mailman/listinfo/facebooker-talk
BJ Clark
2008-Jun-26 00:18 UTC
[Facebooker-talk] Avoiding remote API calls inside controller actions
The easiest way is to use fbml. <fb:name uid="facebook_uid_here" /> or the facebooker helper equiv of fb_name(uid). Obviously won''t work if your not doing a canvas page app, though. Some people, who shall not be named, "cache" basic stuff like that in their database, that they use throughout their app, when a user signs up. This is, of course, against TOS however. BJ Clark Inigral On Jun 25, 2008, at 5:37 PM, Michael Niessner wrote:> You can use preload fql to get that information. > > Michael > > On Jun 25, 2008, at 6:07 PM, Joe Van Dyk wrote: > >> So, it''s bad to do network API calls to FB inside a controller >> action, amirite? >> >> If I want to display the user''s first name though, how do I do that >> without making a FB API call? How about the user''s friends that have >> the application installed? >> >> I only have 2 mongrels running and I hate to have them both tied up >> with Facebook API calls. >> _______________________________________________ >> Facebooker-talk mailing list >> Facebooker-talk at rubyforge.org >> http://rubyforge.org/mailman/listinfo/facebooker-talk > > _______________________________________________ > Facebooker-talk mailing list > Facebooker-talk at rubyforge.org > http://rubyforge.org/mailman/listinfo/facebooker-talk
Ben Sinclair
2008-Jun-26 13:42 UTC
[Facebooker-talk] Avoiding remote API calls inside controller actions
If want to do some caching, you can hold onto their data for 24 hours (TOS section 2.A.4): "You may not continue to use, and must immediately remove from any Facebook Platform Application and any Data Repository in your possession or under your control, any Facebook Properties not explicitly identified as being storable indefinitely in the Facebook Platform Documentation within 24 hours after the time at which you obtained the data, or such other time as Facebook may specify to you from time to time." And if the user opts-in, you can hold onto their data indefinitely (TOS section 2.A.6): "You may retain copies of Exportable Facebook Properties for such period of time (if any) as the Applicable Facebook User for such Exportable Facebook Properties may approve, if (and only if) such Applicable Facebook user expressly approves your doing so pursuant to an affirmative "opt-in" after receiving a prominent disclosure of a) the uses you intend to make of such Exportable Facebook Properties, b) the duration for which you will retain copies of such Exportable Facebook Properties, and c) any terms and conditions governing your use of such Exportable Facebook Properties (a "Full Disclosure Opt-In"). On Wed, Jun 25, 2008 at 7:18 PM, BJ Clark <bjclark at scidept.com> wrote:> The easiest way is to use fbml. <fb:name uid="facebook_uid_here" /> or the > facebooker helper equiv of fb_name(uid). Obviously won''t work if your not > doing a canvas page app, though. > > Some people, who shall not be named, "cache" basic stuff like that in their > database, that they use throughout their app, when a user signs up. This is, > of course, against TOS however. > > BJ Clark > Inigral > > > On Jun 25, 2008, at 5:37 PM, Michael Niessner wrote: > >> You can use preload fql to get that information. >> >> Michael >> >> On Jun 25, 2008, at 6:07 PM, Joe Van Dyk wrote: >> >>> So, it''s bad to do network API calls to FB inside a controller action, >>> amirite? >>> >>> If I want to display the user''s first name though, how do I do that >>> without making a FB API call? How about the user''s friends that have >>> the application installed? >>> >>> I only have 2 mongrels running and I hate to have them both tied up >>> with Facebook API calls. >>> _______________________________________________ >>> Facebooker-talk mailing list >>> Facebooker-talk at rubyforge.org >>> http://rubyforge.org/mailman/listinfo/facebooker-talk >> >> _______________________________________________ >> Facebooker-talk mailing list >> Facebooker-talk at rubyforge.org >> http://rubyforge.org/mailman/listinfo/facebooker-talk > > _______________________________________________ > Facebooker-talk mailing list > Facebooker-talk at rubyforge.org > http://rubyforge.org/mailman/listinfo/facebooker-talk >-- Ben Sinclair ben at bensinclair.com
Joe Van Dyk
2008-Jul-03 19:28 UTC
[Facebooker-talk] Avoiding remote API calls inside controller actions
On Wed, Jun 25, 2008 at 4:07 PM, Joe Van Dyk <joe at pinkpucker.net> wrote:> So, it''s bad to do network API calls to FB inside a controller action, amirite? > > If I want to display the user''s first name though, how do I do that > without making a FB API call? How about the user''s friends that have > the application installed? > > I only have 2 mongrels running and I hate to have them both tied up > with Facebook API calls.I''m noticing that when a user first visits my FB app (canvas), facebook.auth.getSession is being called. Is that necessary? Is it possible (or advisable) to raise an exception anytime the facebook api is called from inside a controller action? Joe
Joe Van Dyk
2008-Jul-07 08:22 UTC
[Facebooker-talk] Avoiding remote API calls inside controller actions
On Thu, Jul 3, 2008 at 12:28 PM, Joe Van Dyk <joe at pinkpucker.net> wrote:> On Wed, Jun 25, 2008 at 4:07 PM, Joe Van Dyk <joe at pinkpucker.net> wrote: >> So, it''s bad to do network API calls to FB inside a controller action, amirite? >> >> If I want to display the user''s first name though, how do I do that >> without making a FB API call? How about the user''s friends that have >> the application installed? >> >> I only have 2 mongrels running and I hate to have them both tied up >> with Facebook API calls. > > I''m noticing that when a user first visits my FB app (canvas), > facebook.auth.getSession is being called. Is that necessary? > > Is it possible (or advisable) to raise an exception anytime the > facebook api is called from inside a controller action?I''m noticing that facebook.auth.createToken and facebook.auth.getSession are called from inside the controller actions whenever someone comes to FB for the first time. Is there a way to avoid this? I''d really like to get all remote api calls to FB outside of controller actions, I hate tying up mongrel or thin processes.