微博开放平台
微连接
移动应用
网站接入
电商服务商
电商商家
数据服务
数据服务
合作伙伴
微博支付
轻应用
粉丝服务
文档
推广
我的应用
登录
weibo
开发文档
首页
平台政策与指引
概述
平台公约
新手指南
开发者协议
应用运营管理规范
微连接分级管理办法
应用审核产品指南
应用安全开发注意事项
平台应用设计规范
微服务接入指南
微博登录接入
用微博帐号登录
授权机制
移动应用接入
移动应用介绍
移动应用SSO授权
微博Deep Link
媒体接入平台
头条文章开放接口
视频上传开放接口
电商接入平台
电商服务商接入
电商商家端接入
电商平台能力接口
粉丝服务平台
粉丝服务平台
新手接入指南
微信开发者迁移指南
接收消息
发送消息
自定义菜单
用户管理
生成带参数的二维码
Fans Service Platform
商业接口
商业数据接入指南
订阅服务手册(中文版)
订阅服务手册(英文版)
商业接口-REST API
商业数据常见问题
网站接入
网站接入介绍
微博API
微博API
接口访问频次权限
资源下载
SDK
微博标识下载
常见问题
联系我们
工具箱
链入页面
链出更改
特殊页面
查看源代码
跳转到:
导航
,
搜索
根据下列原因,你没有权限编辑本页:
您刚才请求的操作只有这个用户组中的用户才能使用:
用户
您可以查看并复制此页面的源代码:
{{api_desc2| uri=statuses/update| desc=发布一条微博信息。也可以同时转发某条微博。请求必须用POST方式提交。 | format=XML/JSON| httpMethod=POST| needAuth=true| rateLimit=true| params={{api_args|status|true|string|要发布的微博消息文本内容}} {{api_args|in_reply_to_status_id|false|int64|要转发的微博消息ID。}} {{api_args|lat|false|float|纬度。有效范围:-90.0到+90.0,+表示北纬。}} {{api_args|long|false|float|经度。有效范围:-180.0到+180.0,+表示东经。}} {{api_args_colspan|1=<font style="color:#ee6666">注意:lat和long参数需配合使用,用于标记发表微博消息时所在的地理位置,只有用户设置中geo_enabled=true时候地理位置信息才有效。</font>}}| getParam=| postParam=-d "status=abc"| result= ===XML示例=== <pre> <?xml version="1.0" encoding="UTF-8"?> <status> <created_at>Thu Dec 02 11:53:33 +0800 2010</created_at> <id>4016590347</id> <text>abc</text> <source> <a href="http://open.t.sina.com.cn">微博开放平台接口</a> </source> <favorited>false</favorited> <truncated>false</truncated> <geo/> <in_reply_to_status_id/> <in_reply_to_user_id/> <in_reply_to_screen_name/> <user> <id>1658122963</id> <screen_name>zhangwei217245</screen_name> <name>zhangwei217245</name> <province>11</province> <city>5</city> <location>北京 朝阳区</location> <description>ABCDE</description> <url/> <profile_image_url>http://tp4.sinaimg.cn/1658122963/50/1282754213</profile_image_url> <domain>zhangwei217245</domain> <gender>m</gender> <followers_count>22</followers_count> <friends_count>43</friends_count> <statuses_count>104</statuses_count> <favourites_count>3</favourites_count> <created_at>Tue Nov 03 00:00:00 +0800 2009</created_at> <following>false</following> <verified>false</verified> <allow_all_act_msg>false</allow_all_act_msg> <geo_enabled>true</geo_enabled> </user> </status> </pre> ===JSON示例=== <pre> { "created_at" : "Thu Dec 02 15:17:25 +0800 2010", "text" : "为什么欠钱?为什么呀?", "truncated" : false, "retweeted_status" : { "created_at" : "Thu Dec 02 13:12:07 +0800 2010", "text" : "唉,每天一睁眼就又欠银行100块钱! http://sinaurl.cn/hHjxb", "truncated" : false, "in_reply_to_status_id" : "", "annotations" : [ ], "in_reply_to_screen_name" : "", "geo" : null, "user" : { "name" : "xiecharll", "domain" : "xiecharll", "geo_enabled" : true, "followers_count" : 24, "statuses_count" : 66, "favourites_count" : 3, "city" : "8", "description" : "蹲在马路中间的人", "verified" : false, "id" : 1646310564, "gender" : "m", "friends_count" : 24, "screen_name" : "xiecharll", "allow_all_act_msg" : false, "following" : false, "url" : "http://1", "profile_image_url" : "http://tp1.sinaimg.cn/1646310564/50/1252581612/1", "created_at" : "Thu Sep 10 00:00:00 +0800 2009", "province" : "11", "location" : "北京 海淀区" }, "favorited" : false, "in_reply_to_user_id" : "", "id" : 4018420969, "source" : "<a href=\"http://t.sina.com.cn\" rel=\"nofollow\">新浪微博</a>" }, "in_reply_to_status_id" : "4018420969", "in_reply_to_screen_name" : "xiecharll", "geo" : null, "user" : { "name" : "zhangwei217245", "domain" : "zhangwei217245", "geo_enabled" : true, "followers_count" : 22, "statuses_count" : 107, "favourites_count" : 3, "city" : "5", "description" : "ABCDE", "verified" : false, "id" : 1658122963, "gender" : "m", "friends_count" : 43, "screen_name" : "zhangwei217245", "allow_all_act_msg" : false, "following" : false, "url" : "", "profile_image_url" : "http://tp4.sinaimg.cn/1658122963/50/1282754213", "created_at" : "Tue Nov 03 00:00:00 +0800 2009", "province" : "11", "location" : "北京 朝阳区" }, "favorited" : false, "in_reply_to_user_id" : "1646310564", "id" : 4020927147, "source" : "<a href=\"http://open.t.sina.com.cn\" rel=\"nofollow\">微博开放平台接口</a>" } </pre>| useAge= * 为防止重复提交,当用户发布的微博消息与上次成功发布的微博消息内容一样时,将返回400错误,给出错误提示:“40025:Error: repeated weibo text!“。 * 转发微博消息时接口的表现可参考[[statuses/repost]]| otherInfo= ===Java示例=== 请从 [[SDK | 微博SDK开发包下载]] 下载Java SDK<br> 代码示意如下: package weibo4j.examples; import weibo4j.Status; import weibo4j.Weibo; public class UpdateStatus { /** * 发布一条微博信息 * @param args */ public static void main(String[] args) { System.setProperty("weibo4j.oauth.consumerKey", Weibo.CONSUMER_KEY); System.setProperty("weibo4j.oauth.consumerSecret", Weibo.CONSUMER_SECRET); try { Weibo weibo = getWeibo(true,args); Status status = weibo.updateStatus("测试发表微博"); System.out.println(status.getId() + " : "+ status.getText()+" "+status.getCreatedAt()); } catch (Exception e) { e.printStackTrace(); } } private static Weibo getWeibo(boolean isOauth,String ... args) { Weibo weibo = new Weibo(); if(isOauth) {//oauth验证方式 args[0]:访问的token;args[1]:访问的密匙 weibo.setToken(args[0], args[1]); }else {//用户登录方式 weibo.setUserId(args[0]);//用户名/ID weibo.setPassword(args[1]);//密码 } return weibo; } } ===PHP示例=== 请从 [[SDK | 微博SDK开发包下载]] 处下载PHP SDK(支持OAuth验证之版本)<br> 代码示例如下: <pre> //Statuses/update $c = new WeiboClient( WB_AKEY , WB_SKEY , $_SESSION['last_key']['oauth_token'] , $_SESSION['last_key']['oauth_token_secret'] ); $msg = $c->update("测试发表微博"); if ($msg === false || $msg === null){ echo "Error occured"; return false; } if (isset($msg['error_code']) && isset($msg['error'])){ echo ('Error_code: '.$msg['error_code'].'; Error: '.$msg['error'] ); return false; } echo($msg['id']." : ".$msg['text']." ".$msg["created_at"]); </pre> }}
该页面使用的模板:
模板:Api args
(
查看源代码
)
模板:Api args colspan
(
查看源代码
)
模板:Api desc2
(
查看源代码
)
返回到
Statuses/update
。
反馈
分享
顶部