Twitter関連Twitter REST API:フレンドシップ関連
- friendships/create〔認証ユーザーが指定したユーザーをフォロー(要認証)〕
- friendships/destroy〔認証ユーザーから指定したユーザーのフォローを解除(要認証)〕
- friendships/exists〔指定した2人のユーザー同士が友達かどうか調べる(いずれかがつぶやきを非公開にしているユーザーの場合は要認証)〕
- friendships/show〔指定した2人のユーザーの関する情報を取得(認証不要)〕
- friendships/incoming〔認証ユーザーが保留中のフォローリクエストのユーザーIDを配列で返す(要認証)〕
- friendships/outgoing〔認証ユーザーがフォローリクエストを送ったプロテクトユーザーのIDを配列で返す(要認証)〕
friendships/create
認証ユーザーが指定したユーザーをフォロー(要認証)
2009/7/18
![]()
![]()
http://api.twitter.com/1/friendships/create.[xml|json]
認証ユーザーが指定したユーザーをフォローします。 成功した場合は、フォローしたユーザー情報を返します。 失敗した場合は、エラーの状態を表す文字列が返ります。 既にフォローしているユーザーの場合は、HTTP 403が返ります。
パラメーター
| パラメーター | 説明 | |
|---|---|---|
| user_id | 必須 |
フォローするユーザーのユーザーIDを指定。
有効なユーザーIDを明確に指定したい場合に使用。
まだ友達になっていないユーザーを指定。 例)http://api.twitter.com/1/friendships/create.xml?user_id=12345 |
| screen_name | 必須 |
フォローするユーザーのスクリーンネームを指定。
ユーザーIDとスクリーンネームが数値で紛らわしい場合に有用。
まだ友達になっていないユーザーを指定。 例)http://api.twitter.com/1/friendships/create.xml?screen_name=cocoism |
| follow | 任意 |
友達になることを相手に通知するか否かを真偽値(true/false)で指定。 例)http://api.twitter.com/1/friendships/create.xml?screen_name=cocoism&follow=true |
| include_entities | 任意 |
ステータス情報に'entities'を含める場合は、true,t,1のいずれかを指定。 例)http://api.twitter.com/1/friendships/create.xml?include_entities=true |
取得サンプル(XML/JSON)
create.xml
▼成功時
<?xml version="1.0" encoding="UTF-8"?>
<user>
<id>7948862</id>
<name>つんつ</name>
<screen_name>cocoism</screen_name>
<location>カワタマ or オモサン</location>
<description>青山でWeb系のお仕事してます。デザイナーズレストランははるか昔に卒業済。芋焼酎と焼鳥が大好きで居心地のいい呑み屋でおやじ談義するのがライフワーク。最近は日本酒をお勉強中。家では大人しく猛犬チワワのママしてます。iPhone4/Xperia所有。</description>
<profile_image_url>http://a0.twimg.com/profile_images/1202496271/usa_normal.png</profile_image_url>
<url>http://phpjavascriptroom.com/</url>
<protected>false</protected>
<followers_count>613</followers_count>
<profile_background_color>8350a1</profile_background_color>
<profile_text_color>f2afcf</profile_text_color>
<profile_link_color>f2afcf</profile_link_color>
<profile_sidebar_fill_color>8350a1</profile_sidebar_fill_color>
<profile_sidebar_border_color>8350a1</profile_sidebar_border_color>
<friends_count>527</friends_count>
<created_at>Sat Aug 04 05:52:33 +0000 2007</created_at>
<favourites_count>441</favourites_count>
<utc_offset>32400</utc_offset>
<time_zone>Tokyo</time_zone>
<profile_background_image_url>http://a1.twimg.com/profile_background_images/187449144/02.png</profile_background_image_url>
<profile_background_tile>true</profile_background_tile>
<profile_use_background_image>true</profile_use_background_image>
<notifications>true</notifications>
<geo_enabled>true</geo_enabled>
<verified>false</verified>
<following>true</following>
<statuses_count>4988</statuses_count>
<lang>ja</lang>
<contributors_enabled>false</contributors_enabled>
<follow_request_sent>false</follow_request_sent>
<listed_count>51</listed_count>
<show_all_inline_media>true</show_all_inline_media>
<default_profile>false</default_profile>
<default_profile_image>false</default_profile_image>
<is_translator>false</is_translator>
<status>
<created_at>Wed May 25 01:38:08 +0000 2011</created_at>
<id>73201147455864833</id>
<text>すご。 - 写真をHTMLテキストに変換してくれる「Textify」 【増田(@maskin)真樹】 http://bit.ly/lqM8f6</text>
<source><a href="http://www.nibirutech.com/mobilerss-google-reader-iphone.html" rel="nofollow">MobileRSS</a></source>
<truncated>false</truncated>
<favorited>false</favorited>
<in_reply_to_status_id></in_reply_to_status_id>
<in_reply_to_user_id></in_reply_to_user_id>
<in_reply_to_screen_name></in_reply_to_screen_name>
<retweet_count>0</retweet_count>
<retweeted>false</retweeted>
<geo/>
<coordinates/>
<place/>
<contributors/>
</status>
</user>
▼失敗時
<?xml version="1.0" encoding="UTF-8"?>
<hash>
<error>Not found</error>
<request>/1/friendships/create.xml</request>
</hash>
create.json
▼成功時 json[profile_background_color]=8350a1 json[protected]= json[statuses_count]=4988 json[profile_background_image_url]=http://a1.twimg.com/profile_background_images/187449144/02.png json[followers_count]=616 json[location]=カワタマ or オモサン json[name]=つんつ json[notifications]=1 json[profile_image_url]=http://a0.twimg.com/profile_images/1202496271/usa_normal.png json[id_str]=7948862 json[default_profile_image]= json[utc_offset]=32400 json[profile_text_color]=f2afcf json[url]=http://phpjavascriptroom.com/ json[default_profile]= json[profile_sidebar_fill_color]=8350a1 json[description]=青山でWeb系のお仕事してます。デザイナーズレストランははるか昔に卒業済。芋焼酎と焼鳥が大好きで居心地のいい呑み屋でおやじ談義するのがライフワーク。最近は日本酒をお勉強中。家では大人しく猛犬チワワのママしてます。iPhone4/Xperia所有。 json[screen_name]=cocoism json[is_translator]= json[lang]=ja json[profile_background_tile]=1 json[created_at]=Sat Aug 04 05:52:33 +0000 2007 json[status]['in_reply_to_screen_name']= json[status]['in_reply_to_user_id_str']= json[status]['contributors']= json[status]['retweeted']= json[status]['truncated']= json[status]['id_str']=73201147455864833 json[status]['text']=すご。 - 写真をHTMLテキストに変換してくれる「Textify」 【増田(@maskin)真樹】 http://bit.ly/lqM8f6 json[status]['in_reply_to_status_id']= json[status]['created_at']=Wed May 25 01:38:08 +0000 2011 json[status]['place']= json[status]['in_reply_to_user_id']= json[status]['id']=7.32011474559E+16 json[status]['source']=MobileRSS json[status]['favorited']= json[status]['in_reply_to_status_id_str']= json[status]['coordinates']= json[status]['geo']= json[status]['retweet_count']=0 json[follow_request_sent]= json[verified]= json[friends_count]=527 json[favourites_count]=441 json[profile_link_color]=f2afcf json[id]=7948862 json[contributors_enabled]= json[profile_sidebar_border_color]=8350a1 json[show_all_inline_media]=1 json[geo_enabled]=1 json[time_zone]=Tokyo json[listed_count]=51 json[following]=1 json[profile_use_background_image]=1 ▼失敗時 json[error]=Not found json[request]=/1/friendships/create.json
friendships/destroy
認証ユーザーから指定したユーザーのフォローを解除(要認証)
2009/7/18
![]()
![]()
http://api.twitter.com/1/friendships/destroy.[xml|json]
認証ユーザーから指定したユーザーのフォローを解除します。 成功した場合は、要求したフォーマットでフォローを解除したしたユーザー情報を返します。 失敗した場合は、エラーの状態を表す文字列が返ります。
パラメーター
| パラメーター | 説明 | |
|---|---|---|
| user_id | 必須 |
フォローを解除するのユーザーIDを指定。
有効なユーザーIDを明確に指定したい場合に使用。
フォローを解除したいユーザーを指定。 例)http://twitter.com/friendships/destroy.xml?user_id=12345 |
| screen_name | 必須 |
フォローを解除するユーザーのスクリーンネームを指定。
ユーザーIDとスクリーンネームが数値で紛らわしい場合に有用。
フォローを解除したいユーザーを指定。 例)http://twitter.com/friendships/destroy.xml?screen_name=54321 |
| include_entities | 任意 |
ステータス情報に'entities'を含める場合は、true,t,1のいずれかを指定。 例)http://api.twitter.com/1/friendships/create.xml?include_entities=true |
取得サンプル(XML/JSON)
destroy.xml
<?xml version="1.0" encoding="UTF-8"?>
<user>
<id>7948862</id>
<name>つんつ</name>
<screen_name>cocoism</screen_name>
<location>カワタマ or オモサン</location>
<description>青山でWeb系のお仕事してます。デザイナーズレストランははるか昔に卒業済。芋焼酎と焼鳥が大好きで居心地のいい呑み屋でおやじ談義するのがライフワーク。最近は日本酒をお勉強中。家では大人しく猛犬チワワのママしてます。iPhone4/Xperia所有。</description>
<profile_image_url>http://a0.twimg.com/profile_images/1202496271/usa_normal.png</profile_image_url>
<url>http://phpjavascriptroom.com/</url>
<protected>false</protected>
<followers_count>613</followers_count>
<profile_background_color>8350a1</profile_background_color>
<profile_text_color>f2afcf</profile_text_color>
<profile_link_color>f2afcf</profile_link_color>
<profile_sidebar_fill_color>8350a1</profile_sidebar_fill_color>
<profile_sidebar_border_color>8350a1</profile_sidebar_border_color>
<friends_count>527</friends_count>
<created_at>Sat Aug 04 05:52:33 +0000 2007</created_at>
<favourites_count>441</favourites_count>
<utc_offset>32400</utc_offset>
<time_zone>Tokyo</time_zone>
<profile_background_image_url>http://a1.twimg.com/profile_background_images/187449144/02.png</profile_background_image_url>
<profile_background_tile>true</profile_background_tile>
<profile_use_background_image>true</profile_use_background_image>
<notifications>true</notifications>
<geo_enabled>true</geo_enabled>
<verified>false</verified>
<following>true</following>
<statuses_count>4988</statuses_count>
<lang>ja</lang>
<contributors_enabled>false</contributors_enabled>
<follow_request_sent>false</follow_request_sent>
<listed_count>51</listed_count>
<show_all_inline_media>true</show_all_inline_media>
<default_profile>false</default_profile>
<default_profile_image>false</default_profile_image>
<is_translator>false</is_translator>
<status>
<created_at>Wed May 25 01:38:08 +0000 2011</created_at>
<id>73201147455864833</id>
<text>すご。 - 写真をHTMLテキストに変換してくれる「Textify」 【増田(@maskin)真樹】 http://bit.ly/lqM8f6</text>
<source><a href="http://www.nibirutech.com/mobilerss-google-reader-iphone.html" rel="nofollow">MobileRSS</a></source>
<truncated>false</truncated>
<favorited>false</favorited>
<in_reply_to_status_id></in_reply_to_status_id>
<in_reply_to_user_id></in_reply_to_user_id>
<in_reply_to_screen_name></in_reply_to_screen_name>
<retweet_count>0</retweet_count>
<retweeted>false</retweeted>
<geo/>
<coordinates/>
<place/>
<contributors/>
</status>
</user>
destroy.json
json[profile_background_color]=8350a1 json[protected]= json[statuses_count]=4988 json[profile_background_image_url]=http://a1.twimg.com/profile_background_images/187449144/02.png json[followers_count]=612 json[location]=カワタマ or オモサン json[name]=つんつ json[notifications]= json[profile_image_url]=http://a0.twimg.com/profile_images/1202496271/usa_normal.png json[id_str]=7948862 json[default_profile_image]= json[utc_offset]=32400 json[profile_text_color]=f2afcf json[url]=http://phpjavascriptroom.com/ json[profile_sidebar_fill_color]=8350a1 json[description]=青山でWeb系のお仕事してます。デザイナーズレストランははるか昔に卒業済。芋焼酎と焼鳥が大好きで居心地のいい呑み屋でおやじ談義するのがライフワーク。最近は日本酒をお勉強中。家では大人しく猛犬チワワのママしてます。iPhone4/Xperia所有。 json[screen_name]=cocoism json[is_translator]= json[lang]=ja json[profile_background_tile]=1 json[created_at]=Sat Aug 04 05:52:33 +0000 2007 json[status]['in_reply_to_screen_name']= json[status]['in_reply_to_user_id_str']= json[status]['contributors']= json[status]['retweeted']= json[status]['truncated']= json[status]['id_str']=73201147455864833 json[status]['text']=すご。 - 写真をHTMLテキストに変換してくれる「Textify」 【増田(@maskin)真樹】 http://bit.ly/lqM8f6 json[status]['in_reply_to_status_id']= json[status]['created_at']=Wed May 25 01:38:08 +0000 2011 json[status]['place']= json[status]['in_reply_to_user_id']= json[status]['id']=7.32011474559E+16 json[status]['source']=MobileRSS json[status]['favorited']= json[status]['in_reply_to_status_id_str']= json[status]['coordinates']= json[status]['geo']= json[status]['retweet_count']=0 json[follow_request_sent]= json[verified]= json[friends_count]=527 json[favourites_count]=441 json[profile_link_color]=f2afcf json[id]=7948862 json[contributors_enabled]= json[profile_sidebar_border_color]=8350a1 json[show_all_inline_media]=1 json[geo_enabled]=1 json[time_zone]=Tokyo json[default_profile]= json[listed_count]=51 json[following]= json[profile_use_background_image]=1
friendships/exists
指定した2人のユーザー同士が友達かどうか調べる(いずれかがつぶやきを非公開にしているユーザーの場合は要認証)
2009/7/18
![]()
![]()
http://api.twitter.com/1/friendships/exists.[xml|json]
user_aがuser_bとフレンド(フォローしている)かどうかを調べます。 user_aがuser_abをフォローしている場合はtrue、そうでない場合はfalseが返ります。
パラメーター
| パラメーター | 説明 | |
|---|---|---|
| user_a | 必須 |
ユーザーIDまたはスクリーンネームを指定。 例)http://api.twitter.com/1/friendships/exists.xml?user_a=cocoism |
| user_b | 必須 |
フォロー関係を調べるユーザーIDまたはスクリーンネームを指定。 例)http://api.twitter.com/1/friendships/exists.xml?user_a=cocoism&user_b=pjroomer |
取得サンプル(XML/JSON)
exists.xml
<friends>true</friends>
exists.json
true
設置サンプル
設置サンプルサンプルを見る
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ja" lang="ja">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Language" content="ja" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<meta http-equiv="Content-Style-Type" content="text/css" />
<meta http-equiv="imagetoolbar" content="no" />
<title>Twitter REST API:フレンドシップ関連 friends/exists(指定した2人のユーザー同士が友達かどうか調べる) | 設置サンプル</title>
<link rel="stylesheet" type="text/css" href="/content/lib/global.css" />
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<script type="text/javascript" src="/content/lib/jquery/jquery.jsonp.js"></script>
<!-- JS -->
<script type="text/javascript">
$(function(){
var url="http://twitter.com/friendships/exists.json?user_a=cocoism&user_b=pjroomer&callback={callback}";
$.getJSONP(url, function(obj){
$("#recent").html("cocoismとpjroomerは友達同士かどうか?:"+obj);
});
});
</script>
</head>
<body>
<div id="wrap">
<h1>Twitter REST API:フレンドシップ関連 friends/exists(指定した2人のユーザー同士が友達かどうか調べる)| 設置サンプル</h1>
<p>指定した2人のユーザー同士が友達かどうか調べます。いずれかのユーザーがつぶやきを非公開にしている場合は、認証が必要です。</p>
<!-- CODE -->
<div id="recent"></div>
<!-- / CODE -->
</div>
</body>
</html>
friendships/show
指定した2人のユーザーの関する情報を取得(認証不要)
2009/7/18
![]()
![]()
http://api.twitter.com/1/friendships/show.[xml|json]
指定した2人(A,B)のユーザー間の関係を取得します。
パラメーター
| パラメーター | 説明 | |
|---|---|---|
| source_id | 任意 |
ユーザーAのユーザーIDを指定。 例)http://api.twitter.com/1/friendships/show.xml?source_id=7948862&target_id=55984769 |
| source_screen_name | 任意 |
ユーザーAのスクリーンネームを指定。 例)http://api.twitter.com/1/friendships/show.json?source_screen_name=pjroomer&target_screen_name=cocoism |
| target_id | 任意 |
ユーザーBののユーザーIDを指定。 例)http://api.twitter.com/1/friendships/show.xml?source_id=7948862&target_id=55984769 |
| target_screen_name | 任意 |
ユーザーBののスクリーンネームを指定。 例)http://api.twitter.com/1/friendships/show.json?source_screen_name=pjroomer&target_screen_name=cocoism |
取得サンプル(XML/JSON)
ユーザーA(pjroomer)がユーザーB(cocoism)をフォローしていない場合(Bの片思い)
show.xml?source_screen_name=pjroomer&target_screen_name=cocoism
<?xml version="1.0" encoding="UTF-8"?>
<relationship>
<target>
<followed_by type="boolean">false</followed_by>
<id_str>7948862</id_str>
<screen_name>cocoism</screen_name>
<id type="integer">7948862</id>
<following type="boolean">true</following>
</target>
<source>
<followed_by type="boolean">true</followed_by>
<id_str>55984769</id_str>
<blocking type="boolean">false</blocking>
<notifications_enabled type="boolean">false</notifications_enabled>
<screen_name>pjroomer</screen_name>
<can_dm type="boolean">true</can_dm>
<id type="integer">55984769</id>
<all_replies type="boolean">false</all_replies>
<want_retweets type="boolean">false</want_retweets>
<marked_spam type="boolean">false</marked_spam>
<following type="boolean">false</following>
</source>
</relationship>
show.json?source_screen_name=pjroomer&target_screen_name=cocoism
json[relationship]['target']['id_str']=7948862 json[relationship]['target']['screen_name']=cocoism json[relationship]['target']['id']=7948862 json[relationship]['target']['followed_by']= json[relationship]['target']['following']=1 json[relationship]['source']['notifications_enabled']= json[relationship]['source']['can_dm']=1 json[relationship]['source']['id_str']=55984769 json[relationship]['source']['want_retweets']= json[relationship]['source']['screen_name']=pjroomer json[relationship]['source']['marked_spam']= json[relationship]['source']['blocking']= json[relationship]['source']['id']=55984769 json[relationship]['source']['all_replies']= json[relationship]['source']['followed_by']=1 json[relationship]['source']['following']=
ユーザーA(pjroomer)がユーザーB(cocoism)をフォローしている場合(相互フォロー)
show.xml?source_screen_name=pjroomer&target_screen_name=cocoism
<?xml version="1.0" encoding="UTF-8"?>
<relationship>
<target>
<followed_by type="boolean">true</followed_by>
<id_str>7948862</id_str>
<screen_name>cocoism</screen_name>
<id type="integer">7948862</id>
<following type="boolean">true</following>
</target>
<source>
<blocking type="boolean">false</blocking>
<marked_spam type="boolean">false</marked_spam>
<followed_by type="boolean">true</followed_by>
<id_str>55984769</id_str>
<screen_name>pjroomer</screen_name>
<notifications_enabled type="boolean">false</notifications_enabled>
<id type="integer">55984769</id>
<all_replies type="boolean">false</all_replies>
<can_dm type="boolean">true</can_dm>
<want_retweets type="boolean">true</want_retweets>
<following type="boolean">true</following>
</source>
</relationship>
show.json?source_screen_name=pjroomer&target_screen_name=cocoism
json[relationship]['target']['followed_by']=1 json[relationship]['target']['id_str']=7948862 json[relationship]['target']['screen_name']=cocoism json[relationship]['target']['id']=7948862 json[relationship]['target']['following']=1 json[relationship]['source']['followed_by']=1 json[relationship]['source']['id_str']=55984769 json[relationship]['source']['blocking']= json[relationship]['source']['notifications_enabled']= json[relationship]['source']['screen_name']=pjroomer json[relationship]['source']['can_dm']=1 json[relationship]['source']['id']=55984769 json[relationship]['source']['all_replies']= json[relationship]['source']['want_retweets']=1 json[relationship]['source']['marked_spam']= json[relationship]['source']['following']=1
ユーザーA(pjroomer)がユーザーB(cocoism)をフォローしていない場合(相互にフォローしていない)
show.xml?source_screen_name=pjroomer&target_screen_name=cocoism
<?xml version="1.0" encoding="UTF-8"?>
<relationship>
<target>
<id_str>7948862</id_str>
<screen_name>cocoism</screen_name>
<id type="integer">7948862</id>
<followed_by type="boolean">false</followed_by>
<following type="boolean">false</following>
</target>
<source>
<notifications_enabled type="boolean">false</notifications_enabled>
<can_dm type="boolean">false</can_dm>
<id_str>55984769</id_str>
<marked_spam type="boolean">false</marked_spam>
<want_retweets type="boolean">false</want_retweets>
<screen_name>pjroomer</screen_name>
<blocking type="boolean">false</blocking>
<id type="integer">55984769</id>
<all_replies type="boolean">false</all_replies>
<followed_by type="boolean">false</followed_by>
<following type="boolean">false</following>
</source>
</relationship>
show.json?source_screen_name=pjroomer&target_screen_name=cocoism
json[relationship]['target']['followed_by']= json[relationship]['target']['id_str']=7948862 json[relationship]['target']['screen_name']=cocoism json[relationship]['target']['id']=7948862 json[relationship]['target']['following']= json[relationship]['source']['followed_by']= json[relationship]['source']['id_str']=55984769 json[relationship]['source']['blocking']= json[relationship]['source']['notifications_enabled']= json[relationship]['source']['screen_name']=pjroomer json[relationship]['source']['can_dm']= json[relationship]['source']['want_retweets']= json[relationship]['source']['id']=55984769 json[relationship]['source']['marked_spam']= json[relationship]['source']['all_replies']= json[relationship]['source']['following']=
設置サンプル
設置サンプルサンプルを見る
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ja" lang="ja">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Language" content="ja" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<meta http-equiv="Content-Style-Type" content="text/css" />
<meta http-equiv="imagetoolbar" content="no" />
<title>Twitter REST API:フレンドシップ関連 friends/show(指定した2人のユーザーに関する情報を取得)| 設置サンプル</title>
<link rel="stylesheet" type="text/css" href="/content/lib/global.css" />
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<script type="text/javascript" src="/content/lib/jquery/jquery.jsonp.js"></script>
<!-- JS -->
<script type="text/javascript">
$(function(){
var url="http://twitter.com/friendships/show.json?source_screen_name=cocoism&target_screen_name=pjroomer&callback={callback}";
$.getJSONP(url, function(obj){
var s="";
s+="<ul>";
s+="<li>target";
s+="<ul>";
s+="<li>obj.relationship.target.screen_name = "+obj.relationship.target.screen_name+"</li>";
s+="<li>obj.relationship.target.following_by = "+obj.relationship.target.following_by+"</li>";
s+="<li>obj.relationship.target.following = "+obj.relationship.target.following+"</li>";
s+="<li>obj.relationship.target.id = "+obj.relationship.target.id+"</li>";
s+="</ul>";
s+="</li>";
s+="<li>source";
s+="<ul>";
s+="<li>obj.relationship.source.screen_name = "+obj.relationship.source.screen_name+"</li>";
s+="<li>obj.relationship.source.following_by = "+obj.relationship.source.following_by+"</li>";
s+="<li>obj.relationship.source.following = "+obj.relationship.source.following+"</li>";
s+="<li>obj.relationship.source.id = "+obj.relationship.source.id+"</li>";
s+="</ul>";
s+="</li>";
$("#recent").html("<ul>"+s+"</ul>");
});
});
</script>
</head>
<body>
<div id="wrap">
<h1>Twitter REST API:フレンドシップ関連 friends/show(指定した2人のユーザーに関する情報を取得)| 設置サンプル</h1>
<p>指定した2人のユーザーに関する情報を取得します。</p>
<!-- CODE -->
<div id="recent"></div>
<!-- / CODE -->
</div>
</body>
</html>
friendships/incoming
認証ユーザーが保留中のフォローリクエストのユーザーIDを配列で返す(要認証)
2009/7/18
![]()
![]()
http://api.twitter.com/1/friendships/incoming.[xml|json]
認証ユーザーに届いたフォローリクエストの内、保留しているユーザーのIDを配列で返します。
パラメーター
| パラメーター | 説明 | |
|---|---|---|
| cursor | 任意 | 結果をページ分けを指定します。1ページあたり20リストが含まれます。
ページの始まりには「-1」を指定します。前後ページは、取得したデータの中にあるnext_cursorまたはprevious_cursor属性で参照できます。 例)http://api.twitter.com/1/friendships/incoming.xml?cursor=12893764510938 |
取得サンプル(XML/JSON)
incoming.xml
<?xml version="1.0" encoding="UTF-8"?> <id_list> <ids> <id>12345</id> …略… </ids> <next_cursor>0</next_cursor> <previous_cursor>0</previous_cursor> </id_list>
incoming.json
json[previous_cursor]=0 json[next_cursor_str]=0 json[ids]['0']=12345 …略… json[previous_cursor_str]=0 json[next_cursor]=0
friendships/outgoing
認証ユーザーがフォローリクエストを送ったプロテクトユーザーのIDを配列で返す(要認証)
2009/7/18
![]()
![]()
http://api.twitter.com/1/friendships/outgoing.[xml|json]
認証ユーザーがプロテクトユーザーに送ったフォローリクエストの内、保留のままにされているプロテクトユーザーのIDを配列で返します。
パラメーター
| パラメーター | 説明 | |
|---|---|---|
| cursor | 任意 | 結果をページ分けを指定します。1ページあたり20リストが含まれます。
ページの始まりには「-1」を指定します。前後ページは、取得したデータの中にあるnext_cursorまたはprevious_cursor属性で参照できます。 例)http://api.twitter.com/1/friendships/incoming.xml?cursor=12893764510938 |
取得サンプル(XML/JSON)
outgoing.xml
<?xml version="1.0" encoding="UTF-8"?> <id_list> <ids> <id>12345</id> …略… </ids> <next_cursor>0</next_cursor> <previous_cursor>0</previous_cursor> </id_list>
outgoing.json
json[previous_cursor]=0 json[next_cursor_str]=0 json[previous_cursor_str]=0 json[next_cursor]=0 json[ids]['0']=12345 …略…