O'Reilly logo

Facebook Cookbook by Jay Goldman

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

RESTing with Facebook

Problem

I’m curious to know more about how my app communicates with Facebook. What kind of API is this?

Solution

This is a Representational State Transfer, or REST-like API, which means that calls are simply made over HTTP (using GET or POST) to the Facebook server. You’ll be POSTing requests to http://api.facebook.com/restserver.php when you make calls from your server, but you can visit that URL directly if you’re curious to see what a 101 error response looks like (and who isn’t, really?).

Discussion

The alternative to REST is generally considered to be SOAP, a heavier-weight protocol that includes an additional message layer. The two are very similar in some regards (both generally use HTTP as their transport protocol and generally use XML to encode data), but there’s a lot more overhead in implementing a SOAP-based API. More information about REST and SOAP can be found at http://en.wikipedia.org/wiki/Representational_State_Transfer and http://en.wikipedia.org/wiki/SOAP, respectively.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required