微博开放平台
微连接
移动应用
网站接入
电商服务商
电商商家
数据服务
数据服务
合作伙伴
微博支付
轻应用
粉丝服务
文档
推广
我的应用
登录
weibo
开发文档
首页
平台政策与指引
概述
平台公约
新手指南
开发者协议
应用运营管理规范
微连接分级管理办法
应用审核产品指南
应用安全开发注意事项
平台应用设计规范
微服务接入指南
微博登录接入
用微博帐号登录
授权机制
移动应用接入
移动应用介绍
移动应用SSO授权
微博Deep Link
媒体接入平台
头条文章开放接口
视频上传开放接口
电商接入平台
电商服务商接入
电商商家端接入
电商平台能力接口
粉丝服务平台
粉丝服务平台
新手接入指南
微信开发者迁移指南
接收消息
发送消息
自定义菜单
用户管理
生成带参数的二维码
Fans Service Platform
商业接口
商业数据接入指南
订阅服务手册(中文版)
订阅服务手册(英文版)
商业接口-REST API
商业数据常见问题
网站接入
网站接入介绍
微博API
微博API
接口访问频次权限
资源下载
SDK
微博标识下载
常见问题
联系我们
工具箱
链入页面
链出更改
特殊页面
查看源代码
跳转到:
导航
,
搜索
根据下列原因,你没有权限编辑本页:
您刚才请求的操作只有这个用户组中的用户才能使用:
用户
您可以查看并复制此页面的源代码:
{{api_desc2| uri=favorites/destroy/:id| desc=删除微博收藏。注意:只能删除自己收藏的信息。| format=XML/JSON| httpMethod=POST/DELETE| needAuth=true| rateLimit=true| params={{api_args|:id|true|int64|要删除的已收藏的微博消息ID。该参数为一个REST风格参数。用法参见注意事项。}}| getParam=| postParam=-X DELETE| result= ===XML示例=== <pre> <?xml version="1.0" encoding="UTF-8"?> <status> <created_at>Thu Mar 18 19:07:05 +0800 2010</created_at> <id>1</id> <text>这么小就入党了 敬仰~</text> <source> <a href="http://news.sina.com.cn/wap/wbk.html/">新浪微博手机版</a> </source> <favorited>true</favorited> <truncated>false</truncated> <geo/> <in_reply_to_status_id/> <in_reply_to_user_id/> <in_reply_to_screen_name/> <user> <id>1152759471</id> <screen_name>老王</screen_name> <name>老王</name> <province>11</province> <city>8</city> <location>北京 海淀区</location> <description>哼。。。 花样真多。 讨厌。</description> <url>http://1</url> <profile_image_url>http://tp4.sinaimg.cn/1152759471/50/1263371934</profile_image_url> <domain>hotpixel</domain> <gender>m</gender> <followers_count>1567</followers_count> <friends_count>202</friends_count> <statuses_count>6776</statuses_count> <favourites_count>0</favourites_count> <created_at>Fri Aug 28 00:00:00 +0800 2009</created_at> <following>false</following> <verified>false</verified> <allow_all_act_msg>false</allow_all_act_msg> <geo_enabled>false</geo_enabled> </user> <retweeted_status> <created_at>Thu Mar 18 19:05:52 +0800 2010</created_at> <id>27657268</id> <text>班里开始交团费了,跟我没关系</text> <source> <a href="http://news.sina.com.cn/wap/wbk.html/">新浪微博手机版</a> </source> <favorited>true</favorited> <truncated>false</truncated> <geo/> <in_reply_to_status_id/> <in_reply_to_user_id/> <in_reply_to_screen_name/> <user> <id>1654703984</id> <screen_name>高考铅笔亚克西</screen_name> <name>高考铅笔亚克西</name> <province>42</province> <city>1</city> <location>湖北 武汉</location> <description>在通往高考的路上乳摇狂奔,偶尔发骚回头抛个媚眼骂句操蛋,切不可以为姐就是招之即上挥之自摸的小娘儿们。好不容易成年了,姐要更加有湿想嗯哼。</description> <url/> <profile_image_url>http://tp1.sinaimg.cn/1654703984/50/1264140632</profile_image_url> <domain>kimmy14</domain> <gender>f</gender> <followers_count>1330</followers_count> <friends_count>755</friends_count> <statuses_count>3354</statuses_count> <favourites_count>0</favourites_count> <created_at>Mon Oct 19 00:00:00 +0800 2009</created_at> <following>false</following> <verified>false</verified> <allow_all_act_msg>false</allow_all_act_msg> <geo_enabled>false</geo_enabled> </user> </retweeted_status> </status> </pre> ===JSON示例=== <pre> { "created_at" : "Thu Mar 18 19:07:05 +0800 2010", "text" : "这么小就入党了 敬仰~", "truncated" : false, "retweeted_status" : { "created_at" : "Thu Mar 18 19:05:52 +0800 2010", "text" : "班里开始交团费了,跟我没关系", "truncated" : false, "in_reply_to_status_id" : "", "in_reply_to_screen_name" : "", "geo" : null, "user" : { "name" : "高考铅笔亚克西", "domain" : "kimmy14", "geo_enabled" : false, "followers_count" : 1330, "statuses_count" : 3354, "favourites_count" : 0, "city" : "1", "description" : "在通往高考的路上乳摇狂奔,偶尔发骚回头抛个媚眼骂句操蛋,切不可以为姐就是招之即上挥之自摸的小娘儿们。好不容易成年了,姐要更加有湿想嗯哼。", "verified" : false, "id" : 1654703984, "gender" : "f", "friends_count" : 755, "screen_name" : "高考铅笔亚克西", "allow_all_act_msg" : false, "following" : false, "url" : "", "profile_image_url" : "http://tp1.sinaimg.cn/1654703984/50/1264140632", "created_at" : "Mon Oct 19 00:00:00 +0800 2009", "province" : "42", "location" : "湖北 武汉" }, "favorited" : true, "in_reply_to_user_id" : "", "id" : 27657268, "source" : "<a href=\"http://news.sina.com.cn/wap/wbk.html/\" rel=\"nofollow\">新浪微博手机版</a>" }, "in_reply_to_status_id" : "", "in_reply_to_screen_name" : "", "geo" : null, "user" : { "name" : "老王", "domain" : "hotpixel", "geo_enabled" : false, "followers_count" : 1567, "statuses_count" : 6776, "favourites_count" : 0, "city" : "8", "description" : "哼。。。 花样真多。 讨厌。", "verified" : false, "id" : 1152759471, "gender" : "m", "friends_count" : 202, "screen_name" : "老王", "allow_all_act_msg" : false, "following" : false, "url" : "http://1", "profile_image_url" : "http://tp4.sinaimg.cn/1152759471/50/1263371934", "created_at" : "Fri Aug 28 00:00:00 +0800 2009", "province" : "11", "location" : "北京 海淀区" }, "favorited" : true, "in_reply_to_user_id" : "", "id" : 1, "source" : "<a href=\"http://news.sina.com.cn/wap/wbk.html/\" rel=\"nofollow\">新浪微博手机版</a>" } </pre>| useAge= * :id为REST风格的参数,使用该参数的URL为:<br/> http://api.t.sina.com.cn/favorites/destroy/:id.format<br/> 使用示例如下:<br/> http://api.t.sina.com.cn/favorites/destroy/123456.xml?source=appkey<br/>http://api.t.sina.com.cn/favorites/destroy/123456.json?source=appkey * 如果没有登录或超过频率限制,将返回403错误 * 收藏消息ID不存在,将返回400错误 * 删除成功返回删除的收藏微博消息| otherInfo= ===Java示例=== 请从 [[SDK | 微博SDK开发包下载]] 下载Java SDK<br> 代码示例如下: package weibo4j.examples; import java.util.List; import weibo4j.Status; import weibo4j.Weibo; import weibo4j.WeiboException; public class DestroyFavorite { /** * 删除当前用户收藏的微博信息 * @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); weibo.destroyFavorite(Long.parseLong(args[2])); List<Status> list = weibo.getFavorites(); for(Status status : list) { System.out.println(status.toString()); } } catch (WeiboException 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> //favorites/destroy //删除当前用户收藏的微博信息 $c = new WeiboClient( WB_AKEY , WB_SKEY , $_SESSION['last_key']['oauth_token'] , $_SESSION['last_key']['oauth_token_secret'] ); //微博信息id $sid='sid'; $msg = $c->remove_from_favorites( $sid ); 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['text'])){ echo($msg['text']); } </pre> }}
该页面使用的模板:
模板:Api args
(
查看源代码
)
模板:Api desc2
(
查看源代码
)
返回到
Favorites/destroy
。
反馈
分享
顶部