Indometric


Social Network - Category Archive

Jul 27
Wednesday

The Elements of the Facebook Platform

Filed under Social Network

As stated previously articles, the Facebook platform consists of five components: a markup language derived from HTML (Facebook Markup Language), a REST API for treatment communication between Facebook and your application, a SQL-style language for interacting with Facebook data (Facebook Query Language), a scripting language (Facebook JavaScript), and a set of client libraries for different programming languages. I’ll cover these five fundamentals in the following sections.

Facebook Markup Language

Facebook
Facebook
If you’ve ever developed in ColdFusion or JSTL (or other tag-based programming language), you’ll find working with the platform’s Facebook Markup Language (FBML) very natural. If you’re new to tag-based programming, just reckon of FBML as fancy HTML tags, because each interaction starts and ends with a tag. But, to distinguish between HTML and Facebook commands, you prefix the tags with fb: as you would if you were using multiple DTDs/schemas in XHTML. By using the FBML tag set, Facebook abstracts a lot of complicated code and makes many of the routine procedures nearly effortless. For example, to add a link to your application’s help pages on your dashboard (the navigational tabs that go across the top), you simply need to add the following lines:

<fb:dashboard>
<fb:help href="help.php">Application Help</fb:help>
</fb:dashboard>

REST API Calls

Facebook API calls are grouped into eight action categories. These calls are really wrappers for more sophisticated FQL interactions with the Facebook back end but are helpful bits of code that speed up the enhancement of your application. These calls include the following:

  • facebook.auth provides basic authentication checks for Facebook users.
  • facebook.feed provides methods to post to Facebook news feeds.
  • facebook.friends provides methods to query Facebook for various checks on a user’s friends.
  • facebook.notifications provides methods to send messages to users.
  • facebook.profile allows you to set FBML in a user’s profile.
  • facebook.users provides information about your users (such as content from the user’s profile and whether they are logged in).
  • facebook.actions provides ways to access Facebook actions.
  • facebook.groups provides methods to access information for Facebook groups.
  • facebook.photos provides methods to interact with Facebook photos.

Facebook Query Language

The Facebook Query Language (FQL) is a SQL-style language particularly calculated to allow developers to interact with Facebook information. Facebook allows you to interact with nine separate “tables” to query information frankly. You have access to the following:

  • user
  • friend
  • group
  • group_member
  • event
  • event_member
  • photo
  • album
  • phototag

I’ll get into the specifics of the information you have access to in these “tables” later in next article, but suffice to say, Facebook exposes a lot of information to you for your application. And, like most SQL implementations, some additional functions allow you to take a few shortcuts when you request user information:

  • now() returns the current time.
  • strlen(string) returns the length of the string passed to the function.
  • concat(string1, string2,…, stringN) concatenates N strings collectively.
  • substr(string, start, length) returns a substring from a given string.
  • strpos(haystack, needle) returns the position of the character needle in the string haystack.
  • lower(string) casts the given string to lowercase.
  • upper(string) casts the given string to uppercase.

To write FQL, you follow basic SQL syntax. For example, to wring my name and picture from Facebook, you would write a simple query like so:

SELECT name, pic
FROM user
WHERE uid = 7608007

The previous snippet, when executed by the Facebook platform, will return a structure (in a format that you define in your call) with a URL to the image of the profile image for user 7608007. Calls like these are helpful in charitable you granular control of the information you get back from the API.

Facebook JavaScript

To minimize the threat of cross-site scripting (XSS) attacks, Facebook implemented its own JavaScript for developers who really want, or need, to use JavaScript in their applications. Facebook scrubs (removes) much of the JavaScript you can add to your application, but by using Facebook JavaScript (FBJS) you can still enrich the user’s experience. Facebook formally released FBJS 1.0 in September 2007. If you’re well versed in JavaScript, you’ll pick this up promptly (or perhaps find it maddening). The following is a quick example of how you can grant a modal dialog box to your users:

