online job

Monday 24 March 2014

Improving Application Performance and Workflow

Improving Application Performance and Workflow

$facebook->api_client->batch_mode =
FacebookRestClient::BATCH_MODE_PARALLEL;
All the batched calls are executed on the Facebook servers, even if one of them has an
error. Unfortunately, the PHP client library throws a FacebookRestClientException exception
the first time it encounters an error as it parses the results of the batch run.This
means that only those result references the library has already set at that point have values,
and you won’t know what happened with the rest of the batched calls.
FQL
FQL provides developers with a SQL-like interface to the data store that backs the Facebook
Platform. It has several advantages over using the API functions. First, you can constrain
the data returned, which can reduce query times and bandwidth. Second, you can
replace multiple API calls with FQL statements that use multiple tables instead. FQL speed
improvements are large enough that many of the API calls themselves just wrap FQL
queries internally.We start with an overview of FQL queries, use the fql.multiquery()
function to perform multiple queries that can reference each other, and finish with looking
at how to run queries on page load using Preload FQL.
FQL Overview
FQL queries are in this format:
SELECT [fields] FROM [table] WHERE [conditions] [ORDER BY {field}]
[LIMIT {[offset,] row count}]
The FROM clause must reference a single table, as shown in Table 16.1.You can access
the full list of tables that comprise the Facebook data store at http://wiki.developers.facebook.
com/index.php/FQL_Tables. Facebook defines a few fields for each of these tables as being
indexable, which means that indexes have been created for them in the data store for performance
reasons.The WHERE clause must contain at least one indexable field, but not
everything in the WHERE clause must be indexable.
Table 16.1 FQL Tables and Equivalent API Functions
Table Name Description API Equivalent
album Information about a photo album,
such as the name.
photos.getAlbums()
application Information about a specific
application, such as name
and usage metrics.
admin.getAppPropertie
Table 16.1 FQL Tables and Equivalent API Functions
Table Name Description API Equivalent
comment Information about a set of
user comments, such as the
comment’s creator and text.
comments.get()
cookies Information about a user
cookie, such as the cookie’s
name and value.
data.getCookies()
connection Information about a user’s
connections, such as which
Public Profiles they are a Fan
of and who their friends are.
pages.isFan() and
friends.areFriends()
event Information about an event,
such as the name and date.
events.get()
event_member Information about a user’s
status for an event, such as
whether they have RSVP’d.
events.get()
friend Information about a whether
two users are friends.
friends.areFriends()
friend_request Information about whether a
friend request has been sent
from or received by the
logged-in user.
No equivalent
friendlist Information about the friend
lists the logged-in user has
created.
friends.getLists()
friendlist_member Information about which
users are a member of a
friend list.
friends.getLists()
group Information about a specific
group, such as the name
and description.
groups.get()
group_member Information about the members
of a group, such as the
position they have.
groups.get() and
groups.getMembers()
link Information about a specific
link, such as the title
and URL.
links.get()
mailbox_folder Information about a user’s
Inbox folders, such as name
and unread count. This requires
the read_mailbox
permission for access.
message.getThreadsInF
older()
message Information about a message
in an Inbox thread,
such as author and body.
This requires the
read_mailbox permission
for access.
message.getThreadsInF
older()
metrics Information about an application’s
metrics, such as the
total number of users and
page views.
admin.getMetrics()
note Information about a specific
note, such as the content
and title.
notes.get()
notifications Information about the notifications
for a user, such as title
and application id.
notifications.getList
()
page Information about a Public
Profile, such as the name
and profile picture.
pages.getInfo()
page_admin Information about a Public
Profile administrator, such
as the page ID and type they
administer.
pages.getInfo() and
pages.isAdmin()
page_fan Information about a Public
Profile Fan, such as the
page ID and type they are a
fan of.
pages.getInfo() and
pages.isFan()
permissions Information about the extended
permissions a user
has granted, such as email
and offline access.
Permissions.checkGran
tedApiAccess()
photo Information about a specific
photo, such as its URL and
caption.
photos.get()

No comments: