FB.Data.query以及在哪里可以找到Facebook数据库架构?

时间:2011-11-09 17:45:14

标签: facebook facebook-graph-api facebook-fql facebook-javascript-sdk

您好我们已经实现了以下代码

INIT块(工作

FB.init({
    appId: 'apiID',
    status: true, // check login status
    cookie: true, // enable cookies to allow the server to access the session
    oauth: true,  // enable OAuth 2.0
    xfbml: true,   // parse XFBML
    frictionlessRequests: true
});

登录栏(工作

FB.login(function(response) {
    if (response.authResponse) {
      console.log('User logged and fully authorize the app.');

    } else {
      console.log('User cancelled login or did not fully authorize.');
    }
  }, {scope: 'email,user_location,friends_location'});

DATA RETRIEVE块(不工作

var friends = FB.Data.query('SELECT uid, name, location FROM user WHERE uid IN (SELECT uid2 FROM friend WHERE uid1 = me() ORDER BY rand() LIMIT 15) AND has_added_app=0');

FB.Data.waitOn([friends], function() {
  FB.Array.forEach(friends.value, function(row) {
      console.log(row);
  });
});

“SELECT uid,name FROM user ...”不会出现最后一个问题。

有没有人知道facebook的“用户”和“朋友”表格的DB方案?其他表可以通过“FB.Data.query”访问?

谢谢!

修改

CORRECT DATA RETRIEVE块( WORKs

var friends = FB.Data.query('SELECT uid, name, hometown_location, current_location FROM user WHERE uid IN (SELECT uid2 FROM friend WHERE uid1 = me() ORDER BY rand() LIMIT 15) AND has_added_app=0');

FB.Data.waitOn([friends], function() {
  FB.Array.forEach(friends.value, function(row) {
      console.log(row);
  });
});

1 个答案:

答案 0 :(得分:1)

Facebook Query Language(FQL)的规范可与其他Facebook开发人员文档一起使用,包括userfriend表的模式。