ããµã¤ãã¦ãºã»ã¢ããã³ãã«ã¬ã³ãã¼ãã®9æ¥ç®ã§ãï¼ããã¾ã§ã®è¨äºä¸è¦§ï¼ã
ããã«ã¡ã¯ããµã¤ãã¦ãºLive ãã¼ã ã®ç¦å¶ã§ãã
ãµã¤ãã¦ãºLive ã§ã¯ãFacebook ã¢ã«ã¦ã³ãã§ã®ã¦ã¼ã¶ã¼ç»é²ããã°ã¤ã³ãã§ãã¾ãã
ãããå®ç¾ããããã«ããµã¤ãã¦ãºLive ãµã¼ãããã Facebook Graph API ãå©ç¨ãã¦ãã¾ãã
ä»ã«ãããããªã¨ãã㧠Facebook Graph API ãå©ç¨ãã¦ããã®ã§ããµã¤ãã¦ãºLive ãå®éã«ä½¿ã£ã¦ããä¾ã交ãã¦ãFacebook Graph API ã§ã§ãããã¨ãç´¹ä»ãã¦ããã¾ãã
Facebook API Explorer
ãã®è¨äºã§ç´¹ä»ãã¦ãã API ã®å¤ãã¯ã Facebook API Explorer ã§è©¦ãã¾ãã
ãã®ä½¿ãæ¹ãç°¡åã«èª¬æãã¾ãã
- Facebook API Explorer ãéã
- ã¢ã¯ã»ã¹ãã¼ã¯ã³ãåå¾ ãã¿ã³ãæ¼ã
- Get Access Token ãã¿ã³ãæ¼ã
- Graph API Explorer ã® OAuth èªå¯ç»é¢ãåºãã®ã§ã Facebook ã§ãã°ã¤ã³ ãã¿ã³ãæ¼ã
- Facebook API Explorer ã®ã¢ã¯ã»ã¹ãã¼ã¯ã³ã®æ¬ã«æååãæ¿å ¥ããã
- API ã® URL ãªã©ãå ¥åã㦠éä¿¡ ãã¿ã³ãæ¼ã
- å®è¡çµæã表示ããã
- 2ï½5 ã¯ååã ãå¿ è¦ãªæé ã§ãã
- è¨äºã®å¾åã§ç»å ´ãããç¹å¥ãªæ¨©éï¼publish_stream ãªã©ï¼ãå¿ è¦ãªå ´åã¯ã3 ã§æ示çã«æå®ãã¾ãã
OAuth èªè¨¼
å¤ãã® Facebook Graph API ã¯ãOAuth èªè¨¼ããªãã¨å¼ã³åºãã¾ãããOAuth2 ãªã®ã§ãOAuth1 ã¨æ¯ã¹ã¦å®è£ ãç°¡åã§ãã
ããã詳ãã説æãå§ããã¨ãä»ãæ¸ããªããªãã®ã§ããããªãå²æãã¾ãã
ãµã¤ãã¦ãºLive ã§ã¯
Facebook ã¢ã«ã¦ã³ãã§ã®ã¦ã¼ã¶ã¼ç»é²ããã°ã¤ã³ã§ããã®ä»çµã¿ã使ã£ã¦ãã¾ãã
å ¬å¼ããã¥ã¡ã³ã
https://developers.facebook.com/docs/reference/dialogs/oauth/
ã¦ã¼ã¶ã¼æ å ±ã¨æ¥æ¬èªè¡¨è¨ã®æ°åãåå¾ãã
IDãæ°åãåºèº«å°ãªã©ã®ã¦ã¼ã¶ã¼æ å ±ãåå¾ãã¾ãã
ãµã¤ãã¦ãºLive ã§ã¯
Facebook ã¢ã«ã¦ã³ãã§ã®ã¦ã¼ã¶ã¼ç»é²ã§ããµã¤ãã¦ãºLive ã«ç»é²ããã¦ã¼ã¶ã¼æ å ±ãåå¾ããããã«ä½¿ç¨ãã¦ãã¾ãã
å ¬å¼ããã¥ã¡ã³ã
https://developers.facebook.com/docs/reference/api/user/
ãªã¯ã¨ã¹ã
GET https://graph.facebook.com/me
- me ã®é¨åã FacebookID ã«ããã¨ããã®äººã®ã¦ã¼ã¶ã¼æ å ±ãåå¾ã§ãã¾ãã
ã¬ã¹ãã³ã¹
{ "id": "1234567890", "name": "Noboru Sato", "first_name": "Noboru", "last_name": "Sato", "username": "noboru.sato", ...(ç¥)... }
æ¥æ¬èªè¡¨è¨ã®æ°åãåå¾ããã«ã¯
ããã§åå¾ã§ããæ°åã¯è±èªè¡¨è¨ã§ãã æ¥æ¬èªè¡¨è¨ã®ï¼ãã¼ã«ã©ã¤ãºãããï¼æ°åãåå¾ããã«ã¯ãFQL ã使ãã¾ãã
ãªã¯ã¨ã¹ã
GET https://graph.facebook.com/fql?q=SELECT name FROM profile WHERE id = me()
ã¬ã¹ãã³ã¹
{ "data": [ { "name": "ä½è¤ æ" } ] }
åéæ å ±ã¨æ¥æ¬èªè¡¨è¨ã®æ°åãåå¾ãã
èªåã®åéã®ã¦ã¼ã¶ã¼æ å ±ãåå¾ãã¾ãã
ãµã¤ãã¦ãºLive ã§ã¯
ã°ã«ã¼ããªã©ã¸ã®æå¾ æã« Facebook ã®åéãåè£ã¨ãã¦è¡¨ç¤ºããããã«ä½¿ç¨ãã¦ãã¾ãã
å ¬å¼ããã¥ã¡ã³ã
https://developers.facebook.com/docs/reference/api/user/#friends
ãªã¯ã¨ã¹ã
GET https://graph.facebook.com/me/friends
æ¥æ¬èªè¡¨è¨ã®æ°åãåå¾ããã«ã¯
ãã¡ããåæ§ã«è±èªè¡¨è¨ãªã®ã§ãæ¥æ¬èªè¡¨è¨ã®æ°åãåå¾ããã«ã¯ä»¥ä¸ã® FQL ãæãã¾ãã
GET https://graph.facebook.com/fql?q=SELECT id,name FROM profile WHERE id IN (SELECT uid2 FROM friend WHERE uid1 = me())
ãããã£ã¼ã«ç»åã® URL ãåå¾ãã
ãããã£ã¼ã«ç»åã®ãã¤ããªãã¼ã¿ãåå¾ã§ãã¾ãã
ãµã¤ãã¦ãºLive ã§ã¯
ã¦ã¼ã¶ã¼ç»é²æã®ãããã£ã¼ã«ç»åã®åå¾ãªã©ã«ä½¿ç¨ãã¦ãã¾ãã
å ¬å¼ããã¥ã¡ã³ã
https://developers.facebook.com/docs/reference/api/using-pictures/
ãªã¯ã¨ã¹ã
GET https://graph.facebook.com/[ID]/picture
- ID é¨åã¯ãFacebookID ãæå®ãã¾ãã
- ãã©ã¡ã¼ã¿ã« type ã渡ãã¨ãç»åãµã¤ãºãæå®ã§ãã¾ããæå®ã§ããå¤ã¯ãsquare, small, normal, large ã§ãã
ãã® API ã¯ãOAuth èªå¯ä¸è¦ãªã®ã§ã img ã¿ã°ã§æå®ãã¦ç°¡åã«ä½¿ãã¾ãã
<img src="https://graph.facebook.com/[ID]/picture" />
ãã¼ããã·ã§ã³ãåå¾ãã
OAuth èªå¯å¾ã«ãæå¾ ãã権éãã¦ã¼ã¶ã¼ãä¸ãã¦ããããã©ããããå¼ã³åºã API ã«å¿ è¦ãªæ¨©éãå¥å¥ªããã¦ããªããããã§ãã¯ããå¿ è¦ãã§ã¦ãã¾ãã
ãµã¤ãã¦ãºLive ã§ã¯
ã¦ã©ã¼ã«ã®æ¸ãè¾¼ã¿åãããã£ããã¡ãã»ã¼ã¸éä¿¡åãªã©ã®æ¨©éãã§ãã¯ã§ä½¿ç¨ãã¦ãã¾ãã
å ¬å¼ããã¥ã¡ã³ã
https://developers.facebook.com/docs/reference/api/user/#permissions
ãªã¯ã¨ã¹ã
GET https://graph.facebook.com/me/permissions
ã¬ã¹ãã³ã¹
{ "data": [ { "publish_stream": 1, "status_update": 1, "photo_upload": 1, "video_upload": 1, "email": 1, ...(ç¥)... } ] }
ãã¨ãã°ã publish_stream ã®å¤ã 1 ãªããã¦ã©ã¼ã«æ¸ãè¾¼ã¿æ¨©éãããã¨ãããã¨ãåããã¾ãã
åéãªã¹ããåå¾ãã
èªåã®åéãªã¹ããåå¾ãã¾ãã read_friendlists 権éãå¿ è¦ã§ãã
ãµã¤ãã¦ãºLive ã§ã¯
ãµã¤ãã¦ãºLive ã«æå¾ ãã Facebook ã®åéãåéãªã¹ãã§çµãè¾¼ãããã«ä½¿ç¨ãã¦ãã¾ãã
å ¬å¼ããã¥ã¡ã³ã
https://developers.facebook.com/docs/reference/api/FriendList/
ãªã¯ã¨ã¹ã
GET https://graph.facebook.com/me/friendlists
åéãªã¹ãã®ã¡ã³ãã¼ãåå¾ããã«ã¯
GET https://graph.facebook.com/[åéãªã¹ãID]/members
Facebook ã°ã«ã¼ããåå¾ãã
èªåãæå±ãã Facebook ã°ã«ã¼ããåå¾ãã¾ãã user_groups 権éãå¿ è¦ã§ãã
ãµã¤ãã¦ãºLive ã§ã¯
ãµã¤ãã¦ãºLive ã«æå¾ ãã Facebook ã®åéã Facebook ã°ã«ã¼ãã§çµãè¾¼ãããã«ä½¿ç¨ãã¦ãã¾ãã
å ¬å¼ããã¥ã¡ã³ã
https://developers.facebook.com/docs/reference/api/group/
ãªã¯ã¨ã¹ã
GET https://graph.facebook.com/me/groups
Facebookã°ã«ã¼ãã®ã¡ã³ãã¼ãåå¾ããã«ã¯
GET https://graph.facebook.com/[Facebookã°ã«ã¼ãID]/members
ã¦ã©ã¼ã«ã«æ¸ãè¾¼ã
èªåã®ã¦ã©ã¼ã«ã«æ稿ãã¾ãã post_stream 権éãå¿ è¦ã§ãã
ãµã¤ãã¦ãºLive ã§ã¯
ãµã¤ãã¦ãºLive ã®ã¦ã¼ã¶ã¼ç»é²æã«ãä»»æ㧠Facebook ã®ã¦ã©ã¼ã«ã«æ¸ãè¾¼ãããã«ä½¿ç¨ãã¦ãã¾ãã
å ¬å¼ããã¥ã¡ã³ãï¼
https://developers.facebook.com/docs/reference/api/user/#posts
ãªã¯ã¨ã¹ã
POST https://graph.facebook.com/me/feed
ãã©ã¡ã¼ã¿
- message: ã¡ãã»ã¼ã¸
- link: ãªã³ã¯ã®URL
- name: ãªã³ã¯ã®è¡¨ç¤ºå
- caption: ãªã³ã¯ã®ãã£ãã·ã§ã³
- description: 説æ
- picture: ã¢ã¤ãã£ããç»åã®URL
message ã«ã¦ã¼ã¶ã¼ãå ¥åãããã®ä»¥å¤ãæå®ããã¨ãè¦ç´éåã«ãªãã®ã§æ³¨æãã¾ãããã message 以å¤ã¯èªç±ã«æå®ã§ãã¾ãã
æ稿çµæ
ä»äººã®ã¦ã©ã¼ã«ã«æ¸ãè¾¼ãã«ã¯
以ä¸ã®ããã« URL ã® me ã FacebookID ã«ããã¨ãä»äººã®ã¦ã©ã¼ã«ã«æ¸ãè¾¼ãã¾ãã
POST https://graph.facebook.com/[ID]/feed
ãã ããè¿ã ç¦æ¢ãããäºå®ã§ãã
ãã£ããã¡ãã»ã¼ã¸ãéä¿¡ãã
æå®ã®åéã«ãã£ããã¡ãã»ã¼ã¸ãéä¿¡ãã¾ããç¸æããªã³ã©ã¤ã³ã®æã¯ãã£ããã¡ãã»ã¼ã¸ãéä¿¡ããã¾ããããªãã©ã¤ã³ã®æã¯ã¡ãã»ã¼ã¸ãéä¿¡ããã¾ãã xmpp_login 権éãå¿ è¦ã§ãã
ãµã¤ãã¦ãºLive ã§ã¯
ãµã¤ãã¦ãºLive ã§ã¯ãã°ã«ã¼ããªã©ã¸ã®æå¾ ç¶ãéä¿¡ããããã«ãã¡ãã»ã¼ã¸ãéãããã®ã§ãããæ®å¿µãªããã¡ãã»ã¼ã¸éä¿¡ API ãæä¾ããã¦ãã¾ããã
ã¡ãã»ã¼ã¸ããã¡ãªããã£ããããã°ãããããªãã¨ãããã¨ã§ããã£ããã¡ãã»ã¼ã¸ã§ä»£ç¨ãã¦ãã¾ãã
å ¬å¼ããã¥ã¡ã³ã
https://developers.facebook.com/docs/chat/
ãã£ããã¡ãã»ã¼ã¸éä¿¡ã¯ãFacebook Graph API ã§ã¯ãªã Facebook Chat API ã使ç¨ãã¾ãã
Facebook Chat API ã¯ã XMPP ä»æ§ã«åã£ã¦ããã®ã§ãåè¨èªã® XMPP ã©ã¤ãã©ãªã使ç¨ããã¨ããã§ãããã
chat.facebook.com:5222 ã«æ¥ç¶ãã[å®å FacebookID]@chat.facebook.com ã«å¯¾ãã¦ã¡ãã»ã¼ã¸ãéä¿¡ãã¾ãã
詳ããç¥ãããæ¹ã¯ããµã³ãã«ã³ã¼ããã覧ãã ããã
éç¥ãéä¿¡ããï¼Î² æ©è½ï¼
Facebook ã¢ããªããããã®ã¢ããªã¦ã¼ã¶ã¼ã«å¯¾ãã¦ãéç¥ãçºè¡ãããã¨ãã§ãã¾ããFacebook ã¢ããªã使ã£ã¦ããªã人ã«ã¯éä¿¡ã§ãã¾ããã
ãµã¤ãã¦ãºLive ã§ã¯
ä¸å®ééã§æ°çæ å ±ããã§ãã¯ãã¦ããã®æ å ±ã Facebook ã®éç¥ã¨ãã¦éä¿¡ãã¦ãã¾ãã
å ¬å¼ããã¥ã¡ã³ã
https://developers.facebook.com/docs/app-notifications/
ãªã¯ã¨ã¹ã
POST https://graph.facebook.com/[ID]/notifications?access_token=[APP_ACCESS_TOKEN]&template=[MESSAGE]
APP_ACCESS_TOKEN ã¯ãã¦ã¼ã¶ã¼ã®ã¢ã¯ã»ã¹ãã¼ã¯ã³ã§ã¯ãªããã¢ããªèªä½ã®ã¢ã¯ã»ã¹ãã¼ã¯ã³ã§ãã
ããã¯ã以ä¸ã® API ããåå¾ã§ãã¾ãã
GET https://graph.facebook.com/oauth/access_token?client_id=[CONSUMER_KEY]&client_secret=[CONSUMER_KEY_SECRET]&grant_type=client_credencials
以ä¸ã®ãããªçµæãè¿ã£ã¦ããã®ã§ã
access_token=ABCDEFG
access_token= ã®é¨åãæ¨ã¦ãæåå ABCDEFG ãã¢ããªã®ã¢ã¯ã»ã¹ãã¼ã¯ã³ã¨ãªãã¾ãã
å¤ãªãã©ã¡ã¼ã¿åãä»ããã«ãç´æ¥ã¢ã¯ã»ã¹ãã¼ã¯ã³ãè¿ãã¦ããããããã®ã«ãã¤ã±ã¦ã¾ããã
éç¥çµæ
ãã®éç¥ãã¯ãªãã¯ããã¨ãFacebook ãã£ã³ãã¹ãã¼ã¸ ã«é£ã¶ã®ã§ãFacebook ãã£ã³ãã¹ãã¼ã¸ãå¥éç¨æããå¿ è¦ãããã¾ãã
ãã®éç¥ãåãåã£ã人ã®ãã¡ãã¯ãªãã¯ãã人ã®å²åã 17% ãåãã¨ãéç¥éä¿¡ãæ¢ããããå¯è½æ§ãããã¾ãã
ç¾å¨ã®ã¯ãªãã¯çã¯ãã¢ããªã® Insight ã®ãç¥ããã§ç¢ºèªã§ããã®ã§ããã¾ãã«ãã§ãã¯ãã¾ãããã
ãã£ã¨ããµã¤ãã¦ãºLive ã使ç¨ãã¦ãã Facebook API ãç´¹ä»ãã¾ããã使ããã㪠API ã¯ããã¾ãããï¼
ç´ 1 å¹´åããµã¤ãã¦ãºLive ã Facebook ã¨é£æºãããã¨ã§ãã¦ã¼ã¶ã¼ããã£ã¨å¢ãã¾ããã
ããã㪠Web ãµã¼ãã¹ãã¢ããªã§ Facebook ã¨ã®é£æºãé²ãã¨å¬ããã§ãã
ææ¥ã¯ãè¨èªå¤å®ã®ä»çµã¿ãããéããã¾ããã楽ãã¿ã«ã