FQL:stream_tag

From Facebook Developer Wiki (FbDevWiki.com)
Jump to: navigation, search

Query this table to return associations between users or Facebook Pages and the items they tag in status posts (by typing "@" and then the name of what they'd like to tag).

You can query the table in various ways to determine:

  • All the friends, Pages, events, and other Facebook objects one or more users has tagged in posts.
  • All the posts in which a user has tagged something.
  • All the users who have tagged a given object in a post.

Columns

Highlighted rows are indexable / searchable and one is usually required in the WHERE portion of the query.

Name Type Description
post_id string The ID of a post from the user's or Page's stream. This field, when used as an index, is used to retrieve users and the entities they've tagged.
actor_id string The user ID of the user or Page who tagged one or more entities in a post. This field, when used as an index, is used to retrieve all the posts and the entities the user has tagged.
target_id string The users, Pages, events, and other Facebook objects that have been tagged in one or more posts. This field, when used as an index, is used to retrieve all the entities that have been tagged in one or more posts.

Examples

Get all the posts in which a particular user has tagged someone or something on Facebook.

SELECT post_id,target_id FROM stream_tag WHERE actor_id=563683308

Get all the posts where a specific user was tagged, and which friends tagged that user.

SELECT post_id,actor_id FROM stream_tag WHERE target_id=563683308

Get all the users tagged in a given post.

SELECT target_id FROM stream_tag WHERE post_id=360768507589


Notes/Bugs/Gotchas

from a posting on the official docs (2011-02-01):

Misleading: The post_id field seems like it should correlate with the post_id field of the stream table, but in reality it seems to correlate with the object ID field of various objects (e.g. the status_id field of the status table)

Flaky: For two status updates (from the same user) with tagged users, returns tagging information correctly for one update but returns no information for the second. And it's not an issue of older tagging information being pruned; the status update for which information was not returned is the more recent one.

Incomplete?: This seems to be the only mechanism for retrieving tagging information for objects which are not photos or videos, and while it seems to (somewhat) work for status updates, I've yet to see it work for notes, link comments, etc. with the sample data I've fed it. Is this by design?

Personal tools
Namespaces
Variants
Actions
Navigation
Graph API
FQL
Toolbox