Search
  1. direct_messages〔認証ユーザーのダイレクトメッセージを取得(要認証)〕
  2. direct_messages/sent〔認証ユーザーが送信したダイレクトメッセージを取得(要認証)〕
  3. direct_messages/new〔認証ユーザーが指定したユーザーにダイレクトメッセージを送信(要認証)〕
  4. direct_messages/destroy/:id〔認証ユーザーの指定したメッセージIDのダイレクトメッセージを削除(要認証)〕

direct_messages
認証ユーザーのダイレクトメッセージを取得(要認証)

2009/7/18

要認証API制限対象

HTTP GEThttp://api.twitter.com/1/direct_messages.[xml|json|rss|atom]

認証ユーザーに届いたダイレクトメッセージを最大20件取得します。 結果をXML、JSON形式で受け取る場合は、受信者と送信者のユーザーの情報も含まれます。

パラメーター説明
since_id任意 指定したメッセージIDより後のメッセージを取得したい場合に使用。
例)http://api.twitter.com/1/direct_messages.xml?since_id=12345
max_id任意 指定メッセージIDより過去のメッセージを取得したい場合に使用。
例:http://api.twitter.com/1/direct_messages.xml?max_id=54321
count任意 結果として受け取る件数を指定。
例)http://api.twitter.com/1/direct_messages.xml?count=10
page任意 指定したページ番号(1ページ20件)のメッセージを取得したい場合に使用。
例)http://api.twitter.com/1/direct_messages.xml?page=3
include_entities任意 ステータス情報に'entities'を含める場合は、true,t,1のいずれかを指定。
例)http://api.twitter.com/1/lists/members.xml?include_entities=true

取得サンプル(XML/JSON)

direct_messages.xml
<?xml version="1.0" encoding="UTF-8"?>
<direct-messages type="array">
<direct_message>
  <id>1698907401</id>
  <sender_id>7948862</sender_id>
  <text>今日終わったら速攻呑みに行こー!</text>
  <recipient_id>55984769</recipient_id>
  <created_at>Tue Sep 28 05:06:10 +0000 2010</created_at>
  <sender_screen_name>cocoism</sender_screen_name>
  <recipient_screen_name>pjroomer</recipient_screen_name>
  <sender>
    <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>612</followers_count>
    <profile_background_color>8350a1</profile_background_color>
    <profile_text_color>ff6699</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>534</friends_count>
    <created_at>Sat Aug 04 05:52:33 +0000 2007</created_at>
    <favourites_count>443</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>false</notifications>
    <geo_enabled>true</geo_enabled>
    <verified>false</verified>
    <following>false</following>
    <statuses_count>5019</statuses_count>
    <lang>ja</lang>
    <contributors_enabled>false</contributors_enabled>
    <follow_request_sent>false</follow_request_sent>
    <listed_count>52</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>
  </sender>
  <recipient>
    <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>188</friends_count>
    <created_at>Sun Jul 12 01:37:21 +0000 2009</created_at>
    <favourites_count>99</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>
  </recipient>
