Twitter関連Twitter REST API:ブロック検索関連
- blocks/create〔認証ユーザーが指定したユーザーをブロック(要認証)〕
- blocks/destroy〔認証ユーザーが指定したユーザーのブロックを解除(要認証)〕
- blocks/exists〔認証ユーザーにブロックしているユーザーがいるか調べる(要認証)〕
- blocks/blocking〔認証ユーザーがブロックしているユーザーオブジェクトを配列で取得(要認証)〕
- blocks/blocking/ids〔認証ユーザーがブロックしているユーザーIDを配列で取得(要認証)〕
blocks/create
認証ユーザーが指定したユーザーをブロック(要認証)
2009/7/18
![]()
![]()
http://api.twitter.com/1/blocks/create.[xml|json]
指定したユーザーIDまたはスクリーンネームのユーザーをブロックします。 成功した場合は、ブロックしたユーザー情報を返します。
[MEMO]XML形式の場合、下記の形式でないとエラーが返ってくるようだ。
例)http://api.twitter.com/1/blocks/create/[ユーザーID|スクリーンネーム].xml
パラメーター
| パラメーター | 説明 | |
|---|---|---|
| user_id | 必須 |
ブロックするユーザーのユーザーのIDを指定。 例)http://api.twitter.com/1/blocks/create.xml?user_id=*** |
| screen_name | 必須 |
ブロックするユーザーのスクリーンネームを指定。 例)http://api.twitter.com/1/blocks/create.xml?screen_name=*** |
| include_entities | 任意 |
ステータス情報に'entities'を含める場合は、true,t,1のいずれかを指定。 例)http://api.twitter.com/1/blocks/create.xml?screen_name=***&include_entities=true |
取得サンプル(XML/JSON)
create.xml
<?xml version="1.0" encoding="UTF-8"?>
<user>
<id>55984769</id>
<name>つんこ</name>
<screen_name>pjroomer</screen_name>
<location>Tokyo, Japan</location>
<description>てすあか</description>
<profile_image_url>http://a0.twimg.com/sticky/default_profile_images/default_profile_1_normal.png</profile_image_url>
<url>http://phpjavascriptroom.com</url>
<protected>false</protected>
<followers_count>8</followers_count>
<profile_background_color>C0DEED</profile_background_color>
<profile_text_color>ff6699</profile_text_color>
<profile_link_color>0084B4</profile_link_color>
<profile_sidebar_fill_color>DDEEF6</profile_sidebar_fill_color>
<profile_sidebar_border_color>C0DEED</profile_sidebar_border_color>
<friends_count>187</friends_count>
<created_at>Sun Jul 12 01:37:21 +0000 2009</created_at>
<favourites_count>100</favourites_count>
<utc_offset>32400</utc_offset>
<time_zone>Tokyo</time_zone>
<profile_background_image_url>http://a0.twimg.com/images/themes/theme1/bg.png</profile_background_image_url>
<profile_background_tile>false</profile_background_tile>
<profile_use_background_image>true</profile_use_background_image>
<notifications>false</notifications>
<geo_enabled>true</geo_enabled>
<verified>false</verified>
<following>false</following>
<statuses_count>1425</statuses_count>
<lang>ja</lang>
<contributors_enabled>false</contributors_enabled>
<follow_request_sent>false</follow_request_sent>
<listed_count>5</listed_count>
<show_all_inline_media>false</show_all_inline_media>
<default_profile>false</default_profile>
<default_profile_image>true</default_profile_image>
<is_translator>false</is_translator>
<status>
<created_at>Wed May 25 08:47:15 +0000 2011</created_at>
<id>73309139866095617</id>
<text>あいうえお</text>
<source><a href="http://twitterapi01.appspot.com" rel="nofollow">Tw API test</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>
create.json
json[id_str]=55984769 json[verified]= json[profile_text_color]=ff6699 json[protected]= json[default_profile_image]=1 json[show_all_inline_media]= json[geo_enabled]=1 json[profile_sidebar_fill_color]=DDEEF6 json[name]=つんこ json[contributors_enabled]= json[notifications]= json[profile_background_tile]= json[favourites_count]=100 json[profile_image_url]=http://a0.twimg.com/sticky/default_profile_images/default_profile_1_normal.png json[is_translator]= json[default_profile]= json[utc_offset]=32400 json[location]=Tokyo, Japan json[follow_request_sent]= json[statuses_count]=1425 json[friends_count]=187 json[profile_link_color]=0084B4 json[description]=てすあか json[screen_name]=pjroomer json[lang]=ja json[profile_sidebar_border_color]=C0DEED json[url]=http://phpjavascriptroom.com json[status]['id_str']=73309139866095617 json[status]['in_reply_to_status_id']= json[status]['text']=あいうえお json[status]['in_reply_to_user_id']= json[status]['retweet_count']=0 json[status]['place']= json[status]['favorited']= json[status]['in_reply_to_status_id_str']= json[status]['id']=7.33091398661E+16 json[status]['created_at']=Wed May 25 08:47:15 +0000 2011 json[status]['in_reply_to_screen_name']= json[status]['truncated']= json[status]['source']=Tw API test json[status]['in_reply_to_user_id_str']= json[status]['contributors']= json[status]['coordinates']= json[status]['geo']= json[status]['retweeted']= json[time_zone]=Tokyo json[profile_use_background_image]=1 json[created_at]=Sun Jul 12 01:37:21 +0000 2009 json[followers_count]=8 json[id]=55984769 json[listed_count]=5 json[profile_background_color]=C0DEED json[profile_background_image_url]=http://a0.twimg.com/images/themes/theme1/bg.png json[following]=
blocks/destroy
認証ユーザーが指定したユーザーのブロックを解除(要認証)
2009/7/18
![]()
![]()
http://api.twitter.com/1/blocks/destroy.[xml|json]
指定したユーザーIDまたはスクリーンネームのユーザーに対するブロックを解除します。 成功した場合は、要求されたフォーマットでブロックを解除したユーザー情報を返します。
パラメーター
| パラメーター | 説明 | |
|---|---|---|
| user_id | 必須 |
ブロックを解除するユーザーのユーザーのIDを指定。 例)http://api.twitter.com/1/blocks/destroy.xml?user_id=*** |
| screen_name | 必須 |
ブロックを解除するユーザーのスクリーンネームを指定。 例)http://api.twitter.com/1/blocks/destroy.xml?screen_name=*** |
| include_entities | 任意 |
ステータス情報に'entities'を含める場合は、true,t,1のいずれかを指定。 例)http://api.twitter.com/1/blocks/destroy.xml?screen_name=***&include_entities=true |
取得サンプル(XML/JSON)
create.xml
<?xml version="1.0" encoding="UTF-8"?>
<user>
<id>55984769</id>
<name>つんこ</name>
<screen_name>pjroomer</screen_name>
<location>Tokyo, Japan</location>
<description>てすあか</description>
<profile_image_url>http://a0.twimg.com/sticky/default_profile_images/default_profile_1_normal.png</profile_image_url>
<url>http://phpjavascriptroom.com</url>
<protected>false</protected>
<followers_count>8</followers_count>
<profile_background_color>C0DEED</profile_background_color>
<profile_text_color>ff6699</profile_text_color>
<profile_link_color>0084B4</profile_link_color>
<profile_sidebar_fill_color>DDEEF6</profile_sidebar_fill_color>
<profile_sidebar_border_color>C0DEED</profile_sidebar_border_color>
<friends_count>187</friends_count>
<created_at>Sun Jul 12 01:37:21 +0000 2009</created_at>
<favourites_count>100</favourites_count>
<utc_offset>32400</utc_offset>
<time_zone>Tokyo</time_zone>
<profile_background_image_url>http://a0.twimg.com/images/themes/theme1/bg.png</profile_background_image_url>
<profile_background_tile>false</profile_background_tile>
<profile_use_background_image>true</profile_use_background_image>
<notifications>false</notifications>
<geo_enabled>true</geo_enabled>
<verified>false</verified>
<following>false</following>
<statuses_count>1425</statuses_count>
<lang>ja</lang>
<contributors_enabled>false</contributors_enabled>
<follow_request_sent>false</follow_request_sent>
<listed_count>5</listed_count>
<show_all_inline_media>false</show_all_inline_media>
<default_profile>false</default_profile>
<default_profile_image>true</default_profile_image>
<is_translator>false</is_translator>
<status>
<created_at>Wed May 25 08:47:15 +0000 2011</created_at>
<id>73309139866095617</id>
<text>あいうえお</text>
<source><a href="http://twitterapi01.appspot.com" rel="nofollow">Tw API test</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>
create.json
json[id_str]=55984769 json[verified]= json[profile_text_color]=ff6699 json[protected]= json[default_profile_image]=1 json[show_all_inline_media]= json[geo_enabled]=1 json[profile_sidebar_fill_color]=DDEEF6 json[name]=つんこ json[contributors_enabled]= json[notifications]= json[profile_background_tile]= json[favourites_count]=100 json[profile_image_url]=http://a0.twimg.com/sticky/default_profile_images/default_profile_1_normal.png json[is_translator]= json[default_profile]= json[utc_offset]=32400 json[location]=Tokyo, Japan json[follow_request_sent]= json[statuses_count]=1425 json[friends_count]=187 json[profile_link_color]=0084B4 json[description]=てすあか json[screen_name]=pjroomer json[lang]=ja json[profile_sidebar_border_color]=C0DEED json[url]=http://phpjavascriptroom.com json[status]['id_str']=73309139866095617 json[status]['in_reply_to_status_id']= json[status]['text']=あいうえお json[status]['in_reply_to_user_id']= json[status]['retweet_count']=0 json[status]['place']= json[status]['favorited']= json[status]['in_reply_to_status_id_str']= json[status]['id']=7.33091398661E+16 json[status]['created_at']=Wed May 25 08:47:15 +0000 2011 json[status]['in_reply_to_screen_name']= json[status]['truncated']= json[status]['source']=Tw API test json[status]['in_reply_to_user_id_str']= json[status]['contributors']= json[status]['coordinates']= json[status]['geo']= json[status]['retweeted']= json[time_zone]=Tokyo json[profile_use_background_image]=1 json[created_at]=Sun Jul 12 01:37:21 +0000 2009 json[followers_count]=8 json[id]=55984769 json[listed_count]=5 json[profile_background_color]=C0DEED json[profile_background_image_url]=http://a0.twimg.com/images/themes/theme1/bg.png json[following]=
blocks/exists
認証ユーザーにブロックしているユーザーがいるか調べる(要認証)
2009/7/18
![]()
![]()
http://api.twitter.com/1/blocks/exists.[xml|json]
認証ユーザーが対象ユーザーをブロックしているかどうかを調べます。 ブロックしている場合は、そのユーザーの情報が返り、そうでない場合はHTTP 404レスポンスコードが返ります。 成功した場合は、ブロックを解除したユーザー情報を返します。
パラメーター
| パラメーター | 説明 | |
|---|---|---|
| user_id | 任意 |
調べるユーザーIDを指定。有効なユーザーIDを明確に指定したい場合に使用。 例)http://api.twitter.com/1/blocks/exists.json?user_id=12345 |
| screen_name | 任意 |
調べるユーザーのスクリーンネームを指定。
ユーザーIDとスクリーンネームが数値で紛らわしい場合に有用。 例)http://api.twitter.com/1/blocks/exists.json?screen_name=*** |
| include_entities | 任意 |
ステータス情報に'entities'を含める場合は、true,t,1のいずれかを指定。 例)http://api.twitter.com/1/blocks/exists.xml?screen_name=***&include_entities=true |
取得サンプル(XML/JSON)
exists.xml
<?xml version="1.0" encoding="UTF-8"?>
<user>
<id>55984769</id>
<name>つんこ</name>
<screen_name>pjroomer</screen_name>
<location>Tokyo, Japan</location>
<description>てすあか</description>
<profile_image_url>http://a0.twimg.com/sticky/default_profile_images/default_profile_1_normal.png</profile_image_url>
<url>http://phpjavascriptroom.com</url>
<protected>false</protected>
<followers_count>8</followers_count>
<profile_background_color>C0DEED</profile_background_color>
<profile_text_color>ff6699</profile_text_color>
<profile_link_color>0084B4</profile_link_color>
<profile_sidebar_fill_color>DDEEF6</profile_sidebar_fill_color>
<profile_sidebar_border_color>C0DEED</profile_sidebar_border_color>
<friends_count>187</friends_count>
<created_at>Sun Jul 12 01:37:21 +0000 2009</created_at>
<favourites_count>100</favourites_count>
<utc_offset>32400</utc_offset>
<time_zone>Tokyo</time_zone>
<profile_background_image_url>http://a0.twimg.com/images/themes/theme1/bg.png</profile_background_image_url>
<profile_background_tile>false</profile_background_tile>
<profile_use_background_image>true</profile_use_background_image>
<notifications>false</notifications>
<geo_enabled>true</geo_enabled>
<verified>false</verified>
<following>false</following>
<statuses_count>1425</statuses_count>
<lang>ja</lang>
<contributors_enabled>false</contributors_enabled>
<follow_request_sent>false</follow_request_sent>
<listed_count>5</listed_count>
<show_all_inline_media>false</show_all_inline_media>
<default_profile>false</default_profile>
<default_profile_image>true</default_profile_image>
<is_translator>false</is_translator>
<status>
<created_at>Wed May 25 08:47:15 +0000 2011</created_at>
<id>73309139866095617</id>
<text>あいうえお</text>
<source><a href="http://twitterapi01.appspot.com" rel="nofollow">Tw API test</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>
exists.json
json[id_str]=55984769 json[verified]= json[profile_text_color]=ff6699 json[protected]= json[default_profile_image]=1 json[show_all_inline_media]= json[geo_enabled]=1 json[profile_sidebar_fill_color]=DDEEF6 json[name]=つんこ json[contributors_enabled]= json[notifications]= json[profile_background_tile]= json[favourites_count]=100 json[profile_image_url]=http://a0.twimg.com/sticky/default_profile_images/default_profile_1_normal.png json[is_translator]= json[utc_offset]=32400 json[location]=Tokyo, Japan json[default_profile]= json[follow_request_sent]= json[statuses_count]=1425 json[friends_count]=187 json[profile_link_color]=0084B4 json[description]=てすあか json[screen_name]=pjroomer json[lang]=ja json[profile_sidebar_border_color]=C0DEED json[url]=http://phpjavascriptroom.com json[status]['id_str']=73309139866095617 json[status]['in_reply_to_status_id']= json[status]['text']=あいうえお json[status]['in_reply_to_user_id']= json[status]['retweet_count']=0 json[status]['place']= json[status]['favorited']= json[status]['in_reply_to_status_id_str']= json[status]['id']=7.33091398661E+16 json[status]['created_at']=Wed May 25 08:47:15 +0000 2011 json[status]['in_reply_to_screen_name']= json[status]['truncated']= json[status]['source']=Tw API test json[status]['in_reply_to_user_id_str']= json[status]['contributors']= json[status]['coordinates']= json[status]['geo']= json[status]['retweeted']= json[time_zone]=Tokyo json[profile_use_background_image]=1 json[created_at]=Sun Jul 12 01:37:21 +0000 2009 json[followers_count]=8 json[id]=55984769 json[listed_count]=5 json[profile_background_color]=C0DEED json[profile_background_image_url]=http://a0.twimg.com/images/themes/theme1/bg.png json[following]=
blocks/blocking
認証ユーザーがブロックしているユーザーオブジェクトを配列で取得(要認証)
2009/7/18
![]()
![]()
http://api.twitter.com/1/blocks/blocking.[xml|json]
認証ユーザーがブロックしているユーザーの情報を配列で返します。
パラメーター
| パラメーター | 説明 | |
|---|---|---|
| page | 任意 |
指定したページ番号(1ページ20件)のデータを取得したい場合に使用。 例)http://api.twitter.com/1/blocks/blocking.json?page=3 |
| include_entities | 任意 |
ステータス情報に'entities'を含める場合は、true,t,1のいずれかを指定。 例)http://api.twitter.com/1/blocks/blocking.json?include_entities=1 |
取得サンプル(XML/JSON)
blocking.xml
<?xml version="1.0" encoding="UTF-8"?>
<users type="array">
<user>
<id>55984769</id>
<name>つんこ</name>
<screen_name>pjroomer</screen_name>
<location>Tokyo, Japan</location>
<description>てすあか</description>
<profile_image_url>http://a0.twimg.com/sticky/default_profile_images/default_profile_1_normal.png</profile_image_url>
<url>http://phpjavascriptroom.com</url>
<protected>false</protected>
<followers_count>8</followers_count>
<profile_background_color>C0DEED</profile_background_color>
<profile_text_color>ff6699</profile_text_color>
<profile_link_color>0084B4</profile_link_color>
<profile_sidebar_fill_color>DDEEF6</profile_sidebar_fill_color>
<profile_sidebar_border_color>C0DEED</profile_sidebar_border_color>
<friends_count>187</friends_count>
<created_at>Sun Jul 12 01:37:21 +0000 2009</created_at>
<favourites_count>100</favourites_count>
<utc_offset>32400</utc_offset>
<time_zone>Tokyo</time_zone>
<profile_background_image_url>http://a0.twimg.com/images/themes/theme1/bg.png</profile_background_image_url>
<profile_background_tile>false</profile_background_tile>
<profile_use_background_image>true</profile_use_background_image>
<notifications>false</notifications>
<geo_enabled>true</geo_enabled>
<verified>false</verified>
<following>false</following>
<statuses_count>1425</statuses_count>
<lang>ja</lang>
<contributors_enabled>false</contributors_enabled>
<follow_request_sent>false</follow_request_sent>
<listed_count>5</listed_count>
<show_all_inline_media>false</show_all_inline_media>
<default_profile>false</default_profile>
<default_profile_image>true</default_profile_image>
<is_translator>false</is_translator>
<status>
<created_at>Wed May 25 08:47:15 +0000 2011</created_at>
<id>73309139866095617</id>
<text>あいうえお</text>
<source><a href="http://twitterapi01.appspot.com" rel="nofollow">Tw API test</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>
…略…
</users>
blocking.json
json[0]['id_str']=55984769 json[0]['verified']= json[0]['profile_text_color']=ff6699 json[0]['protected']= json[0]['default_profile_image']=1 json[0]['show_all_inline_media']= json[0]['geo_enabled']=1 json[0]['profile_sidebar_fill_color']=DDEEF6 json[0]['name']=つんこ json[0]['contributors_enabled']= json[0]['notifications']= json[0]['profile_background_tile']= json[0]['favourites_count']=100 json[0]['profile_image_url']=http://a0.twimg.com/sticky/default_profile_images/default_profile_1_normal.png json[0]['is_translator']= json[0]['utc_offset']=32400 json[0]['location']=Tokyo, Japan json[0]['default_profile']= json[0]['follow_request_sent']= json[0]['statuses_count']=1425 json[0]['friends_count']=187 json[0]['profile_link_color']=0084B4 json[0]['description']=てすあか json[0]['screen_name']=pjroomer json[0]['lang']=ja json[0]['profile_sidebar_border_color']=C0DEED json[0]['url']=http://phpjavascriptroom.com json[0]['status']['id_str']=73309139866095617 json[0]['status']['in_reply_to_status_id']= json[0]['status']['text']=あいうえお json[0]['status']['in_reply_to_user_id']= json[0]['status']['retweet_count']=0 json[0]['status']['place']= json[0]['status']['favorited']= json[0]['status']['in_reply_to_status_id_str']= json[0]['status']['id']=7.33091398661E+16 json[0]['status']['created_at']=Wed May 25 08:47:15 +0000 2011 json[0]['status']['in_reply_to_screen_name']= json[0]['status']['truncated']= json[0]['status']['source']=Tw API test json[0]['status']['in_reply_to_user_id_str']= json[0]['status']['contributors']= json[0]['status']['coordinates']= json[0]['status']['geo']= json[0]['status']['retweeted']= json[0]['time_zone']=Tokyo json[0]['profile_use_background_image']=1 json[0]['created_at']=Sun Jul 12 01:37:21 +0000 2009 json[0]['followers_count']=8 json[0]['id']=55984769 json[0]['listed_count']=5 json[0]['profile_background_color']=C0DEED json[0]['profile_background_image_url']=http://a0.twimg.com/images/themes/theme1/bg.png json[0]['following']= …略…
blocks/blocking/ids
認証ユーザーがブロックしているユーザーIDを配列で取得(要認証)
2009/7/18
![]()
![]()
http://api.twitter.com/1/blocks/blocking/ids.[xml|json]
認証ユーザーがブロックしているユーザーのユーザーIDを配列で返します。
取得サンプル(XML/JSON)
ids.xml
<?xml version="1.0" encoding="UTF-8"?> <ids> <id>12345</id> …略… </ids>
ids.json
json[0]=12345 …略…