在使用FB的javascript寫應用程式不外乎最常用到的就是FB.api 但查到的文件不外乎都只是用來做資訊查詢... ex.
```javascript
FB.api({
method:'fql.query',
query:'SELECT uid,first_name,last_name FROM user WHERE is_app_user = 1 AND (uid IN (SELECT uid2 FROM friend WHERE uid1 = me())) '
},function(){
console.info(arguments);
});
// 或者是用Graph API來做資訊查詢 ex.
FB.api(object_id+"/likes",function(){
console.info(arguments);
});
// 但事實上FB.api真正的功能並不只如此 ex.
//讚
FB.api(object_id+"/likes","post",function(){
console.info(arguments);
});
//取消讚
FB.api(object_id+"/likes","delete");
//publish feed 至 https://graph.facebook.com/arjun/feed
FB.api("arjun/feed",{message:'hello'},"post",function(){
console.info(arguments);
});
```
帶入參數的個數和型態FB.api會自動去判断 善用這些東西很多事情就不用都透過php sdk來執行可以大量減少Server的負擔喔
沒有留言:
張貼留言