</direct_message>
</direct-messages>
direct_messages.json
json[0]['recipient']['default_profile']=
json[0]['recipient']['follow_request_sent']=
json[0]['recipient']['profile_background_color']=C0DEED
json[0]['recipient']['protected']=
json[0]['recipient']['profile_background_image_url']=http://a0.twimg.com/images/themes/theme1/bg.png
json[0]['recipient']['followers_count']=8
json[0]['recipient']['location']=Tokyo, Japan
json[0]['recipient']['name']=つんこ
json[0]['recipient']['notifications']=
json[0]['recipient']['profile_image_url']=http://a0.twimg.com/sticky/default_profile_images/default_profile_1_normal.png
json[0]['recipient']['id_str']=55984769
json[0]['recipient']['show_all_inline_media']=
json[0]['recipient']['geo_enabled']=1
json[0]['recipient']['utc_offset']=32400
json[0]['recipient']['profile_text_color']=ff6699
json[0]['recipient']['url']=http://phpjavascriptroom.com
json[0]['recipient']['listed_count']=5
json[0]['recipient']['profile_sidebar_fill_color']=DDEEF6
json[0]['recipient']['description']=てすあか
json[0]['recipient']['screen_name']=pjroomer
json[0]['recipient']['lang']=ja
json[0]['recipient']['profile_background_tile']=
json[0]['recipient']['created_at']=Sun Jul 12 01:37:21 +0000 2009
json[0]['recipient']['statuses_count']=1425
json[0]['recipient']['verified']=
json[0]['recipient']['favourites_count']=99
json[0]['recipient']['profile_link_color']=0084B4
json[0]['recipient']['id']=55984769
json[0]['recipient']['default_profile_image']=1
json[0]['recipient']['contributors_enabled']=
json[0]['recipient']['profile_sidebar_border_color']=C0DEED
json[0]['recipient']['time_zone']=Tokyo
json[0]['recipient']['friends_count']=188
json[0]['recipient']['is_translator']=
json[0]['recipient']['following']=
json[0]['recipient']['profile_use_background_image']=1
json[0]['recipient_id']=55984769
json[0]['sender_screen_name']=cocoism
json[0]['text']=今日終わったら速攻呑みに行こー!
json[0]['id_str']=1698907401
json[0]['created_at']=Tue Sep 28 05:06:10 +0000 2010
json[0]['recipient_screen_name']=pjroomer
json[0]['sender_id']=7948862
json[0]['sender']['default_profile']=
json[0]['sender']['follow_request_sent']=
json[0]['sender']['profile_background_color']=8350a1
json[0]['sender']['protected']=
json[0]['sender']['profile_background_image_url']=http://a1.twimg.com/profile_background_images/187449144/02.png
json[0]['sender']['followers_count']=612
json[0]['sender']['location']=カワタマ or オモサン
json[0]['sender']['name']=つんつ
json[0]['sender']['notifications']=
json[0]['sender']['profile_image_url']=http://a0.twimg.com/profile_images/1202496271/usa_normal.png
json[0]['sender']['id_str']=7948862
json[0]['sender']['show_all_inline_media']=1
json[0]['sender']['geo_enabled']=1
json[0]['sender']['utc_offset']=32400
json[0]['sender']['profile_text_color']=ff6699
json[0]['sender']['url']=http://phpjavascriptroom.com/
json[0]['sender']['listed_count']=52
json[0]['sender']['profile_sidebar_fill_color']=8350a1
json[0]['sender']['description']=青山でWeb系のお仕事してます。デザイナーズレストランははるか昔に卒業済。芋焼酎と焼鳥が大好きで居心地のいい呑み屋でおやじ談義するのがライフワーク。最近は日本酒をお勉強中。家では大人しく猛犬チワワのママしてます。iPhone4/Xperia所有。
json[0]['sender']['screen_name']=cocoism
json[0]['sender']['lang']=ja
json[0]['sender']['profile_background_tile']=1
json[0]['sender']['created_at']=Sat Aug 04 05:52:33 +0000 2007
json[0]['sender']['statuses_count']=5019
json[0]['sender']['verified']=
json[0]['sender']['favourites_count']=443
json[0]['sender']['profile_link_color']=f2afcf
json[0]['sender']['id']=7948862
json[0]['sender']['default_profile_image']=
json[0]['sender']['contributors_enabled']=
json[0]['sender']['profile_sidebar_border_color']=8350a1
json[0]['sender']['time_zone']=Tokyo
json[0]['sender']['friends_count']=534
json[0]['sender']['is_translator']=
json[0]['sender']['following']=
json[0]['sender']['profile_use_background_image']=1
json[0]['id']=1698907401

direct_messages/sent
認証ユーザーが送信したダイレクトメッセージを取得(要認証)

2009/7/18

要認証API制限対象

HTTP GEThttp://api.twitter.com/1/direct_messages/sent.[xml|json|rss|atom]

指定したユーザーに最近送信したダイレクトメッセージを最大20件取得します。 このメソッドは、HTTP GETでリクエストします。 結果を受け取るformatは、xml、json、rss、atomのいずれかを指定できます。 結果をXMまたはJSONで受け取る場合は、受信者と送信者のユーザーの情報も含まれます。

