ソーシャルグラフを操作する API の整理


By Porter Novelli Global

Facebook

ユーザ A が B に friend request を送り、B が承認すれば A と B は friend になる

  • friend を取得

GET //friends

http://developers.facebook.com/docs/reference/api/user/
  • 受け取った friend request を取得 (FQL)

SELECT uid_from FROM friend_request WHERE uid_to=

http://developers.facebook.com/docs/reference/fql/friend_request/

read_requests - Provides read access to the user's friend requests

http://developers.facebook.com/docs/authentication/permissions
  • テストユーザの friend request を操作

POST /test_user_id_1/friends/test_user_id_2
POST /test_user_id_2/friends/test_user_id_1

  1. test_user_id_1 の権限による呼び出しで test_user_id_1 から test_user_id_2 へ friend request が送られる
  2. test_user_id_2 の権限による呼び出しで request が承認される
http://developers.facebook.com/docs/test_users/

Twitter

ユーザ A が B を follow すると、 A 視点で B は friend、B 視点で A は follower になる
ユーザ B が protected だった場合、A は B に対して follow request を送ることができる

  • friend を取得

GET /1/friends/ids.xml?user_id=

http://dev.twitter.com/doc/get/friends/ids
  • follower を取得

GET /1/followers/ids.xml?user_id=

http://dev.twitter.com/doc/get/followers/ids
  • follow する

POST /1/friendships/create.xml

http://dev.twitter.com/doc/post/friendships/create
  • follow をやめる

POST /1/friendships/destroy.xml

http://dev.twitter.com/doc/post/friendships/destroy
  • follow しているか否かを取得する

GET /1/friendships/exists.xml?user_a=&user_b=

http://dev.twitter.com/doc/get/friendships/exists
  • 受け取った follow request を取得

GET /1/friendships/incoming.xml

http://dev.twitter.com/doc/get/friendships/incoming
  • 送った follow request を取得

GET /1/friendships/outgoing.xml

http://dev.twitter.com/doc/get/friendships/outgoing
  • 受け取った follow request を承認

POST /1/friendships/accept.xml
POST /1/friendships/accept_all.xml

http://a2.twimg.com/a/1296525272/javascripts/api.bundle.js から発掘(非公式)
  • 受け取った follow request を否認

POST /1/friendships/deny.xml
POST /1/friendships/deny_all.xml

http://a2.twimg.com/a/1296525272/javascripts/api.bundle.js から発掘(非公式)
  • 送った follow request を削除

POST /1/friendships/cancel.xml

http://a2.twimg.com/a/1296525272/javascripts/api.bundle.js から発掘(非公式)
  • おすすめユーザを取得

GET /1/users/recommendations.xml?user_id=

http://a2.twimg.com/a/1296525272/javascripts/api.bundle.js から発掘(非公式)

(おまけ) OpenSocial 1.1

  • relationships を作成する

POST /rest/people/@self/@friends

  • 指定されたユーザに invitation が送られる
http://opensocial-resources.googlecode.com/svn/spec/1.1/Social-API-Server.xml#People-Service-CreateRelationship

まとめ

  • Facebook は request を操作する API が存在しない
    • FQL はあるが、受け取った request の取得のみサポート
    • read_requests というパーミッションが用意されている
    • テストユーザの request を操作する API は存在するが、テスト用途に限定
    • 自分が送った request については web からも確認することは不可能?