Rest API

The Rest API is the set of Web Services that Facebook provides for retrieving data from and sending data to the Facebook platform.  As described elsewhere in this documentation, this API is really only part of the power of the Facebook Platform.  The Developer Wiki is the best source of up to date information on the REST api.

The API uses a REST-like interface. This means that our Facebook method calls are made over the internet by sending HTTP GET or POST requests to the Facebook API REST server . Nearly any computer language can be used to communicate over HTTP with the REST server.

One of the core features of the Facebook Developer Toolkit is that it simplifies communication with the REST Api and provides strongly typed .NET objects that represent ALL the data that is returned from the various REST calls.  The toolkit provides all the plumbing to compose the parameters using the mechanism that Facebook expects and also to parse the returned data and provide it with easy to use entity objects that are generated from Facebook’s schema.

Available API Methods

From Facebook Developer Wiki (as of 7/14/2009)


admin.getAllocation
Returns the current allocation limit for your application for the specified integration point.
admin.getAppProperties
Returns values of properties for your applications from the Facebook Developer application.
admin.getMetrics
Returns specified metrics for your application, given a time period.
admin.getRestrictionInfo
Returns the demographic restrictions for the application.
admin.setAppProperties
Sets values for properties for your applications in the Facebook Developer application.
admin.setRestrictionInfo
Sets the demographic restrictions for the application.
admin.banUsers
Prevents users from accessing an application's canvas page and its forums.
admin.unbanUsers
Unbans users previously banned with admin.banUsers.
admin.getBannedUsers
Returns the list of users who have been banned from the application.
application.getPublicInfo
Returns public information about a given application (not necessarily your own).
auth.createToken
Creates an auth_token to be passed in as a parameter to login.php and then to auth.getSession after the user has logged in.
auth.expireSession
Expires the session indicated in the API call, for your application.
auth.getSession
Returns the session key bound to an auth_token, as returned by auth.createToken or in the callback URL.
auth.promoteSession
Returns a temporary session secret associated to the current existing session, for use in a client-side component to an application.
auth.revokeAuthorization
If this method is called for the logged in user, then no further API calls can be made on that user's behalf until the user decides to authorize the application again.
auth.revokeExtendedPermission
Removes a specific extended permission that a user explicitly granted to your application.
batch.run
Execute a list of individual API calls in a single batch.
comments.add (BETA)
Adds a comment for a given xid on behalf of a user. Calls with a session secret may only act on behalf of the session user.
comments.get
Returns all comments for a given xid posted through fb:comments. This method is a wrapper for the FQL query on the comment FQL table.
comments.remove (BETA)
Removes a comment for a given xid by comment_id. Calls with a session secret may only act on behalf of the session user.
connect.getUnconnectedFriendsCount
Returns the number of friends of the current user who have accounts on your site, but have not yet connected their accounts. (for [{Facebook Connect]]).
connect.registerUsers
Creates an association between an existing user account on your site and that user's Facebook account, provided the user has not connected accounts before (for Facebook Connect).
connect.unregisterUsers
Unregisters a previously registered account (using connect.registerUsers). You should call this method if the user deletes his or her account on your site. (for Facebook Connect).
data.getCookies (BETA)
Returns all cookies for a given user and application.
data.setCookie (BETA)
Sets a cookie for a given user and application.
events.cancel
Cancels an event. The application must be an admin of the event.
events.create
Creates an event on behalf of the user if the application has an active session; otherwise it creates an event on behalf of the application.
events.edit
Edits an existing event. The application must be an admin of the event.
events.get
Returns all visible events according to the filters specified.
events.getMembers
Returns membership list data associated with an event.
events.rsvp
Sets the attendance option for the current user.
fbml.deleteCustomTags
Deletes one or more custom tags you previously registered for the calling application with fbml.registerCustomTags.
fbml.getCustomTags
Returns the custom tag definitions for tags that were previously defined using fbml.registerCustomTags.
fbml.refreshImgSrc
Fetches and re-caches the image stored at the given URL.
fbml.refreshRefUrl
Fetches and re-caches the content stored at the given URL.
fbml.registerCustomTags
Registers custom tags you can include in your that applications' FBML markup. Custom tags consist of FBML snippets that are rendered during parse time on the containing page that references the custom tag.
fbml.setRefHandle
Associates a given "handle" with FBML markup so that the handle can be used within the fb:ref FBML tag.
fbml.uploadNativeStrings
Lets you insert text strings into the Facebook Translations database so they can be translated.
feed.deactivateTemplateBundleByID
Deactivates a previously registered template bundle.
feed.getRegisteredTemplateBundleByID
Retrieves information about a specified template bundle previously registered by the requesting application.
feed.getRegisteredTemplateBundles
Retrieves the full list of all the template bundles registered by the requesting application.
feed.publishTemplatizedAction
Publishes a Mini-Feed story to the Facebook Page corresponding to the page_actor_id parameter.
Note: This method is deprecated for actions taken by users only; it still works for actions taken by Facebook Pages.
feed.publishUserAction
Publishes a story on behalf of the user owning the session, using the specified template bundle.
feed.registerTemplateBundle
Builds a template bundle around the specified templates, registers them on Facebook, and responds with a template bundle ID that can be used to identify your template bundle to other Feed-related API calls.
fql.query
Evaluates an FQL (Facebook Query Language) query.
fql.multiquery
Evaluates a series of FQL (Facebook Query Language) queries in one call and returns the data at one time.
friends.areFriends
Returns whether or not each pair of specified users is friends with each other.
friends.get
Returns the identifiers for the current user's Facebook friends.
friends.getAppUsers
Returns the identifiers for the current user's Facebook friends who have authorized the specific calling application.
friends.getLists
Returns the identifiers for the current user's Facebook friend lists.
friends.getMutualFriends
Returns the identifiers for the requested users' Mutual Facebook friends.
groups.get
Returns all visible groups according to the filters specified.
groups.getMembers
Returns membership list data associated with a group.
intl.getTranslations (BETA)
Returns an array of strings from your application that you submitted for translation. This call returns the original native strings, the best (or all) translations of native strings into a given locale, whether the string has been approved, and by whom.
links.get (BETA)
Returns all links the user has posted on their profile through your application.
links.post (BETA)
Lets a user post a link on their Wall through your application.
liveMessage.send (BETA)
Sends a "message" directly to a user's browser, which can be handled in FBJS.
notes.create (BETA)
Lets a user write a Facebook note through your application.
notes.delete (BETA)
Lets a user delete a Facebook note that was written through your application.
notes.edit (BETA)
Lets a user edit a Facebook note through your application.
notes.get (BETA)
Returns a list of all of the visible notes written by the specified user.
notifications.get
Returns information on outstanding Facebook notifications for current session user.
notifications.send
Sends a notification to a set of users.
notifications.sendEmail
Sends an email to the specified users who have the application.
pages.getInfo
Returns all visible pages to the filters specified.
pages.isAdmin
Checks whether the logged-in user is the admin for a given Page.
pages.isAppAdded
Checks whether the Page has added the application.
pages.isFan
Checks whether a user is a fan of a given Page.
photos.addTag
Adds a tag with the given information to a photo.
photos.createAlbum
Creates and returns a new album owned by the current session user.
photos.get
Returns all visible photos according to the filters specified.
photos.getAlbums
Returns metadata about all of the photo albums uploaded by the specified user.
photos.getTags
Returns the set of user tags on all photos specified.
photos.upload
Uploads a photo owned by the current session user and returns the new photo.
profile.getFBML
Gets the FBML that is currently set for a user's profile.
profile.getInfo
Returns the specified user's application info section for the calling application.
profile.getInfoOptions
Returns the options associated with the specified field for an application info section.
profile.setFBML
Sets the FBML for a user's profile, including the content for both the profile box and the profile actions.
profile.setInfo
Configures an application info section that the specified user can install on the Info tab of her profile.
profile.setInfoOptions
Specifies the objects for a field for an application info section.
status.get (BETA)
Returns the user's current and most recent statuses.
status.set (BETA)
Updates a user's Facebook status through your application. This is a streamlined version of users.setStatus.
stream.addComment (BETA)
This method adds a comment to a post that was already published to a user's Wall.
stream.addLike (BETA)
This method lets a user add a like to any post the user can see. A user can like each post only once.
stream.get (BETA)
This method returns an object (in JSON-encoded or XML format) that contains the stream from the perspective of a specific viewer -- a user or a Facebook Page.
stream.getComments (BETA)
This method returns all comments associated with a post in a user's stream. This method returns comments only if the user who owns the post (that is, the user published the post to his or her profile) has authorized your application.
stream.getFilters (BETA)
This method returns any filters a user has specified for his or her home page stream.
stream.publish (BETA)
This method publishes a post into the stream on the user's Wall and News Feed. This post also appears in the user's friends' streams (their News Feeds).
stream.remove (BETA)
This method removes a post from a user's Wall. The post also gets removed from the user's and the user's friends' News Feeds. Your application may only remove posts that were created through it.
stream.removeComment (BETA)
This method removes a comment from a post.
stream.removeLike (BETA)
This method removes a like a user added to a post.
users.getInfo
Returns a wide array of user-specific information for each user identifier passed, limited by the view of the current user.
users.getLoggedInUser
Gets the user ID (uid) associated with the current session.
users.getStandardInfo
Returns an array of user-specific information for use by the application itself.
users.hasAppPermission
Checks whether the user has opted in to an extended application permission.
users.isAppUser
Returns whether the user (either the session user or user specified by UID) has authorized the calling application.
users.isVerified (BETA)
Returns whether the user is a verified Facebook user.
users.setStatus
Updates a user's Facebook status.
video.getUploadLimits (BETA)
Returns the file size and length limits for a video that the current user can upload through your application.
video.upload
Uploads a video owned by the current session user and returns the video.