パラメーター説明
since_id任意 指定したメッセージIDより後のメッセージを取得したい場合に使用。 指定したメッセージIDのメッセージは含まれません。
例)http://api.twitter.com/1/direct_messages/sent.xml?since_id=12345
max_id任意 指定メッセージIDより過去のメッセージを取得したい場合に使用。 指定したメッセージIDのメッセージは含まれません。
例:http://api.twitter.com/1/direct_messages/sent.xml?max_id=54321
count任意 結果として受け取る件数を指定。
例)http://api.twitter.com/1/direct_messages/sent.xml?count=10
page任意 指定したページ番号(1ページ20件)のメッセージを取得したい場合に使用。
例)http://api.twitter.com/1/direct_messages/sent.xml?page=3
include_entities任意 ステータス情報に'entities'を含める場合は、true,t,1のいずれかを指定。
例)http://api.twitter.com/1/lists/members.xml?include_entities=true

取得サンプル(XML/JSON)

sent.xml
<?xml version="1.0" encoding="UTF-8"?>
<direct-messages type="array">
<direct_message>
  <id>1691922926</id>
  <sender_id>55984769</sender_id>
  <text>映画のシート予約したよ。18時に渋谷の109前で待ち合わせねしよ♪</text>
  <recipient_id>7948862</recipient_id>
  <created_at>Sun Sep 26 14:15:18 +0000 2010</created_at>
  <sender_screen_name>pjroomer</sender_screen_name>
  <recipient_screen_name>cocoism</recipient_screen_name>
  <sender>
    <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>188</friends_count>
    <created_at>Sun Jul 12 01:37:21 +0000 2009</created_at>
    <favourites_count>99</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>
  </sender>
  <recipient>
    <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>612</followers_count>
    <profile_background_color>8350a1</profile_background_color>
    <profile_text_color>ff6699</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>534</friends_count>
    <created_at>Sat Aug 04 05:52:33 +0000 2007</created_at>
    <favourites_count>443</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>false</notifications>
    <geo_enabled>true</geo_enabled>
    <verified>false</verified>
    <following>false</following>
    <statuses_count>5019</statuses_count>
    <lang>ja</lang>
    <contributors_enabled>false</contributors_enabled>
    <follow_request_sent>false</follow_request_sent>
    <listed_count>52</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>
  </recipient>
