'. '

Facebook

From APIDesign

(Difference between revisions)
Jump to: navigation, search
Line 1: Line 1:
 +
While ago I got a question from a curious to-become-reader of [[TheAPIBook]] whether, after reading it, he will be able to create [[API]] for a Web OS like [[wikipedia:Facebook|Facebook]]. I had to admit that my book could help only indirectly. Some principles apply, but the main focus is on libraries, while [[Facebook]] is more about [[REST]] [[API]]s. Anyway, modernity cannot be prevented, so I am slowly deep diving into this slightly different world too.
 +
 +
=== [[Facebook]] Desktop Application ===
 +
[[TBD]]
[[TBD]]
 +
# Register your application at http://www.facebook.com/developers/createapp.php
 +
# Sources: http://source.apidesign.org/hg/feedbook/
 +
# Builds, downloads: http://hudson.apidesign.org/hudson/job/feedbook
-
Register your application at http://www.facebook.com/developers/createapp.php
+
<source lang="java" snippet="feedbook-login"/>
-
Sources: http://source.apidesign.org/hg/feedbook/
+
-
Builds, downloads: http://hudson.apidesign.org/hudson/job/feedbook
+

Revision as of 08:52, 11 November 2010

While ago I got a question from a curious to-become-reader of TheAPIBook whether, after reading it, he will be able to create API for a Web OS like Facebook. I had to admit that my book could help only indirectly. Some principles apply, but the main focus is on libraries, while Facebook is more about REST APIs. Anyway, modernity cannot be prevented, so I am slowly deep diving into this slightly different world too.

Facebook Desktop Application

TBD

  1. Register your application at http://www.facebook.com/developers/createapp.php
  2. Sources: http://source.apidesign.org/hg/feedbook/
  3. Builds, downloads: http://hudson.apidesign.org/hudson/job/feedbook
Code from Main.java:
See the whole file.

private static String login() 
throws IOException, FacebookException, URISyntaxException {
    FacebookJaxbRestClient login = new FacebookJaxbRestClient(
        APP_KEY, APP_SEC
    );
    final String token = login.auth_createToken();
    final URI u = new URI("http://www.facebook.com/login.php?"
            + "api_key=" + APP_KEY + "&auth_token=" + token);
    String msg = "authentication";
    browser(msg, u);
    return login.auth_getSession(token, false); 
}
 
Personal tools
buy