Direct messages

跳转到: 导航, 搜索

目录

direct_messages

返回用户的最新20条私信。XML和JSON的版本有发送者和接受者的详细资料。

Returns a list of the 20 most recent direct messages sent to the authenticating user. The XML and JSON versions include detailed information about the sending and recipient users.

URL

curl http://api.t.sina.com.cn/direct_messages.format

格式

xml, json, rss, atom

HTTP请求方式

GET

是否需要身份验证

true

请求数限制

1 call per request

请求参数

  • since_id. 可选参数. 返回ID比数值since_id大(比since_id时间晚的)的私信。

o Example: http://api.t.sina.com.cn/direct_messages.xml?since_id=12345

  • max_id. 可选参数. 返回ID不大于max_id(时间不晚于max_id)的私信。

o Example: http://api.t.sina.com.cn/direct_messages.xml?max_id=54321

  • count. 可选参数. 每次返回的最大记录数(即页面大小),不大于200。

o Example: http://api.t.sina.com.cn/direct_messages.xml?count=200

  • page. 可选参数. 返回结果的页序号。注意:有分页限制。

o Example: http://api.t.sina.com.cn/direct_messages.xml?page=3

  • since_id. Optional. Returns only direct messages with an ID greater than (that is, more recent than) the specified ID.

o Example: http://api.t.sina.com.cn/direct_messages.xml?since_id=12345

  • max_id. Optional.Returns only statuses with an ID less than (that is, older than) or equal to the specified ID.

o Example: http://api.t.sina.com.cn/direct_messages.xml?max_id=54321

  • count. Optional. Specifies the number of statuses to retrieve. May not be greater than 200.

o Example: http://api.t.sina.com.cn/direct_messages.xml?count=200

  • page. Optional. Specifies the page of direct messages to retrieve.

o Example: http://api.t.sina.com.cn/direct_messages.xml?page=3

返回

XML示例:

<?xml version="1.0" encoding="UTF-8"?>
<direct-messages>
 <direct_message>
  <id>88619848</id>
  <sender_id>1401881</sender_id>
  <text>all your bases are belong to us.</text>
  <recipient_id>7004322</recipient_id>
  <created_at>Wed Apr 08 20:30:04 +0000 2009</created_at>
  <sender_screen_name>dougw</sender_screen_name>
  <recipient_screen_name>igudo</recipient_screen_name>
  <sender>
   <id>1401881</id>
   <name>Doug Williams</name>
   <screen_name>dougw</screen_name>
   <location>San Francisco, CA</location>
   <description>Sina API Support. Internet, greed, users, dougw and opportunities are my passions.</description>
   <profile_image_url>avatar.png</profile_image_url>
   <url>http://www.igudo.com</url>
   <protected>false</protected>
   <followers_count>1036</followers_count>
   <profile_background_color>9ae4e8</profile_background_color>
   <profile_text_color>000000</profile_text_color>
   <profile_link_color>0000ff</profile_link_color>
   <profile_sidebar_fill_color>e0ff92</profile_sidebar_fill_color>
   <profile_sidebar_border_color>87bc44</profile_sidebar_border_color>
   <friends_count>290</friends_count>
   <created_at>Sun Mar 18 06:42:26 +0000 2007</created_at>
   <favourites_count>0</favourites_count>
   <utc_offset>-18000</utc_offset>
   <time_zone>Eastern Time (US & Canada)</time_zone>
   
   <profile_background_tile>false</profile_background_tile>
   <statuses_count>3394</statuses_count>
   <notifications>false</notifications>
   <following>false</following>
   <verified>true</verified>
  </sender>
  <recipient>
   <id>7004322</id>
   <name>Doug Williams</name>
   <screen_name>igudo</screen_name>
   <location>North Carolina</location>
   <description>A character.</description>
   <profile_image_url>twitter_48_48_normal.jpg</profile_image_url>
   <url>http://www.igudo.com</url>
   <protected>false</protected>
   <followers_count>19</followers_count>
   <profile_background_color>69A1AA</profile_background_color>
   <profile_text_color>000000</profile_text_color>
   <profile_link_color>F00</profile_link_color>
   <profile_sidebar_fill_color>ACBEC1</profile_sidebar_fill_color>
   <profile_sidebar_border_color>8A8F85</profile_sidebar_border_color>
   <friends_count>3</friends_count>
   <created_at>Thu Jun 21 21:16:21 +0000 2007</created_at>
   <favourites_count>0</favourites_count>
   <utc_offset>-18000</utc_offset>
   <time_zone>Eastern Time (US & Canada)</time_zone>
   <profile_background_image_url>bg.gif</profile_background_image_url>
   <profile_background_tile>false</profile_background_tile>
   <statuses_count>382</statuses_count>
   <notifications>false</notifications>
   <following>true</following>
   <verified>true</verified>
  </recipient>
 </direct_message>
   ... truncated ...
</direct-messages>

使用示例

cURL:

curl -u user:password http://api.t.sina.com.cn/direct_messages.xml