Stream filter (FQL)

From Facebook Developer Wiki

Revision as of 18:52, 12 October 2009 by Pete Bratach (Talk | contribs)
(diff) ←Older revision | Current revision (diff) | Newer revision→ (diff)
Jump to: navigation, search


Contents

Description

The FQL stream_filter table. Query this table to return a filter_key that can be used to query the stream FQL table, as seen through any content filters the user has available on Facebook. These include friend lists, applications, networks, and the home page stream (News Feed), which comprises all users and Pages the user has not hidden.

To structure your query, use the table name (stream_filter in this case) in the FROM clause. The items in the Name column correspond to columns in the table that can be referenced in the SELECT and WHERE clauses.

In order to make your query indexable, the WHERE in your query should contain an = or IN clause for one of the columns marked with a * in the Indexable column of the table.

Columns

IndexableNameTypeDescription
* uid string The ID of the user whose filters you are querying.
filter_key string A key identifying a particular filter for a user's stream. This filter is useful to retrieve relevant items from the stream table.
name string The name of the filter as it appears on the home page.
rank int A 32-bit int that indicates where the filter appears in the sort.
icon_url string The URL to the filter icon. For applications, this is the same as your application icon.
is_visible bool If true, indicates that the filter is visible on the home page. If false, the filter is hidden in the More link.
type string The type of filter. One of application, newsfeed, friendlist, network, or publicprofile.
value int A 64-bit ID for the filter type.

Examples

To get the filter keys for all the applications a user has authorized, format your query like this:

SELECT filter_key FROM stream_filter WHERE uid=<uid> AND type="application"


To get all the filters for a particular user, format your query like this:

SELECT filter_key FROM stream_filter WHERE uid=<uid>


A typical use case for this table piped into the stream filter. In this case, retrieving the News Feed of user 3.

SELECT post_id, actor_id, target_id, message FROM stream WHERE filter_key in (SELECT filter_key FROM stream_filter WHERE uid = 3 AND type = 'newsfeed')

See Also

reference