Batching API

batch.run
run multiple api calls within one call.

Data Store API BETA

User Preference API

Note: Desktop applications can call these methods.

* data.setUserPreference update one preference
* data.setUserPreferences update multiple preferences in batch
* data.getUserPreference get one preference of a user
* data.getUserPreferences get all preferences of a user

Object Data Definition API

Note: Desktop applications cannot call these methods.

* data.createObjectType create a new object type
* data.dropObjectType delete an object type and all objects of this type
* data.renameObjectType rename an object type
* data.defineObjectProperty add a new property
* data.undefineObjectProperty remove a previously defined property
* data.renameObjectProperty rename a previously defined property
* data.getObjectTypes get a list of all defined object types
* data.getObjectType get detailed definition of an object type

Object Data Access API

Note: Desktop applications cannot call these methods.

* data.createObject create a new object
* data.updateObject update an object's properties
* data.deleteObject delete an object by its id
* data.deleteObjects delete multiple objects by ids
* data.getObject get an object's properties by its id
* data.getObjects get properties of a list of objects by ids
* data.getObjectProperty get an object's one property
* data.setObjectProperty set an object's one property
* data.getHashValue get a property value by a hash key
* data.setHashValue set a property value by a hash key
* data.incHashValue increment/decrement a property value by a hash key
* data.removeHashKey delete an object by its hash key
* data.removeHashKeys delete multiple objects by their hash keys

