Skip to content

direct messages.new

lisztli edited this page Mar 26, 2012 · 9 revisions

#POST /direct_messages/new

发送私信

##路径

http://api.fanfou.com/direct_messages/new.[json|xml|rss]

##调用方法

POST 

##限制条件

用户登录, 发送私信频率限制, API需要有发送私信的权限

##参数:

###user

  • 作用: 发送私信目的用户

  • 格式: user=user_text

  • 字段说明: 必选

###text

  • 作用: 私信内容

  • 格式: text=msg_text

  • 字段说明: 必选, 长度小于140

###in_reply_to_id

  • 作用: 回复的私信id

  • 格式: in_reply_to_id=msg_id

  • 字段说明: 可选

###mode

  • 作用: 当mode=default(默认)时,返回消息中用户信息包含用户自定义profile.mode=lite, profile不会包含在返回信息中

  • 格式: mode=[default|lite]

  • 字段说明: 可选

###callback

  • 作用: 当使用json格式时,生成的json对象将作为参数传给指定的javascript函数

  • 格式: callback=javascript函数名

  • 字段说明: 可选

##返回结果

###成功

  • HTTP Status Code

    200 OK HTTP/1.1

  • 返回值

    • json格式

      已发送私信的详细内容,私信格式参见示例

##示例

curl -u "test:pwd" -d "user=lisztli&text=test_direct_message" "api.fanfou.com/direct_messages/new.json"

###返回结果 { "id": "wgFPBXHGdwQ", "text": "test_direct_message", "sender_id": "test", "recipient_id": "lisztli", "created_at": "Thu Nov 17 03:45:20 +0000 2011", "sender_screen_name": "\u6d4b\u8bd5\u6635\u79f0", "recipient_screen_name": "LisztLi", "sender": {"id": "test", "name": "\u6d4b\u8bd5\u6635\u79f0", "screen_name": "\u6d4b\u8bd5\u6635\u79f0", "location": "\u5317\u4eac \u6d77\u6dc0\u533a", "gender": "\u7537", "birthday": "2105-03-11", "description": "\u6d4b\u8bd5\u5e10\u53f7", "profile_image_url": "http://avatar3.fanfou.com/s0/00/5n/sk.jpg?1320913295", "profile_image_url_large": "http://avatar3.fanfou.com/l0/00/5n/sk.jpg?1320913295", "url": "http://fanfou.com/test", "protected": true, "followers_count": 6, "friends_count": 12, "favourites_count": 25, "statuses_count": 134, "following": false, "notifications": false, "created_at": "Sat Jun 09 23:56:33 +0000 2007", "utc_offset": 28800, "profile_background_color": "#ffffe5", "profile_text_color": "#004040", "profile_link_color": "#ff0000", "profile_sidebar_fill_color": "#ffefbf", "profile_sidebar_border_color": "#ffac80", "profile_background_image_url": "http://avatar.fanfou.com/b0/00/5n/sk_1321293707.jpg", "profile_background_tile": true }, "recipient": {"id": "lisztli", "name": "LisztLi", "screen_name": "LisztLi", "location": "\u5317\u4eac \u6d77\u6dc0\u533a", "gender": "\u7537", "birthday": "1986-02-07", "description": "", "profile_image_url": "http://avatar3.fanfou.com/s0/00/3z/3k.jpg?1308030845", "profile_image_url_large": "http://avatar3.fanfou.com/l0/00/3z/3k.jpg?1308030845", "url": "", "protected": false, "followers_count": 162, "friends_count": 143, "favourites_count": 12, "statuses_count": 2668, "following": false, "notifications": false, "created_at": "Wed Sep 05 01:11:07 +0000 2007", "utc_offset": 28800, "profile_background_color": "#acdae5", "profile_text_color": "#222222", "profile_link_color": "#0066cc", "profile_sidebar_fill_color": "#e2f2da", "profile_sidebar_border_color": "#b2d1a3", "profile_background_image_url": "http://avatar.fanfou.com/b0/00/3z/3k_1308411449.jpg", "profile_background_tile": true }, "in_reply_to": {"id": "2077", "text": "reply_direct_message", "sender_id": "lisztli", "recipient_id": "test", "created_at": "Thu Nov 16 03:45:20 +0000 2011", "recipient_screen_name": "\u6d4b\u8bd5\u6635\u79f0", "sender_screen_name": "LisztLi", "recipient": {"id": "test", "name": "\u6d4b\u8bd5\u6635\u79f0", "screen_name": "\u6d4b\u8bd5\u6635\u79f0", "location": "\u5317\u4eac \u6d77\u6dc0\u533a", "gender": "\u7537", "birthday": "2105-03-11", "description": "\u6d4b\u8bd5\u5e10\u53f7", "profile_image_url": "http://avatar3.fanfou.com/s0/00/5n/sk.jpg?1320913295", "profile_image_url_large": "http://avatar3.fanfou.com/l0/00/5n/sk.jpg?1320913295", "url": "http://fanfou.com/test", "protected": true, "followers_count": 6, "friends_count": 12, "favourites_count": 25, "statuses_count": 134, "following": false, "notifications": false, "created_at": "Sat Jun 09 23:56:33 +0000 2007", "utc_offset": 28800, "profile_background_color": "#ffffe5", "profile_text_color": "#004040", "profile_link_color": "#ff0000", "profile_sidebar_fill_color": "#ffefbf", "profile_sidebar_border_color": "#ffac80", "profile_background_image_url": "http://avatar.fanfou.com/b0/00/5n/sk_1321293707.jpg", "profile_background_tile": true }, "sender": {"id": "lisztli", "name": "LisztLi", "screen_name": "LisztLi", "location": "\u5317\u4eac \u6d77\u6dc0\u533a", "gender": "\u7537", "birthday": "1986-02-07", "description": "", "profile_image_url": "http://avatar3.fanfou.com/s0/00/3z/3k.jpg?1308030845", "profile_image_url_large": "http://avatar3.fanfou.com/l0/00/3z/3k.jpg?1308030845", "url": "", "protected": false, "followers_count": 162, "friends_count": 143, "favourites_count": 12, "statuses_count": 2668, "following": false, "notifications": false, "created_at": "Wed Sep 05 01:11:07 +0000 2007", "utc_offset": 28800, "profile_background_color": "#acdae5", "profile_text_color": "#222222", "profile_link_color": "#0066cc", "profile_sidebar_fill_color": "#e2f2da", "profile_sidebar_border_color": "#b2d1a3", "profile_background_image_url": "http://avatar.fanfou.com/b0/00/3z/3k_1308411449.jpg", "profile_background_tile": true } } }

###字段说明

字段返回值 字段类型 字段说明
id string 私信id
text string 私信内容
sender_id string 发出私信的用户id
recipient_id string 收到私信的用户id
created_at string 发出私信的时间
sender_screen_name string 发出私信的用户昵称
recipient_screen_name string 收到私信的用户昵称
sender object 发出私信的用户信息, 详情参见User Show
recipient object 收到私信的用户信息, 详情参见User Show
in_reply_to object 回复的私信, 详情参见Direct_messages New
Clone this wiki locally