Direct messages/new

跳转到: 导航, 搜索
(Response)
(Response)
第41行: 第41行:
 
     <id>11075</id>
 
     <id>11075</id>
 
     <screen_name>zhulei</screen_name>
 
     <screen_name>zhulei</screen_name>
     <name>Tim Yang</name>
+
     <name>Zhu Lei</name>
 
     <location>广州</location>
 
     <location>广州</location>
 
     <description> </description>
 
     <description> </description>

2009年11月18日 (三) 18:16的版本

目录

发送私信

发送一条私信。必须包含参数user和text,请求必须使用POST方式提交。成功将返回完整的发送消息。

URL

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

格式

xml, json

HTTP请求方式

POST

是否需要身份验证

true

请求数限制

false

请求参数

  • user: 必须参数. UID或账户名. 为了支持数字的账户名,需选填写下面2个参数screen_name或user_id:
  • screen_name: 账户名
  • user_id: 新浪UID
  • text: 必须参数. 要发生的消息内容,需要做URLEncode,文本大小必须小于140个汉字.

使用说明

  • 此接口问更新受限接口,越权将返回http 403 错误
  • This method is subject to update limits. A HTTP 403 will be returned if this limit has been hit.

Response

XML示例:

<?xml version="1.0" encoding="UTF-8"?>
<direct_message>
 <id>88619848</id>
 <sender_id>11075</sender_id>
 <text>hi,最近好呢?</text>
 <recipient_id>10503</recipient_id>
 <created_at>Wed Nov 18 20:30:04 +0000 2009</created_at>
 <sender_screen_name>zhulei</sender_screen_name>
 <recipient_screen_name>timyang</recipient_screen_name>
 <sender>
   <id>11075</id>
   <screen_name>zhulei</screen_name>
   <name>Zhu Lei</name>
   <location>广州</location>
   <description> </description>
   <profile_image_url>http://tt8.sinaimg.cn/11075/50/1256307436</profile_image_url>
   <followers_count>0</followers_count>
   <friends_count>0</friends_count>
   <statuses_count>0</statuses_count>
   <favourites_count>0</favourites_count>
  </sender>
 <recipient>
  <id>10503</id>
   <screen_name>timyang</screen_name>
   <name>Tim Yang</name>
   <location>广州</location>
   <description>blog: timyang.net</description>
   <profile_image_url>http://tt8.sinaimg.cn/10503/50/1256306049</profile_image_url>
   <followers_count>0</followers_count>
   <friends_count>0</friends_count>
   <statuses_count>0</statuses_count>
   <favourites_count>0</favourites_count>
  </recipient>
</direct_message>

使用示例

cURL:

curl -u user:password -d "text=all your bases are belong to us&user=user_2" http://api.t.sina.com.cn/direct_messages/new.xml