Twitter関連Twitter REST API:ソーシャルグラフ関連
- friends/ids〔指定したユーザーがフォローしている全ユーザーのIDリストを取得(認証不要)〕
- followers/ids〔指定したユーザーをフォローしている全ユーザーのIDリストを取得(認証不要)〕
friends/ids
指定したユーザーがフォローしている全ユーザーのIDリストを取得(認証不要)
2009/7/18
http://api.twitter.com/1/friends/ids.[xml|json]
指定したユーザーをフォローしている全ユーザーのIDリストを取得します。 指定したユーザーがフォローしているユーザー数を取得できます。
パラメーター
パラメーター | 説明 | |
---|---|---|
user_id | 必須 |
友達IDリストを取得するユーザーのユーザーIDを指定。 例)http://api.twitter.com/1/friends/ids.json?user_id=12345 |
screen_name | 必須 |
友達IDリストを取得するユーザーのスクリーンネームを指定。 例)http://api.twitter.com/1/friends/ids.json?screen_name=cocoism |
cursor | 任意 |
結果をページ分けを指定します。1ページあたり20リストが含まれます。
ページの始まりには「-1」を指定します。前後ページは、取得したデータの中にあるnext_cursorまたはprevious_cursor属性で参照できます。 例)http://api.twitter.com/1/friends/ids.json?cursor=12893764510938 |
取得サンプル(XML/JSON)
ids.xml
<?xml version="1.0" encoding="UTF-8"?> <ids> <id>121013629</id> <id>133583729</id> <id>152517411</id> <id>70434681</id> <id>261072033</id> <id>187401001</id> <id>43291023</id> <id>284974314</id> <id>271956051</id> <id>92908721</id> <id>220810065</id> …略… <id>22134978</id> </ids>
ids.json
json[0]=121013629 json[1]=133583729 json[2]=152517411 json[3]=70434681 json[4]=261072033 json[5]=187401001 json[6]=43291023 json[7]=284974314 json[8]=271956051 json[9]=92908721 …略… json[526]=22134978
設置サンプル
設置サンプルサンプルを見る
<!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 RES API:ソーシャルグラフ関連:friends/ids(指定したユーザーがフォローしている全ユーザーのIDリストを取得)| 設置サンプル</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/friends/ids/cocoism.json?callback={callback}"; $.getJSONP(url, function(obj){ var s=""; for(var i in obj){ s+="<li>"+obj[i]+"</i>"; } $("#recent").html("<p>cocoismは"+i+"人をフォローしています。</p><ul>"+s+"</ul>"); }); }); </script> </head> <body> <div id="wrap"> <h1>Twitter RES API:ソーシャルグラフ関連:friends/ids(指定したユーザーがフォローしている全ユーザーのIDリストを取得)| 設置サンプル</h1> <p>指定したユーザーがフォローしている全ユーザーのIDリストを表示します。</p> <!-- CODE --> <div id="recent"></div> <!-- / CODE --> </div> </body> </html>
followers/ids
指定したユーザーをフォローしている全ユーザーのIDリストを取得(認証不要)
2009/7/18
http://api.twitter.com/1/followers/ids.[xml|json]
指定したユーザーをフォローしている全ユーザーのIDリストを取得します。 指定したユーザーがフォローされているユーザー数を取得できます。
パラメーター
パラメーター | 説明 | |
---|---|---|
user_id | 任意 |
友達IDリストを取得するユーザーのユーザーIDを指定。 例)http://api.twitter.com/1/followers/ids.json?user_id=12345 |
screen_name | 任意 |
友達IDリストを取得するユーザーのスクリーンネームを指定。 例)http://api.twitter.com/1/followers/ids.json?screen_name=cocoism |
cursor | 任意 |
結果をページ分けを指定します。1ページあたり20リストが含まれます。
ページの始まりには「-1」を指定します。前後ページは、取得したデータの中にあるnext_cursorまたはprevious_cursor属性で参照できます。 例)http://api.twitter.com/1/followers/ids.json?cursor=12893764510938 |
取得サンプル(XML/JSON)
followers.xml
<?xml version="1.0" encoding="UTF-8"?> <ids> <id>97155739</id> <id>164261967</id> <id>213348057</id> <id>81989604</id> <id>302804216</id> <id>278817629</id> <id>33463882</id> <id>299125035</id> <id>299118348</id> <id>299110414</id> …略… <id>44632107</id> </ids>
followers.json
json[0]=97155739 json[1]=164261967 json[2]=213348057 json[3]=81989604 json[4]=302804216 json[5]=278817629 json[6]=33463882 json[7]=299125035 json[8]=299118348 json[9]=299110414 …略… json[612]=44632107
設置サンプル
設置サンプルサンプルを見る
<!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 RES API:ソーシャルグラフ関連:followers/ids(指定したユーザーをフォローしている全ユーザーのIDリストを取得)| 設置サンプル</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/followers/ids/cocoism.json?callback={callback}"; $.getJSONP(url, function(obj){ var s=""; for(var i in obj){ s+="<li>"+obj[i]+"</i>"; } $("#recent").html("<p>cocoismは"+i+"人にフォローされています。</p><ul>"+s+"</ul>"); }); }); </script> </head> <body> <div id="wrap"> <h1>Twitter RES API:ソーシャルグラフ関連:followers/ids(指定したユーザーをフォローしている全ユーザーのIDリストを取得)| 設置サンプル</h1> <p>指定したユーザーをフォローしている全ユーザーのIDリストを表示します。</p> <!-- CODE --> <div id="recent"></div> <!-- / CODE --> </div> </body> </html>