Statuses/destroy/en
Contents |
statuses/destroy/:id
Delete status by the ID. Notes: you can only delete the weibo created by yourself.
URL
http://api.t.sina.com.cn/statuses/destroy/:id.(json%7Cxml)
Supported Formats
XML/JSON
HTTP Request Method
POST/DELETE
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 weibo ID to be deleted. |
Notes
Return 400 error if parameter is wrong.
Example Request
- XML
- curl -u "username:password" -X DELETE "http://api.t.sina.com.cn/statuses/destroy/:id.xml?source=appkey"
- JSON
- curl -u "username:password" -X DELETE "http://api.t.sina.com.cn/statuses/destroy/:id.json?source=appkey"
Response
XML Example
<?xml version="1.0" encoding="UTF-8"?> <status> <created_at>Thu Dec 02 15:09:11 +0800 2010</created_at> <id>4020772979</id> <text>fTW9YwY</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>1803876591</id> <screen_name>loopa</screen_name> <name>loopa</name> <province>11</province> <city>8</city> <location>北京 海淀区</location> <description>AnRHJLCc9Ac0fCY</description> <url/> <profile_image_url>http://tp4.sinaimg.cn/1803876591/50/0/1</profile_image_url> <domain/> <gender>m</gender> <followers_count>28</followers_count> <friends_count>2</friends_count> <statuses_count>13714</statuses_count> <favourites_count>1</favourites_count> <created_at>Wed Dec 01 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" : "Thu Dec 02 14:22:35 +0800 2010", "text" : "CT7rM6v", "truncated" : false, "in_reply_to_status_id" : "", "in_reply_to_screen_name" : "", "geo" : null, "user" : { "name" : "loopa", "domain" : "", "geo_enabled" : true, "followers_count" : 28, "statuses_count" : 13715, "favourites_count" : 1, "city" : "8", "description" : "4mcJW0EhJiU1GwN", "verified" : false, "id" : 1803876591, "gender" : "m", "friends_count" : 2, "screen_name" : "loopa", "allow_all_act_msg" : false, "following" : false, "url" : "", "profile_image_url" : "http://tp4.sinaimg.cn/1803876591/50/0/1", "created_at" : "Wed Dec 01 00:00:00 +0800 2010", "province" : "11", "location" : "北京 海淀区" }, "favorited" : false, "in_reply_to_user_id" : "", "id" : 4019894325, "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; import java.util.List; import weibo4j.Status; import weibo4j.Weibo; public class DeleteStatus { /** * 删除一条微博信息 * @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()); //删除刚发表的微博 status = weibo.destroyStatus(status.getId()); List<Status> list = weibo.getUserTimeline(args[2]);//args[2]:用户id for(Status st : list) {//遍历当前微博信息 System.out.println(st.getId() + " : "+ st.getText()+" "+st.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 Example
Please download PHP SDK with OAUTH supported from Weibo SDK Development Kit Dowload Site
.
Sample Code:
//Statuses/destroy $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"]); //删除刚发表的微博 $c->destroy($msg['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; } //user id $uid = "User ID"; $msg = $c->user_timeline($uid); 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; } //遍历当前微博信息 foreach($msg as $data){ echo($data['id']." : ".$data['text']." ".$data["created_at"]); }
文档更新时间: 20 January 2011