Association Data Definition API

Note: Desktop applications cannot call these methods.

* data.defineAssociation create a new object association
* data.undefineAssociation remove a previously defined association and all its data
* data.renameAssociation rename a previously defined association
* data.getAssociationDefinition get definition of a previously defined association
* data.getAssociationDefinitions get definitions of all previously defined associations

Association Data Access API

Note: Desktop applications cannot call these methods.

* data.setAssociation create an association between two objects
* data.setAssociations create a list of associations between pairs of objects
* data.removeAssociation remove an association between two objects
* data.removeAssociations remove associations between pairs of objects
* data.removeAssociatedObjects remove all associations of an object
* data.getAssociatedObjects get ids of an object's associated objects
* data.getAssociatedObjectCount get count of an object's associated objects
* data.getAssociatedObjectCounts get counts of associated objects of a list of objects.
* data.getAssociations get all associations between two objects

Facebook Connect API Methods

You can use most any Platform API call Facebook Connect. In addition, here are the API methods specific to Connect:

connect.getUnconnectedFriendsCount
This method returns the number of friends of the current user who have accounts on your site, but have not yet connected their accounts.
connect.registerUsers
This method is used to create an association between an external user account and a Facebook user account.
connect.unregisterUsers
This method allows a site to unregister a previously registered account (using connect.registerUsers).

Permissions API BETA

With the permissions API, an application can authorize another application to call certain API methods on its behalf. The application can revoke this access whenever necessary. At this time, the permissions API allows applications to grant others access to these methods:

We'll add more methods and namespaces to this list as needed.

You can specify which of these API methods and/or namespaces are accessible within the application. For example, application A can choose to have application B gather certain stats for it by giving it permission to call admin.getMetrics on its behalf, or it can just grant B permission to call all admin namespace methods by granting permission for admin. This implies permission to call the three allowed methods. Note that:

Be aware that the permissions API provides a unique ability to ease some work for applications and is very powerful. So permissions should be granted to other applications with utmost care.

Retrieved from "http://wiki.developers.facebook.com/index.php/API" (There is much more detailed information available at this site)