Statuses/repost/en
Contents |
statuses/repost
Repost a weibo. Request must be handed in POST method.
URL
http://api.t.sina.com.cn/statuses/repost.(json%7Cxml)
Supported Formats
XML/JSON
HTTP Request Method
POST
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 reposted |
status | false | string | Added repost content. It must be encoded by URLEcode within 140 Chinese character. By default, the content is “Repost status”. |
is_comment | false | int | Whether post comment at the same time. 1 is post, 0 is not. Default is 0. |
Notes
- In order to prevent repeated submit, server returns 400 error if the weibo content is same as the last one.
- To compabile with some older version SDK, there’s another calling method for this interface:
http://api.t.sina.com.cn/statuses/retweet/:id.format - The :id is a RESTful parameter, and it is the weibo ID to be reposted.
- CURL Examples: curl -u "username:password" -d "status=repost_test&source=appkey" "http://api.t.sina.com.cn/statuses/retweet/4022982531.xml"
Example Request
- XML
- curl -u "username:password" -d "id=4022982531&status=test repost" "http://api.t.sina.com.cn/statuses/repost.xml?source=appkey"
- JSON
- curl -u "username:password" -d "id=4022982531&status=test repost" "http://api.t.sina.com.cn/statuses/repost.json?source=appkey"
Response
XML Example
<?xml version="1.0" encoding="UTF-8"?> <status> <created_at>Thu Dec 02 18:27:40 +0800 2010</created_at> <id>4034439847</id> <text>怀念一下食堂</text> <source> <a href="http://open.t.sina.com.cn">微博开放平台接口</a> </source> <favorited>false</favorited> <truncated>false</truncated> <geo/> <in_reply_to_status_id>4034341063</in_reply_to_status_id> <in_reply_to_user_id>1312425275</in_reply_to_user_id> <in_reply_to_screen_name>莓控控</in_reply_to_screen_name> <user> <id>1803880061</id> <screen_name>LoopB</screen_name> <name>LoopB</name> <province>11</province> <city>8</city> <location>北京 海淀区</location> <description/> <url/> <profile_image_url>http://tp2.sinaimg.cn/1803880061/50/0/0</profile_image_url> <domain/> <gender>f</gender> <followers_count>2</followers_count> <friends_count>1</friends_count> <statuses_count>16</statuses_count> <favourites_count>4</favourites_count> <created_at>Fri Aug 27 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> <retweeted_status> <created_at>Thu Dec 02 18:22:41 +0800 2010</created_at> <id>4034341063</id> <text>我在学校食堂。 http://sinaurl.cn/hbhoQP</text> <source> <a href="http://jiepang.com/?utm_source=weibo&utm_medium=social&utm_content=record_share&utm_campaign=appname_link">街旁网分享足迹</a> </source> <favorited>false</favorited> <truncated>false</truncated> <geo xmlns:georss="http://www.georss.org/georss"> <georss:point>38.882116 115.576611</georss:point> </geo> <in_reply_to_status_id/> <in_reply_to_user_id/> <in_reply_to_screen_name/> <user> <id>1312425275</id> <screen_name>莓控控</screen_name> <name>莓控控</name> <province>13</province> <city>6</city> <location>河北 保定</location> <description>明年的今天?我会拥有9300吗?</description> <url>http://1</url> <profile_image_url>http://tp4.sinaimg.cn/1312425275/50/1288322957</profile_image_url> <domain>mikkforever</domain> <gender>m</gender> <followers_count>184</followers_count> <friends_count>133</friends_count> <statuses_count>528</statuses_count> <favourites_count>17</favourites_count> <created_at>Mon Jul 05 00:00:00 +0800 2010</created_at> <following>false</following> <verified>false</verified> <allow_all_act_msg>true</allow_all_act_msg> <geo_enabled>true</geo_enabled> </user> </retweeted_status> </status>
JSON Example
{ "created_at" : "Thu Dec 02 18:33:58 +0800 2010", "text" : "zhuanfa", "truncated" : false, "retweeted_status" : { "created_at" : "Thu Dec 02 18:29:30 +0800 2010", "text" : "zhuanfa", "truncated" : false, "in_reply_to_status_id" : "", "in_reply_to_screen_name" : "", "geo" : null, "user" : { "name" : "LoopB", "domain" : "", "geo_enabled" : true, "followers_count" : 2, "statuses_count" : 19, "favourites_count" : 4, "city" : "8", "description" : "", "verified" : false, "id" : 1803880061, "gender" : "f", "friends_count" : 1, "screen_name" : "LoopB", "allow_all_act_msg" : false, "following" : false, "url" : "", "profile_image_url" : "http://tp2.sinaimg.cn/1803880061/50/0/0", "created_at" : "Fri Aug 27 00:00:00 +0800 2010", "province" : "11", "location" : "北京 海淀区" }, "favorited" : false, "in_reply_to_user_id" : "", "id" : 4034476951, "source" : "<a href=\"\" rel=\"nofollow\">微博开放平台接口</a>" }, "in_reply_to_status_id" : "4034476951", "in_reply_to_screen_name" : "LoopB", "geo" : null, "user" : { "name" : "LoopB", "domain" : "", "geo_enabled" : true, "followers_count" : 2, "statuses_count" : 20, "favourites_count" : 4, "city" : "8", "description" : "", "verified" : false, "id" : 1803880061, "gender" : "f", "friends_count" : 1, "screen_name" : "LoopB", "allow_all_act_msg" : false, "following" : false, "url" : "", "profile_image_url" : "http://tp2.sinaimg.cn/1803880061/50/0/0", "created_at" : "Fri Aug 27 00:00:00 +0800 2010", "province" : "11", "location" : "北京 海淀区" }, "favorited" : false, "in_reply_to_user_id" : "1803880061", "id" : 4034567627, "source" : "<a href=\"http://open.t.sina.com.cn\" rel=\"nofollow\">微博开放平台接口</a>" }
Others
PHP Example
Please download PHP SDK with OAUTH supported from Weibo SDK Development Kit Dowload Site
.
Sample Code:
//Statuses/repost $c = new WeiboClient( WB_AKEY , WB_SKEY , $_SESSION['last_key']['oauth_token'] , $_SESSION['last_key']['oauth_token_secret'] ); $msg = $c->user_timeline(); if ($msg === false || $msg === null){ echo "Error occured"; return false; } if (count($msg)> 1){ $sid = $msg[1]['id']; echo($sid); $msg = $c->repost($sid); if ($msg === false || $msg === null){ echo "Error occured"; return false; } echo($msg['id'].' : '.$msg['text']); }
文档更新时间: 20 January 2011