Friend Table

Problem

What’s the schema of the friend table?

Solution

The friend table records the friendship between two users. Its fields are listed in Table 8-7. Queries to this table will only return data the current user is allowed to see (meaning you can’t request friendships for users the current loggedinuser isn’t friends with). More information about this table, including an up-to-date listing of fields, can be found at http://wiki.developers.facebook.com/index.php/Friend_(FQL).

Table 8-7. friend table fields

Name

Type

Index

Description

uid1

int

uid (user ID) of the first user

uid2

int

uid (user ID) of the second user

Discussion

If you’d rather use the API to access friends, try the Friends.get() and the Friends.areFriends() methods.

This table isn’t all that useful on its own, since it contains only two data points, but it is very powerful when combined with the user table (see User Table).

Get Facebook Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.