</direct_message>
</direct-messages>
sent.json
json[0]['recipient']['profile_background_color']=8350a1
json[0]['recipient']['protected']=
json[0]['recipient']['statuses_count']=5019
json[0]['recipient']['profile_background_image_url']=http://a1.twimg.com/profile_background_images/187449144/02.png
json[0]['recipient']['followers_count']=612
json[0]['recipient']['location']=カワタマ or オモサン
json[0]['recipient']['name']=つんつ
json[0]['recipient']['notifications']=
json[0]['recipient']['profile_image_url']=http://a0.twimg.com/profile_images/1202496271/usa_normal.png
json[0]['recipient']['id_str']=7948862
json[0]['recipient']['default_profile_image']=
json[0]['recipient']['utc_offset']=32400
json[0]['recipient']['profile_text_color']=ff6699
json[0]['recipient']['url']=http://phpjavascriptroom.com/
json[0]['recipient']['profile_sidebar_fill_color']=8350a1
json[0]['recipient']['description']=青山でWeb系のお仕事してます。デザイナーズレストランははるか昔に卒業済。芋焼酎と焼鳥が大好きで居心地のいい呑み屋でおやじ談義するのがライフワーク。最近は日本酒をお勉強中。家では大人しく猛犬チワワのママしてます。iPhone4/Xperia所有。
json[0]['recipient']['screen_name']=cocoism
json[0]['recipient']['is_translator']=
json[0]['recipient']['lang']=ja
json[0]['recipient']['profile_background_tile']=1
json[0]['recipient']['created_at']=Sat Aug 04 05:52:33 +0000 2007
json[0]['recipient']['default_profile']=
json[0]['recipient']['follow_request_sent']=
json[0]['recipient']['verified']=
json[0]['recipient']['friends_count']=534
json[0]['recipient']['favourites_count']=443
json[0]['recipient']['profile_link_color']=f2afcf
json[0]['recipient']['id']=7948862
json[0]['recipient']['contributors_enabled']=
json[0]['recipient']['profile_sidebar_border_color']=8350a1
json[0]['recipient']['show_all_inline_media']=1
json[0]['recipient']['geo_enabled']=1
json[0]['recipient']['time_zone']=Tokyo
json[0]['recipient']['listed_count']=52
json[0]['recipient']['following']=
json[0]['recipient']['profile_use_background_image']=1
json[0]['recipient_id']=7948862
json[0]['sender_screen_name']=pjroomer
json[0]['text']=映画のシート予約したよ。18時に渋谷の109前で待ち合わせねしよ♪
json[0]['created_at']=Sun Sep 26 14:15:18 +0000 2010
json[0]['recipient_screen_name']=cocoism
json[0]['sender_id']=55984769
json[0]['sender']['profile_background_color']=C0DEED
json[0]['sender']['protected']=
json[0]['sender']['statuses_count']=1425
json[0]['sender']['profile_background_image_url']=http://a0.twimg.com/images/themes/theme1/bg.png
json[0]['sender']['followers_count']=8
json[0]['sender']['location']=Tokyo, Japan
json[0]['sender']['name']=つんこ
json[0]['sender']['notifications']=
json[0]['sender']['profile_image_url']=http://a0.twimg.com/sticky/default_profile_images/default_profile_1_normal.png
json[0]['sender']['id_str']=55984769
json[0]['sender']['default_profile_image']=1
json[0]['sender']['utc_offset']=32400
json[0]['sender']['profile_text_color']=ff6699
json[0]['sender']['url']=http://phpjavascriptroom.com
json[0]['sender']['profile_sidebar_fill_color']=DDEEF6
json[0]['sender']['description']=てすあか
json[0]['sender']['screen_name']=pjroomer
json[0]['sender']['is_translator']=
json[0]['sender']['lang']=ja
json[0]['sender']['profile_background_tile']=
json[0]['sender']['created_at']=Sun Jul 12 01:37:21 +0000 2009
json[0]['sender']['default_profile']=
json[0]['sender']['follow_request_sent']=
json[0]['sender']['verified']=
json[0]['sender']['friends_count']=188
json[0]['sender']['favourites_count']=99
json[0]['sender']['profile_link_color']=0084B4
json[0]['sender']['id']=55984769
json[0]['sender']['contributors_enabled']=
json[0]['sender']['profile_sidebar_border_color']=C0DEED
json[0]['sender']['show_all_inline_media']=
json[0]['sender']['geo_enabled']=1
json[0]['sender']['time_zone']=Tokyo
json[0]['sender']['listed_count']=5
json[0]['sender']['following']=
json[0]['sender']['profile_use_background_image']=1
json[0]['id']=1691922926

direct_messages/new
認証ユーザーが指定したユーザーにダイレクトメッセージを送信(要認証)

2009/7/18

要認証API制限なし

HTTP POSThttp://api.twitter.com/1/direct_messages/new.[xml|json]

認証ユーザーが指定したユーザーにダイレクトメッセージを送信します。 送信に成功した場合は、送信したメッセージが返ります。

パラメーター説明
user_id必須 送信先のユーザーIDを指定。
screen_name必須 送信先のスクリーンネームを指定。
text必須 ダイレクトメッセージの内容を指定。 要URLエンコード。140文字以内。
例)http://api.twitter.com/1/direct_messages/new.json?screen_name=cocoism&text=%E3%83%95%E3%82%A9%E3%83%AD%E3%83%BC%E3%81%82%E3%82%8A%E3%81%8C%E3%81%A8%E3%81%86%E3%81%94%E3%81%96%E3%81%84%E3%81%BE%E3%81%99%E3%80%82
例)http://api.twitter.com/1/direct_messages/new.json?user_id=7948862&text=%E3%83%95%E3%82%A9%E3%83%AD%E3%83%BC%E3%81%82%E3%82%8A%E3%81%8C%E3%81%A8%E3%81%86%E3%81%94%E3%81%96%E3%81%84%E3%81%BE%E3%81%99%E3%80%82

取得サンプル(XML/JSON)

new.xml
▼送信に成功した場合
<?xml version="1.0" encoding="UTF-8"?>
<direct_message>
  <id>3117305935</id>
  <sender_id>55984769</sender_id>
  <text>フォローありがとうございます。</text>
  <recipient_id>7948862</recipient_id>
  <created_at>Thu May 26 16:30:58 +0000 2011</created_at>
  <sender_screen_name>pjroomer</sender_screen_name>
  <recipient_screen_name>cocoism</recipient_screen_name>
  <sender>
    <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>9</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>189</friends_count>
    <created_at>Sun Jul 12 01:37:21 +0000 2009</created_at>
    <favourites_count>99</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>
  </sender>
  <recipient>
    <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>ff6699</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>535</friends_count>
    <created_at>Sat Aug 04 05:52:33 +0000 2007</created_at>
    <favourites_count>443</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>false</notifications>
    <geo_enabled>true</geo_enabled>
    <verified>false</verified>
    <following>true</following>
    <statuses_count>5019</statuses_count>
    <lang>ja</lang>
    <contributors_enabled>false</contributors_enabled>
    <follow_request_sent>false</follow_request_sent>
    <listed_count>52</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>
  </recipient>
</direct_message>

▼失敗した場合(フォローしていないユーザーに送信した場合)
<?xml version="1.0" encoding="UTF-8"?>
<hash>
  <error>You cannot send messages to users who are not following you.</error>
  <request>/1/direct_messages/new.xml</request>
</hash>

▼失敗した場合(連続して同じメッセージを送信した場合)
<?xml version="1.0" encoding="UTF-8"?>
<hash>
  <error>There was an error sending your message: おっと! その内容はすでに書き込みましたよ。</error>
  <request>/1/direct_messages/new.xml</request>
</hash>
new.json
▼送信に成功した場合
json[recipient]['default_profile']=
json[recipient]['profile_background_color']=8350a1
json[recipient]['protected']=
json[recipient]['statuses_count']=5019
json[recipient]['profile_background_image_url']=http://a1.twimg.com/profile_background_images/187449144/02.png
json[recipient]['followers_count']=613
json[recipient]['location']=カワタマ or オモサン
json[recipient]['name']=つんつ
json[recipient]['notifications']=
json[recipient]['profile_image_url']=http://a0.twimg.com/profile_images/1202496271/usa_normal.png
json[recipient]['id_str']=7948862
json[recipient]['default_profile_image']=
json[recipient]['utc_offset']=32400
json[recipient]['profile_text_color']=ff6699
json[recipient]['url']=http://phpjavascriptroom.com/
json[recipient]['profile_sidebar_fill_color']=8350a1
json[recipient]['description']=青山でWeb系のお仕事してます。デザイナーズレストランははるか昔に卒業済。芋焼酎と焼鳥が大好きで居心地のいい呑み屋でおやじ談義するのがライフワーク。最近は日本酒をお勉強中。家では大人しく猛犬チワワのママしてます。iPhone4/Xperia所有。
json[recipient]['screen_name']=cocoism
json[recipient]['is_translator']=
json[recipient]['lang']=ja
json[recipient]['profile_background_tile']=1
json[recipient]['created_at']=Sat Aug 04 05:52:33 +0000 2007
json[recipient]['follow_request_sent']=
json[recipient]['verified']=
json[recipient]['friends_count']=535
json[recipient]['favourites_count']=443
json[recipient]['profile_link_color']=f2afcf
json[recipient]['id']=7948862
json[recipient]['contributors_enabled']=
json[recipient]['profile_sidebar_border_color']=8350a1
json[recipient]['show_all_inline_media']=1
json[recipient]['geo_enabled']=1
json[recipient]['time_zone']=Tokyo
json[recipient]['listed_count']=52
json[recipient]['following']=1
json[recipient]['profile_use_background_image']=1
json[sender_screen_name]=pjroomer
json[recipient_id]=7948862
json[recipient_screen_name]=cocoism
json[text]=フォローありがとうございます。
json[id_str]=3117317216
json[created_at]=Thu May 26 16:32:44 +0000 2011
json[sender_id]=55984769

