Statuses/show/en
目录 |
statuses/show/:id
Return a single weibo and author information by ID.
URL
http://api.t.sina.com.cn/statuses/show/:id.(json%7Cxml)
Supported Formats
XML/JSON
HTTP Request Method
GET
Requires Authentication
true
See the Authorization Mechanism Statement for authorization details
Requests Count Limitation
true
See the Interface Access Rights Statement for the Request Count Limitaiton details.
Request Parameters
Requires | Type and Range | Description | |
---|---|---|---|
source | true | string | AppKey for the application to identify it. ( This parameter is not needed when using OAuth) |
:id | true | int64 | The ID of weibo. This is a RESTful parameter. |
Notes
It returns 400 error with "40031:Error: target weibo does not exist!" if the ID doesn’t exist.
Example Request
- XML
- curl -u "username:password" "http://api.t.sina.com.cn/statuses/show/:id.xml?source=appkey"
- JSON
- curl -u "username:password" "http://api.t.sina.com.cn/statuses/show/:id.json?source=appkey"
Response
XML Example
<?xml version="1.0" encoding="UTF-8"?> <status> <created_at>Fri Oct 09 11:32:31 +0800 2009</created_at> <id>456</id> <text>是这样操作,但是功能表现上还要调整。</text> <source> <a href="/">微博开放平台接口</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>1773020834</id> <screen_name>189_测试2</screen_name> <name>189_测试2</name> <province>0</province> <city>0</city> <location/> <description/> <url/> <profile_image_url>http://tp3.sinaimg.cn/1773020834/50/1281023809/1</profile_image_url> <domain/> <gender>m</gender> <followers_count>34</followers_count> <friends_count>28</friends_count> <statuses_count>338</statuses_count> <favourites_count>0</favourites_count> <created_at>Thu Jul 29 00:00:00 +0800 2010</created_at> <following>false</following> <verified>false</verified> <allow_all_act_msg>false</allow_all_act_msg> <geo_enabled>true</geo_enabled> </user> </status>
JSON Example
{ "created_at" : "Fri Oct 09 11:32:31 +0800 2009", "text" : "是这样操作,但是功能表现上还要调整。", "truncated" : false, "in_reply_to_status_id" : "", "in_reply_to_screen_name" : "", "geo" : null, "user" : { "name" : "189_测试2", "domain" : "", "geo_enabled" : true, "followers_count" : 34, "statuses_count" : 338, "favourites_count" : 0, "city" : "0", "description" : "", "verified" : false, "id" : 1773020834, "gender" : "m", "friends_count" : 28, "screen_name" : "189_测试2", "allow_all_act_msg" : false, "following" : false, "url" : "", "profile_image_url" : "http://tp3.sinaimg.cn/1773020834/50/1281023809/1", "created_at" : "Thu Jul 29 00:00:00 +0800 2010", "province" : "0", "location" : "" }, "favorited" : false, "in_reply_to_user_id" : "", "id" : 456, "source" : "<a href=\"/\" rel=\"nofollow\">微博开放平台接口</a>" }
Others
Java Example
Please download Java SDK from . Weibo SDK Development Kit Dowload Site
Sample Code:
package weibo4j.examples.statuses; import java.util.List; import weibo4j.Paging; import weibo4j.Status; import weibo4j.Weibo; public class GetStatus { /** * 获取单条ID的微博信息,作者信息将同时返回 * @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); List<Status> list = weibo.getUserTimeline(args[2], new Paging(1).count(4)); if(list.size() > 0) { Status status = weibo.showStatus(list.get(0).getId()); System.out.println( status.getId() + " : "+status.getText()); } } 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 Example
Please download PHP SDK with OAUTH supported from Weibo SDK Development Kit Dowload Site
.
Sample Code:
//Statuses/show //获取单条ID的微博信息,作者信息将同时返回 $c = new WeiboClient( WB_AKEY , WB_SKEY , $_SESSION['last_key']['oauth_token'] , $_SESSION['last_key']['oauth_token_secret'] ); $u_id = "用户ID"; $msg = $c->user_timeline($u_id); 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; } if (count($msg)>0){ $t_id = $msg[0]['id']; $msg = $c->show_status($t_id); 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; } if (isset($msg['id']) && isset($msg['text'])){ echo($msg['id'].' : '.$msg['text']); } }