<a href="#" onclick="new Dialog().showMessage('Dialog', 'This is the help message
for this link');return fake">Show Dialog Box</a>

When processed through the Facebook platform, a user will be shown the modal dialog box represented in Figure 1-1 after clicking the Show Dialog Box hyperlink. Not terrible for a single line of code!

Client Libraries

The Facebook platform provides many tools to access information, but you are responsible
for providing your own business logic through some other language. Facebook facilitates
this through “official” client libraries for both PHP and Java that grant convenient
methods to access the Facebook application. But, not everyone in the universe uses
Java and PHP exclusively. To help the rest of the programmers who want to develop their
own Facebook application, client libraries are available for the following languages:

  • ActionScript
  • ASP.NET
  • ASP (VBScript)
  • ColdFusion
  • C++
  • C#
  • D
  • Emacs Lisp
  • Lisp
  • Perl
  • PHP (4 and 5)
  • Python
  • Ruby
  • VB .NET
  • Windows movable

This complement of languages must take care of just about most developers today. And although these client libraries are not “officially” supported by Facebook (meaning they won’t answer your questions about using them), they are posted by the company with at least some implicit approval of life the “officially unofficial” client libraries. By the way, I’m still waiting for them to include a library for Assembly.

All entries filed under Social Network


Introducing the Facebook Platform
no responses - Posted 07.27.11
Facebook (http://www.facebook.com) has grown phenomenally over the past several years from an Ivy League social web application to the second largest social web site on the Internet. The creators of Facebook have done an impressive job focusing their social software on the college demographic. In a natural progression of the ...continue
Social Skills Today Are Being Lost
no responses - Posted 04.25.11
Social Networking Today Many personal social networking are now being lost today because people are losing the opportunity to 'read' body language. Social skills on-line tend to often be restricted to 140 characters per message and so are comprised of either bad spelling or the creation of an updated English ...continue
GibBook – Gibraltar Own Social Network Site
no responses - Posted 04.11.11
Gibbook.com: the social network for familiar faces Think global. Now think local. Now think Yanito, and you have the recipe for the social network designed as one-stop portal to all that is red & white. Gibbook.com was launched in late November 2010 not to compete with, but as one cosy, warm, familiar, ...continue
7 Deadly Twitter Sins
6 responses - Posted 12.05.10
We’ve talked about Twitter tips before. Everyone knows not to use all caps (really, you shouldn’t do that anywhere), but there are worse Twitter sins. Seven, to be exact. These are things you should never do or, if you have, stop doing them immediately on Twitter. 1. Location ...continue
Introduction to Facebook
5 responses - Posted 01.24.10
In this article, you learn about the Facebook phenomenon, where it came from, and what you can do with it. What Is Facebook? Facebook is a social networking website. To flesh out this definition a bit more, it’s an online community—a place where people can meet and interact; swap photos, videos, and ...continue
Google’s Wave: Many Online Apps in One Tool
1 response - Posted 08.20.09
GOOGLE HAS released to developers an early version of a complex colaboration and communications tool that consolidates features of e-mail, instant messaging, blogging, wikis, and multimedia management, as well as document sharing. Called Wave, the Web application is the equivalent of a Swiss army knife for consumer online services and is ...continue
App Mapping War Casualties Debuts for Memorial Day Weekend
no responses - Posted 05.24.09
Every age brings new wars, and every war brings public expressions of collective grief and respect for the dead. My parents' generation had the Vietnam Memorial, and their parents' generation now have the National World War II Memorial. Our generation has fought a very different, very difficult war in the ...continue
Google@Omgili Mashes Traditional Web Search With Social Buzz
no responses - Posted 05.24.09
Omgili, which we reviewed in 2007 as a top alt search engine, has focused on culling results from the weird corners of the web: Forums, boards, discussion groups - basically, anywhere you'd find purely or mostly subjective information. It's the polar opposite of Google search, which is practically a peer-reviewed ...continue


All content and source © 2010 Indometric. All rights reserved. See our Privacy Policy and DMCA Information