json[sender]['default_profile']=
json[sender]['profile_background_color']=C0DEED
json[sender]['protected']=
json[sender]['statuses_count']=1425
json[sender]['profile_background_image_url']=http://a0.twimg.com/images/themes/theme1/bg.png
json[sender]['followers_count']=9
json[sender]['location']=Tokyo, Japan
json[sender]['name']=つんこ
json[sender]['notifications']=
json[sender]['profile_image_url']=http://a0.twimg.com/sticky/default_profile_images/default_profile_1_normal.png
json[sender]['id_str']=55984769
json[sender]['default_profile_image']=1
json[sender]['utc_offset']=32400
json[sender]['profile_text_color']=ff6699
json[sender]['url']=http://phpjavascriptroom.com
json[sender]['profile_sidebar_fill_color']=DDEEF6
json[sender]['description']=てすあか
json[sender]['screen_name']=pjroomer
json[sender]['is_translator']=
json[sender]['lang']=ja
json[sender]['profile_background_tile']=
json[sender]['created_at']=Sun Jul 12 01:37:21 +0000 2009
json[sender]['follow_request_sent']=
json[sender]['verified']=
json[sender]['friends_count']=189
json[sender]['favourites_count']=99
json[sender]['profile_link_color']=0084B4
json[sender]['id']=55984769
json[sender]['contributors_enabled']=
json[sender]['profile_sidebar_border_color']=C0DEED
json[sender]['show_all_inline_media']=
json[sender]['geo_enabled']=1
json[sender]['time_zone']=Tokyo
json[sender]['listed_count']=5
json[sender]['following']=
json[sender]['profile_use_background_image']=1
json[id]=3117317216

▼失敗した場合(フォローしていないユーザーに送信した場合)
json[error]=You cannot send messages to users who are not following you.
json[request]=/1/direct_messages/new.json

▼失敗した場合(連続して同じメッセージを送信した場合)
json[error]=There was an error sending your message: おっと! その内容はすでに書き込みましたよ。
json[request]=/1/direct_messages/new.json

direct_messages/destroy/:id
認証ユーザーの指定したメッセージIDのダイレクトメッセージを削除(要認証)

2009/7/18

要認証API制限なし

HTTP POSThttp://api.twitter.com/1/direct_messages/destroy/[メッセージID].[xml|json]

認証ユーザーに届いたダイレクトメッセージから、指定したメッセージIDのダイレクトメッセージを削除します。 削除に成功すると、削除したメッセージを返します。

パラメーター説明
id必須 削除するダイレクトメッセージのメッセージIDを指定。
例)http://api.twitter.com/1/direct_messages/destroy/12345.json
include_entities任意 ステータス情報に'entities'を含める場合は、true,t,1のいずれかを指定。
例)http://api.twitter.com/1/direct_messages/destroy/12345.json?include_entities=true

取得サンプル(XML/JSON)

destroy.xml
▼成功した場合
<?xml version="1.0" encoding="UTF-8"?>
<direct_message>
  <id>3117355212</id>
  <sender_id>55984769</sender_id>
  <text>フォローありがとうございます。</text>
  <recipient_id>7948862</recipient_id>
  <created_at>Thu May 26 16:38:27 +0000 2011</created_at>
  <sender_screen_name>pjroomer</sender_screen_name>
  <recipient_screen_name>cocoism</recipient_screen_name>
  <sender>
    <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>9</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>189</friends_count>
    <created_at>Sun Jul 12 01:37:21 +0000 2009</created_at>
    <favourites_count>99</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>
  </sender>
  <recipient>
    <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>ff6699</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>535</friends_count>
    <created_at>Sat Aug 04 05:52:33 +0000 2007</created_at>
    <favourites_count>443</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>false</notifications>
    <geo_enabled>true</geo_enabled>
    <verified>false</verified>
    <following>true</following>
    <statuses_count>5019</statuses_count>
    <lang>ja</lang>
    <contributors_enabled>false</contributors_enabled>
    <follow_request_sent>false</follow_request_sent>
    <listed_count>52</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>
  </recipient>
</direct_message>

▼削除に失敗した場合
<?xml version="1.0" encoding="UTF-8"?>
<hash>
  <error>No direct message with that ID found.</error>
  <request>/1/direct_messages/destroy/3117355212.xml</request>
</hash>
destroy.json
▼削除に成功した場合
json[recipient]['follow_request_sent']=
json[recipient]['contributors_enabled']=
json[recipient]['notifications']=
json[recipient]['time_zone']=Tokyo
json[recipient]['protected']=
json[recipient]['profile_image_url']=http://a0.twimg.com/profile_images/1202496271/usa_normal.png
json[recipient]['profile_use_background_image']=1
json[recipient]['followers_count']=613
json[recipient]['location']=カワタマ or オモサン
json[recipient]['name']=つんつ
json[recipient]['show_all_inline_media']=1
json[recipient]['geo_enabled']=1
json[recipient]['profile_background_color']=8350a1
json[recipient]['screen_name']=cocoism
json[recipient]['profile_background_image_url']=http://a1.twimg.com/profile_background_images/187449144/02.png
json[recipient]['utc_offset']=32400
json[recipient]['url']=http://phpjavascriptroom.com/
json[recipient]['default_profile']=
json[recipient]['listed_count']=52
json[recipient]['description']=青山でWeb系のお仕事してます。デザイナーズレストランははるか昔に卒業済。芋焼酎と焼鳥が大好きで居心地のいい呑み屋でおやじ談義するのがライフワーク。最近は日本酒をお勉強中。家では大人しく猛犬チワワのママしてます。iPhone4/Xperia所有。
json[recipient]['id_str']=7948862
json[recipient]['lang']=ja
json[recipient]['statuses_count']=5019
json[recipient]['created_at']=Sat Aug 04 05:52:33 +0000 2007
json[recipient]['profile_text_color']=ff6699
json[recipient]['verified']=
json[recipient]['profile_sidebar_fill_color']=8350a1
json[recipient]['profile_background_tile']=1
json[recipient]['id']=7948862
json[recipient]['default_profile_image']=
json[recipient]['friends_count']=535
json[recipient]['profile_link_color']=f2afcf
json[recipient]['is_translator']=
json[recipient]['following']=1
json[recipient]['favourites_count']=443
json[recipient]['profile_sidebar_border_color']=8350a1
json[sender_screen_name]=pjroomer
json[text]=フォローありがとうございます。
json[recipient_screen_name]=cocoism
json[recipient_id]=7948862
json[created_at]=Thu May 26 16:40:27 +0000 2011
json[id_str]=3117368484
json[sender_id]=55984769

json[sender]['follow_request_sent']=
json[sender]['contributors_enabled']=
json[sender]['notifications']=
json[sender]['time_zone']=Tokyo
json[sender]['protected']=
json[sender]['profile_image_url']=http://a0.twimg.com/sticky/default_profile_images/default_profile_1_normal.png
json[sender]['profile_use_background_image']=1
json[sender]['followers_count']=9
json[sender]['location']=Tokyo, Japan
json[sender]['name']=つんこ
json[sender]['show_all_inline_media']=
json[sender]['geo_enabled']=1
json[sender]['profile_background_color']=C0DEED
json[sender]['screen_name']=pjroomer
json[sender]['profile_background_image_url']=http://a0.twimg.com/images/themes/theme1/bg.png
json[sender]['utc_offset']=32400
json[sender]['url']=http://phpjavascriptroom.com
json[sender]['default_profile']=
json[sender]['listed_count']=5
json[sender]['description']=てすあか
json[sender]['id_str']=55984769
json[sender]['lang']=ja
json[sender]['statuses_count']=1425
json[sender]['created_at']=Sun Jul 12 01:37:21 +0000 2009
json[sender]['profile_text_color']=ff6699
json[sender]['verified']=
json[sender]['profile_sidebar_fill_color']=DDEEF6
json[sender]['profile_background_tile']=
json[sender]['id']=55984769
json[sender]['default_profile_image']=1
json[sender]['friends_count']=189
json[sender]['profile_link_color']=0084B4
json[sender]['is_translator']=
json[sender]['following']=
json[sender]['favourites_count']=99
json[sender]['profile_sidebar_border_color']=C0DEED
json[id]=3117368484

▼削除に失敗した場合
json[error]=No direct message with that ID found.
json[request]=/1/direct_messages/destroy/3117305935.json

関連コンテンツ

Q. このサイトの情報はお役に立ちましたでしょうか?

投票する 投票結果を見る

管理人に【web拍手】を送るweb拍手(1行メッセージも送れます♪)

pagetop

polarized women