Statuses/comment
(→请求参数) |
|||
第1行: | 第1行: | ||
− | + | {{api_desc2| | |
− | + | uri=statuses/comment| | |
+ | desc=对一条微博信息进行评论。请求必须用POST方式提交。| | ||
+ | format=XML/JSON| | ||
+ | httpMethod=POST| | ||
+ | needAuth=true| | ||
+ | rateLimit=true| | ||
+ | params={{api_args|id|true|int64|要评论的微博消息ID}} | ||
+ | {{api_args|comment|true|string|评论内容。必须做URLEncode,信息内容不超过140个汉字。}} | ||
+ | {{api_args|cid|false|int64|要回复的评论ID。}}| | ||
+ | getParam=| | ||
+ | postParam=-d "id=4046214423&comment=wahaha"| | ||
+ | result= | ||
+ | ===XML示例=== | ||
+ | <pre> | ||
+ | <?xml version="1.0" encoding="UTF-8"?> | ||
+ | <comment> | ||
+ | <created_at>Fri Dec 03 10:22:44 +0800 2010</created_at> | ||
+ | <id>4976730453</id> | ||
+ | <text>wahaha</text> | ||
+ | <source> | ||
+ | <a href="http://open.t.sina.com.cn">微博开放平台接口</a> | ||
+ | </source> | ||
+ | <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>115</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> | ||
+ | <status> | ||
+ | <created_at>Thu Dec 02 17:23:52 +0800 2010</created_at> | ||
+ | <id>4023418959</id> | ||
+ | <text>哎呀妈呀,终于找到组织了。</text> | ||
+ | <source> | ||
+ | <a href="http://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/> | ||
+ | <retweeted_status> | ||
+ | <created_at>Thu Dec 02 17:23:03 +0800 2010</created_at> | ||
+ | <id>4023402439</id> | ||
+ | <text>再看看在哪AGAIN</text> | ||
+ | <source> | ||
+ | <a href="">微博开放平台接口</a> | ||
+ | </source> | ||
+ | <favorited>false</favorited> | ||
+ | <truncated>false</truncated> | ||
+ | <geo xmlns:georss="http://www.georss.org/georss"> | ||
+ | <georss:point>39.984833 116.310005</georss:point> | ||
+ | </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>113</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> | ||
+ | </retweeted_status> | ||
+ | <annotations/> | ||
+ | </status> | ||
+ | </user> | ||
+ | <status> | ||
+ | <created_at>Fri Dec 03 09:25:51 +0800 2010</created_at> | ||
+ | <id>4046214423</id> | ||
+ | <text>维基解密新主机被曝位于军事掩体内(图) http://sinaurl.cn/hbqEya</text> | ||
+ | <source> | ||
+ | <a href="http://tech.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/> | ||
+ | <thumbnail_pic>http://ww3.sinaimg.cn/thumbnail/63743d1cjw6dbz63h1rfrj.jpg</thumbnail_pic> | ||
+ | <bmiddle_pic>http://ww3.sinaimg.cn/bmiddle/63743d1cjw6dbz63h1rfrj.jpg</bmiddle_pic> | ||
+ | <original_pic>http://ww3.sinaimg.cn/large/63743d1cjw6dbz63h1rfrj.jpg</original_pic> | ||
+ | <user> | ||
+ | <id>1668562204</id> | ||
+ | <screen_name>赵海俊的微薄</screen_name> | ||
+ | <name>赵海俊的微薄</name> | ||
+ | <province>11</province> | ||
+ | <city>5</city> | ||
+ | <location>北京 朝阳区</location> | ||
+ | <description>运动健将</description> | ||
+ | <url>http://blog.sina.com.cn/eshesoulheart</url> | ||
+ | <profile_image_url>http://tp1.sinaimg.cn/1668562204/50/1279885528/1</profile_image_url> | ||
+ | <domain/> | ||
+ | <gender>m</gender> | ||
+ | <followers_count>315</followers_count> | ||
+ | <friends_count>611</friends_count> | ||
+ | <statuses_count>2984</statuses_count> | ||
+ | <favourites_count>53</favourites_count> | ||
+ | <created_at>Thu Dec 10 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> | ||
+ | <annotations/> | ||
+ | </status> | ||
+ | </comment> | ||
+ | </pre> | ||
+ | ===JSON示例=== | ||
+ | <pre> | ||
+ | { | ||
+ | "id" : 4976882559, | ||
+ | "text" : "wakaka", | ||
+ | "created_at" : "Fri Dec 03 10:28:55 +0800 2010", | ||
+ | "source" : "<a href=\"http://open.t.sina.com.cn\" rel=\"nofollow\">微博开放平台接口</a>", | ||
+ | "user" : | ||
+ | { | ||
+ | "name" : "zhangwei217245", | ||
+ | "domain" : "zhangwei217245", | ||
+ | "geo_enabled" : true, | ||
+ | "followers_count" : 22, | ||
+ | "statuses_count" : 115, | ||
+ | "favourites_count" : 3, | ||
+ | "city" : "5", | ||
+ | "description" : "ABCDE", | ||
+ | "verified" : false, | ||
+ | "status" : | ||
+ | { | ||
+ | "created_at" : "Thu Dec 02 17:23:52 +0800 2010", | ||
+ | "text" : "哎呀妈呀,终于找到组织了。", | ||
+ | "truncated" : false, | ||
+ | "retweeted_status" : | ||
+ | { | ||
+ | "created_at" : "Thu Dec 02 17:23:03 +0800 2010", | ||
+ | "text" : "再看看在哪AGAIN", | ||
+ | "truncated" : false, | ||
+ | "in_reply_to_status_id" : "", | ||
+ | "in_reply_to_screen_name" : "", | ||
+ | "geo" : | ||
+ | { | ||
+ | "type" : "Point", | ||
+ | "coordinates" : | ||
+ | [ | ||
+ | 39.984833, | ||
+ | 116.310005 | ||
+ | ] | ||
+ | }, | ||
+ | "user" : | ||
+ | { | ||
+ | "name" : "zhangwei217245", | ||
+ | "domain" : "zhangwei217245", | ||
+ | "geo_enabled" : true, | ||
+ | "followers_count" : 22, | ||
+ | "statuses_count" : 113, | ||
+ | "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" : "", | ||
+ | "id" : 4023402439, | ||
+ | "source" : "<a href=\"\" rel=\"nofollow\">微博开放平台接口</a>" | ||
+ | }, | ||
+ | "in_reply_to_status_id" : "", | ||
+ | "annotations" : | ||
+ | [ | ||
+ | ], | ||
+ | "in_reply_to_screen_name" : "", | ||
+ | "geo" : null, | ||
+ | "favorited" : false, | ||
+ | "in_reply_to_user_id" : "", | ||
+ | "id" : 4023418959, | ||
+ | "source" : "<a href=\"http://t.sina.com.cn\" rel=\"nofollow\">新浪微博</a>" | ||
+ | }, | ||
+ | "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" : "北京 朝阳区" | ||
+ | }, | ||
+ | "status" : | ||
+ | { | ||
+ | "created_at" : "Fri Dec 03 09:25:51 +0800 2010", | ||
+ | "text" : "维基解密新主机被曝位于军事掩体内(图) http://sinaurl.cn/hbqEya", | ||
+ | "bmiddle_pic" : "http://ww3.sinaimg.cn/bmiddle/63743d1cjw6dbz63h1rfrj.jpg", | ||
+ | "original_pic" : "http://ww3.sinaimg.cn/large/63743d1cjw6dbz63h1rfrj.jpg", | ||
+ | "truncated" : false, | ||
+ | "in_reply_to_status_id" : "", | ||
+ | "annotations" : | ||
+ | [ | ||
− | + | ], | |
− | + | "in_reply_to_screen_name" : "", | |
− | + | "geo" : null, | |
− | + | "user" : | |
− | { | + | { |
− | + | "name" : "赵海俊的微薄", | |
− | + | "domain" : "", | |
− | + | "geo_enabled" : true, | |
− | + | "followers_count" : 315, | |
− | + | "statuses_count" : 2984, | |
− | == | + | "favourites_count" : 53, |
− | * | + | "city" : "5", |
+ | "description" : "运动健将", | ||
+ | "verified" : false, | ||
+ | "id" : 1668562204, | ||
+ | "gender" : "m", | ||
+ | "friends_count" : 611, | ||
+ | "screen_name" : "赵海俊的微薄", | ||
+ | "allow_all_act_msg" : false, | ||
+ | "following" : false, | ||
+ | "url" : "http://blog.sina.com.cn/eshesoulheart", | ||
+ | "profile_image_url" : "http://tp1.sinaimg.cn/1668562204/50/1279885528/1", | ||
+ | "created_at" : "Thu Dec 10 00:00:00 +0800 2009", | ||
+ | "province" : "11", | ||
+ | "location" : "北京 朝阳区" | ||
+ | }, | ||
+ | "favorited" : false, | ||
+ | "thumbnail_pic" : "http://ww3.sinaimg.cn/thumbnail/63743d1cjw6dbz63h1rfrj.jpg", | ||
+ | "in_reply_to_user_id" : "", | ||
+ | "id" : 4046214423, | ||
+ | "source" : "<a href=\"http://tech.sina.com.cn/\" rel=\"nofollow\">新浪科技</a>" | ||
+ | } | ||
+ | } | ||
+ | </pre>| | ||
+ | useAge= | ||
+ | * 为防止重复提交,发表的评论与上次发表的评论内容相同的时候,将返回400错误。 | ||
* 如果id或cid不存在,将返回400错误 | * 如果id或cid不存在,将返回400错误 | ||
− | * | + | * 如果提供了正确的cid参数,则该接口的表现为回复指定的评论。此时id参数将被忽略。即使cid参数代表的评论不属于id参数代表的微博消息,通过该接口发表的评论信息直接回复cid代表的评论。 |
− | + | ===回复评论的返回示例:XML格式=== | |
− | === | + | <pre> |
− | + | <?xml version="1.0" encoding="UTF-8"?> | |
− | + | <comment> | |
− | + | <created_at>Fri Dec 03 10:39:36 +0800 2010</created_at> | |
− | + | <id>4977147033</id> | |
− | + | <text>回复@zhangwei217245:wakawaka</text> | |
− | + | <source> | |
− | + | <a href="http://open.t.sina.com.cn">微博开放平台接口</a> | |
− | <id> | + | </source> |
− | <text> | + | <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>115</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> | ||
+ | <status> | ||
+ | <created_at>Thu Dec 02 17:23:52 +0800 2010</created_at> | ||
+ | <id>4023418959</id> | ||
+ | <text>哎呀妈呀,终于找到组织了。</text> | ||
+ | <source> | ||
+ | <a href="http://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/> | ||
+ | <retweeted_status> | ||
+ | <created_at>Thu Dec 02 17:23:03 +0800 2010</created_at> | ||
+ | <id>4023402439</id> | ||
+ | <text>再看看在哪AGAIN</text> | ||
+ | <source> | ||
+ | <a href="">微博开放平台接口</a> | ||
+ | </source> | ||
+ | <favorited>false</favorited> | ||
+ | <truncated>false</truncated> | ||
+ | <geo xmlns:georss="http://www.georss.org/georss"> | ||
+ | <georss:point>39.984833 116.310005</georss:point> | ||
+ | </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>113</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> | ||
+ | </retweeted_status> | ||
+ | <annotations/> | ||
+ | </status> | ||
+ | </user> | ||
+ | <status> | ||
+ | <created_at>Thu Dec 02 17:14:39 +0800 2010</created_at> | ||
+ | <id>4023227965</id> | ||
+ | <text>哇哈哈。随便输了个经纬度,就跑到海里去发微博了</text> | ||
<source> | <source> | ||
− | <a | + | <a href="http://t.sina.com.cn">新浪微博</a> |
</source> | </source> | ||
+ | <favorited>false</favorited> | ||
+ | <truncated>false</truncated> | ||
+ | <geo/> | ||
+ | <in_reply_to_status_id/> | ||
+ | <in_reply_to_user_id/> | ||
+ | <in_reply_to_screen_name/> | ||
<user> | <user> | ||
− | <id> | + | <id>1658122963</id> |
− | <screen_name> | + | <screen_name>zhangwei217245</screen_name> |
− | <name> | + | <name>zhangwei217245</name> |
− | <province></province> | + | <province>11</province> |
− | <city></city> | + | <city>5</city> |
− | <location></location> | + | <location>北京 朝阳区</location> |
− | <description></description> | + | <description>ABCDE</description> |
− | <url | + | <url/> |
− | <profile_image_url>http://tp4.sinaimg.cn/ | + | <profile_image_url>http://tp4.sinaimg.cn/1658122963/50/1282754213</profile_image_url> |
− | <domain> | + | <domain>zhangwei217245</domain> |
− | <gender></gender> | + | <gender>m</gender> |
<followers_count>22</followers_count> | <followers_count>22</followers_count> | ||
− | <friends_count> | + | <friends_count>43</friends_count> |
− | <statuses_count> | + | <statuses_count>108</statuses_count> |
− | <favourites_count> | + | <favourites_count>3</favourites_count> |
− | <created_at> | + | <created_at>Tue Nov 03 00:00:00 +0800 2009</created_at> |
<following>false</following> | <following>false</following> | ||
<verified>false</verified> | <verified>false</verified> | ||
− | < | + | <allow_all_act_msg>false</allow_all_act_msg> |
+ | <geo_enabled>true</geo_enabled> | ||
</user> | </user> | ||
− | < | + | <retweeted_status> |
− | <created_at> | + | <created_at>Thu Dec 02 17:06:40 +0800 2010</created_at> |
− | <id> | + | <id>4023064087</id> |
− | <text> | + | <text>abc</text> |
<source> | <source> | ||
− | <a | + | <a href="">微博开放平台接口</a> |
</source> | </source> | ||
<favorited>false</favorited> | <favorited>false</favorited> | ||
<truncated>false</truncated> | <truncated>false</truncated> | ||
− | <geo/> | + | <geo xmlns:georss="http://www.georss.org/georss"> |
− | + | <georss:point>39.8765 119.5678</georss:point> | |
− | < | + | </geo> |
− | <in_reply_to_screen_name></ | + | <in_reply_to_status_id/> |
+ | <in_reply_to_user_id/> | ||
+ | <in_reply_to_screen_name/> | ||
+ | <thumbnail_pic>http://ww2.sinaimg.cn/thumbnail/6b85067djw6dbydsnam1xj.jpg</thumbnail_pic> | ||
+ | <bmiddle_pic>http://ww2.sinaimg.cn/bmiddle/6b85067djw6dbydsnam1xj.jpg</bmiddle_pic> | ||
+ | <original_pic>http://ww2.sinaimg.cn/large/6b85067djw6dbydsnam1xj.jpg</original_pic> | ||
<user> | <user> | ||
− | <id> | + | <id>1803880061</id> |
− | <screen_name> | + | <screen_name>LoopB</screen_name> |
− | <name> | + | <name>LoopB</name> |
− | <province></province> | + | <province>11</province> |
− | <city></city> | + | <city>8</city> |
− | <location></location> | + | <location>北京 海淀区</location> |
− | <description | + | <description/> |
− | <url | + | <url/> |
− | <profile_image_url>http:// | + | <profile_image_url>http://tp2.sinaimg.cn/1803880061/50/0/0</profile_image_url> |
− | <domain | + | <domain/> |
− | <gender></gender> | + | <gender>f</gender> |
− | <followers_count> | + | <followers_count>1</followers_count> |
− | <friends_count> | + | <friends_count>1</friends_count> |
− | <statuses_count> | + | <statuses_count>14</statuses_count> |
− | <favourites_count> | + | <favourites_count>4</favourites_count> |
− | <created_at> | + | <created_at>Fri Aug 27 00:00:00 +0800 2010</created_at> |
<following>false</following> | <following>false</following> | ||
<verified>false</verified> | <verified>false</verified> | ||
− | < | + | <allow_all_act_msg>false</allow_all_act_msg> |
+ | <geo_enabled>true</geo_enabled> | ||
</user> | </user> | ||
− | </status> | + | </retweeted_status> |
− | </comment> | + | <annotations/> |
+ | </status> | ||
+ | <reply_comment> | ||
+ | <created_at>Thu Dec 02 17:25:25 +0800 2010</created_at> | ||
+ | <id>4949855625</id> | ||
+ | <text>小新小新。。。我是小浪~~~</text> | ||
+ | <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>115</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> | ||
+ | </reply_comment> | ||
+ | </comment> | ||
+ | </pre> | ||
+ | ===回复评论的返回示例:JSON格式=== | ||
+ | <pre> | ||
+ | { | ||
+ | "id" : 4977097789, | ||
+ | "text" : "回复@zhangwei217245:walala", | ||
+ | "created_at" : "Fri Dec 03 10:37:39 +0800 2010", | ||
+ | "source" : "<a href=\"http://open.t.sina.com.cn\" rel=\"nofollow\">微博开放平台接口</a>", | ||
+ | "reply_comment" : | ||
+ | { | ||
+ | "id" : 4949855625, | ||
+ | "text" : "小新小新。。。我是小浪~~~", | ||
+ | "created_at" : "Thu Dec 02 17:25:25 +0800 2010", | ||
+ | "user" : | ||
+ | { | ||
+ | "name" : "zhangwei217245", | ||
+ | "domain" : "zhangwei217245", | ||
+ | "geo_enabled" : true, | ||
+ | "followers_count" : 22, | ||
+ | "statuses_count" : 115, | ||
+ | "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" : "北京 朝阳区" | ||
+ | } | ||
+ | }, | ||
+ | "user" : | ||
+ | { | ||
+ | "name" : "zhangwei217245", | ||
+ | "domain" : "zhangwei217245", | ||
+ | "geo_enabled" : true, | ||
+ | "followers_count" : 22, | ||
+ | "statuses_count" : 115, | ||
+ | "favourites_count" : 3, | ||
+ | "city" : "5", | ||
+ | "description" : "ABCDE", | ||
+ | "verified" : false, | ||
+ | "status" : | ||
+ | { | ||
+ | "created_at" : "Thu Dec 02 17:23:52 +0800 2010", | ||
+ | "text" : "哎呀妈呀,终于找到组织了。", | ||
+ | "truncated" : false, | ||
+ | "retweeted_status" : | ||
+ | { | ||
+ | "created_at" : "Thu Dec 02 17:23:03 +0800 2010", | ||
+ | "text" : "再看看在哪AGAIN", | ||
+ | "truncated" : false, | ||
+ | "in_reply_to_status_id" : "", | ||
+ | "in_reply_to_screen_name" : "", | ||
+ | "geo" : | ||
+ | { | ||
+ | "type" : "Point", | ||
+ | "coordinates" : | ||
+ | [ | ||
+ | 39.984833, | ||
+ | 116.310005 | ||
+ | ] | ||
+ | }, | ||
+ | "user" : | ||
+ | { | ||
+ | "name" : "zhangwei217245", | ||
+ | "domain" : "zhangwei217245", | ||
+ | "geo_enabled" : true, | ||
+ | "followers_count" : 22, | ||
+ | "statuses_count" : 113, | ||
+ | "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" : "", | ||
+ | "id" : 4023402439, | ||
+ | "source" : "<a href=\"\" rel=\"nofollow\">微博开放平台接口</a>" | ||
+ | }, | ||
+ | "in_reply_to_status_id" : "", | ||
+ | "annotations" : | ||
+ | [ | ||
− | + | ], | |
+ | "in_reply_to_screen_name" : "", | ||
+ | "geo" : null, | ||
+ | "favorited" : false, | ||
+ | "in_reply_to_user_id" : "", | ||
+ | "id" : 4023418959, | ||
+ | "source" : "<a href=\"http://t.sina.com.cn\" rel=\"nofollow\">新浪微博</a>" | ||
+ | }, | ||
+ | "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" : "北京 朝阳区" | ||
+ | }, | ||
+ | "status" : | ||
+ | { | ||
+ | "created_at" : "Thu Dec 02 17:14:39 +0800 2010", | ||
+ | "text" : "哇哈哈。随便输了个经纬度,就跑到海里去发微博了", | ||
+ | "truncated" : false, | ||
+ | "retweeted_status" : | ||
+ | { | ||
+ | "created_at" : "Thu Dec 02 17:06:40 +0800 2010", | ||
+ | "text" : "abc", | ||
+ | "bmiddle_pic" : "http://ww2.sinaimg.cn/bmiddle/6b85067djw6dbydsnam1xj.jpg", | ||
+ | "original_pic" : "http://ww2.sinaimg.cn/large/6b85067djw6dbydsnam1xj.jpg", | ||
+ | "truncated" : false, | ||
+ | "in_reply_to_status_id" : "", | ||
+ | "in_reply_to_screen_name" : "", | ||
+ | "geo" : | ||
+ | { | ||
+ | "type" : "Point", | ||
+ | "coordinates" : | ||
+ | [ | ||
+ | 39.8765, | ||
+ | 119.5678 | ||
+ | ] | ||
+ | }, | ||
+ | "user" : | ||
+ | { | ||
+ | "name" : "LoopB", | ||
+ | "domain" : "", | ||
+ | "geo_enabled" : true, | ||
+ | "followers_count" : 1, | ||
+ | "statuses_count" : 14, | ||
+ | "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, | ||
+ | "thumbnail_pic" : "http://ww2.sinaimg.cn/thumbnail/6b85067djw6dbydsnam1xj.jpg", | ||
+ | "in_reply_to_user_id" : "", | ||
+ | "id" : 4023064087, | ||
+ | "source" : "<a href=\"\" rel=\"nofollow\">微博开放平台接口</a>" | ||
+ | }, | ||
+ | "in_reply_to_status_id" : "", | ||
+ | "annotations" : | ||
+ | [ | ||
− | + | ], | |
− | + | "in_reply_to_screen_name" : "", | |
− | + | "geo" : null, | |
− | + | "user" : | |
− | + | { | |
− | + | "name" : "zhangwei217245", | |
− | + | "domain" : "zhangwei217245", | |
− | + | "geo_enabled" : true, | |
− | + | "followers_count" : 22, | |
− | + | "statuses_count" : 108, | |
− | + | "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" : "", | |
− | + | "id" : 4023227965, | |
− | + | "source" : "<a href=\"http://t.sina.com.cn\" rel=\"nofollow\">新浪微博</a>" | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
} | } | ||
− | + | } | |
− | + | </pre>| | |
− | + | otherInfo= | |
− | + | ===Java示例=== | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
请从 [[SDK | 微博SDK开发包下载]] 下载Java SDK<br> | 请从 [[SDK | 微博SDK开发包下载]] 下载Java SDK<br> | ||
代码示例如下: | 代码示例如下: | ||
第207行: | 第723行: | ||
} | } | ||
} | } | ||
− | + | ===PHP示例=== | |
请从 [[SDK | 微博SDK开发包下载]] 处下载PHP SDK(支持OAuth验证之版本)<br> | 请从 [[SDK | 微博SDK开发包下载]] 处下载PHP SDK(支持OAuth验证之版本)<br> | ||
代码示例如下: | 代码示例如下: | ||
第243行: | 第759行: | ||
echo($msg['id'].' : '.$msg['text'].' '.$msg['created_at']); | echo($msg['id'].' : '.$msg['text'].' '.$msg['created_at']); | ||
</pre> | </pre> | ||
+ | }} |
2010年12月3日 (五) 10:40的版本
目录 |
statuses/comment
对一条微博信息进行评论。请求必须用POST方式提交。
URL
http://api.t.sina.com.cn/statuses/comment.(json%7Cxml)
支持格式
XML/JSON
HTTP请求方式
POST
是否需要登录
true
关于授权机制,参见授权机制声明
请求数限制
true
关于请求数限制,参见接口访问权限说明
请求参数
必选 | 类型及范围 | 说明 | |
---|---|---|---|
source | true | string | 申请应用时分配的AppKey,调用接口时候代表应用的唯一身份。(采用OAuth授权方式不需要此参数) |
id | true | int64 | 要评论的微博消息ID |
comment | true | string | 评论内容。必须做URLEncode,信息内容不超过140个汉字。 |
cid | false | int64 | 要回复的评论ID。 |
注意事项
- 为防止重复提交,发表的评论与上次发表的评论内容相同的时候,将返回400错误。
- 如果id或cid不存在,将返回400错误
- 如果提供了正确的cid参数,则该接口的表现为回复指定的评论。此时id参数将被忽略。即使cid参数代表的评论不属于id参数代表的微博消息,通过该接口发表的评论信息直接回复cid代表的评论。
回复评论的返回示例:XML格式
<?xml version="1.0" encoding="UTF-8"?> <comment> <created_at>Fri Dec 03 10:39:36 +0800 2010</created_at> <id>4977147033</id> <text>回复@zhangwei217245:wakawaka</text> <source> <a href="http://open.t.sina.com.cn">微博开放平台接口</a> </source> <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>115</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> <status> <created_at>Thu Dec 02 17:23:52 +0800 2010</created_at> <id>4023418959</id> <text>哎呀妈呀,终于找到组织了。</text> <source> <a href="http://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/> <retweeted_status> <created_at>Thu Dec 02 17:23:03 +0800 2010</created_at> <id>4023402439</id> <text>再看看在哪AGAIN</text> <source> <a href="">微博开放平台接口</a> </source> <favorited>false</favorited> <truncated>false</truncated> <geo xmlns:georss="http://www.georss.org/georss"> <georss:point>39.984833 116.310005</georss:point> </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>113</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> </retweeted_status> <annotations/> </status> </user> <status> <created_at>Thu Dec 02 17:14:39 +0800 2010</created_at> <id>4023227965</id> <text>哇哈哈。随便输了个经纬度,就跑到海里去发微博了</text> <source> <a href="http://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>108</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> <retweeted_status> <created_at>Thu Dec 02 17:06:40 +0800 2010</created_at> <id>4023064087</id> <text>abc</text> <source> <a href="">微博开放平台接口</a> </source> <favorited>false</favorited> <truncated>false</truncated> <geo xmlns:georss="http://www.georss.org/georss"> <georss:point>39.8765 119.5678</georss:point> </geo> <in_reply_to_status_id/> <in_reply_to_user_id/> <in_reply_to_screen_name/> <thumbnail_pic>http://ww2.sinaimg.cn/thumbnail/6b85067djw6dbydsnam1xj.jpg</thumbnail_pic> <bmiddle_pic>http://ww2.sinaimg.cn/bmiddle/6b85067djw6dbydsnam1xj.jpg</bmiddle_pic> <original_pic>http://ww2.sinaimg.cn/large/6b85067djw6dbydsnam1xj.jpg</original_pic> <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>1</followers_count> <friends_count>1</friends_count> <statuses_count>14</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> <annotations/> </status> <reply_comment> <created_at>Thu Dec 02 17:25:25 +0800 2010</created_at> <id>4949855625</id> <text>小新小新。。。我是小浪~~~</text> <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>115</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> </reply_comment> </comment>
回复评论的返回示例:JSON格式
{ "id" : 4977097789, "text" : "回复@zhangwei217245:walala", "created_at" : "Fri Dec 03 10:37:39 +0800 2010", "source" : "<a href=\"http://open.t.sina.com.cn\" rel=\"nofollow\">微博开放平台接口</a>", "reply_comment" : { "id" : 4949855625, "text" : "小新小新。。。我是小浪~~~", "created_at" : "Thu Dec 02 17:25:25 +0800 2010", "user" : { "name" : "zhangwei217245", "domain" : "zhangwei217245", "geo_enabled" : true, "followers_count" : 22, "statuses_count" : 115, "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" : "北京 朝阳区" } }, "user" : { "name" : "zhangwei217245", "domain" : "zhangwei217245", "geo_enabled" : true, "followers_count" : 22, "statuses_count" : 115, "favourites_count" : 3, "city" : "5", "description" : "ABCDE", "verified" : false, "status" : { "created_at" : "Thu Dec 02 17:23:52 +0800 2010", "text" : "哎呀妈呀,终于找到组织了。", "truncated" : false, "retweeted_status" : { "created_at" : "Thu Dec 02 17:23:03 +0800 2010", "text" : "再看看在哪AGAIN", "truncated" : false, "in_reply_to_status_id" : "", "in_reply_to_screen_name" : "", "geo" : { "type" : "Point", "coordinates" : [ 39.984833, 116.310005 ] }, "user" : { "name" : "zhangwei217245", "domain" : "zhangwei217245", "geo_enabled" : true, "followers_count" : 22, "statuses_count" : 113, "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" : "", "id" : 4023402439, "source" : "<a href=\"\" rel=\"nofollow\">微博开放平台接口</a>" }, "in_reply_to_status_id" : "", "annotations" : [ ], "in_reply_to_screen_name" : "", "geo" : null, "favorited" : false, "in_reply_to_user_id" : "", "id" : 4023418959, "source" : "<a href=\"http://t.sina.com.cn\" rel=\"nofollow\">新浪微博</a>" }, "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" : "北京 朝阳区" }, "status" : { "created_at" : "Thu Dec 02 17:14:39 +0800 2010", "text" : "哇哈哈。随便输了个经纬度,就跑到海里去发微博了", "truncated" : false, "retweeted_status" : { "created_at" : "Thu Dec 02 17:06:40 +0800 2010", "text" : "abc", "bmiddle_pic" : "http://ww2.sinaimg.cn/bmiddle/6b85067djw6dbydsnam1xj.jpg", "original_pic" : "http://ww2.sinaimg.cn/large/6b85067djw6dbydsnam1xj.jpg", "truncated" : false, "in_reply_to_status_id" : "", "in_reply_to_screen_name" : "", "geo" : { "type" : "Point", "coordinates" : [ 39.8765, 119.5678 ] }, "user" : { "name" : "LoopB", "domain" : "", "geo_enabled" : true, "followers_count" : 1, "statuses_count" : 14, "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, "thumbnail_pic" : "http://ww2.sinaimg.cn/thumbnail/6b85067djw6dbydsnam1xj.jpg", "in_reply_to_user_id" : "", "id" : 4023064087, "source" : "<a href=\"\" rel=\"nofollow\">微博开放平台接口</a>" }, "in_reply_to_status_id" : "", "annotations" : [ ], "in_reply_to_screen_name" : "", "geo" : null, "user" : { "name" : "zhangwei217245", "domain" : "zhangwei217245", "geo_enabled" : true, "followers_count" : 22, "statuses_count" : 108, "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" : "", "id" : 4023227965, "source" : "<a href=\"http://t.sina.com.cn\" rel=\"nofollow\">新浪微博</a>" } }
返回结果
XML示例
<?xml version="1.0" encoding="UTF-8"?> <comment> <created_at>Fri Dec 03 10:22:44 +0800 2010</created_at> <id>4976730453</id> <text>wahaha</text> <source> <a href="http://open.t.sina.com.cn">微博开放平台接口</a> </source> <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>115</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> <status> <created_at>Thu Dec 02 17:23:52 +0800 2010</created_at> <id>4023418959</id> <text>哎呀妈呀,终于找到组织了。</text> <source> <a href="http://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/> <retweeted_status> <created_at>Thu Dec 02 17:23:03 +0800 2010</created_at> <id>4023402439</id> <text>再看看在哪AGAIN</text> <source> <a href="">微博开放平台接口</a> </source> <favorited>false</favorited> <truncated>false</truncated> <geo xmlns:georss="http://www.georss.org/georss"> <georss:point>39.984833 116.310005</georss:point> </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>113</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> </retweeted_status> <annotations/> </status> </user> <status> <created_at>Fri Dec 03 09:25:51 +0800 2010</created_at> <id>4046214423</id> <text>维基解密新主机被曝位于军事掩体内(图) http://sinaurl.cn/hbqEya</text> <source> <a href="http://tech.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/> <thumbnail_pic>http://ww3.sinaimg.cn/thumbnail/63743d1cjw6dbz63h1rfrj.jpg</thumbnail_pic> <bmiddle_pic>http://ww3.sinaimg.cn/bmiddle/63743d1cjw6dbz63h1rfrj.jpg</bmiddle_pic> <original_pic>http://ww3.sinaimg.cn/large/63743d1cjw6dbz63h1rfrj.jpg</original_pic> <user> <id>1668562204</id> <screen_name>赵海俊的微薄</screen_name> <name>赵海俊的微薄</name> <province>11</province> <city>5</city> <location>北京 朝阳区</location> <description>运动健将</description> <url>http://blog.sina.com.cn/eshesoulheart</url> <profile_image_url>http://tp1.sinaimg.cn/1668562204/50/1279885528/1</profile_image_url> <domain/> <gender>m</gender> <followers_count>315</followers_count> <friends_count>611</friends_count> <statuses_count>2984</statuses_count> <favourites_count>53</favourites_count> <created_at>Thu Dec 10 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> <annotations/> </status> </comment>
JSON示例
{ "id" : 4976882559, "text" : "wakaka", "created_at" : "Fri Dec 03 10:28:55 +0800 2010", "source" : "<a href=\"http://open.t.sina.com.cn\" rel=\"nofollow\">微博开放平台接口</a>", "user" : { "name" : "zhangwei217245", "domain" : "zhangwei217245", "geo_enabled" : true, "followers_count" : 22, "statuses_count" : 115, "favourites_count" : 3, "city" : "5", "description" : "ABCDE", "verified" : false, "status" : { "created_at" : "Thu Dec 02 17:23:52 +0800 2010", "text" : "哎呀妈呀,终于找到组织了。", "truncated" : false, "retweeted_status" : { "created_at" : "Thu Dec 02 17:23:03 +0800 2010", "text" : "再看看在哪AGAIN", "truncated" : false, "in_reply_to_status_id" : "", "in_reply_to_screen_name" : "", "geo" : { "type" : "Point", "coordinates" : [ 39.984833, 116.310005 ] }, "user" : { "name" : "zhangwei217245", "domain" : "zhangwei217245", "geo_enabled" : true, "followers_count" : 22, "statuses_count" : 113, "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" : "", "id" : 4023402439, "source" : "<a href=\"\" rel=\"nofollow\">微博开放平台接口</a>" }, "in_reply_to_status_id" : "", "annotations" : [ ], "in_reply_to_screen_name" : "", "geo" : null, "favorited" : false, "in_reply_to_user_id" : "", "id" : 4023418959, "source" : "<a href=\"http://t.sina.com.cn\" rel=\"nofollow\">新浪微博</a>" }, "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" : "北京 朝阳区" }, "status" : { "created_at" : "Fri Dec 03 09:25:51 +0800 2010", "text" : "维基解密新主机被曝位于军事掩体内(图) http://sinaurl.cn/hbqEya", "bmiddle_pic" : "http://ww3.sinaimg.cn/bmiddle/63743d1cjw6dbz63h1rfrj.jpg", "original_pic" : "http://ww3.sinaimg.cn/large/63743d1cjw6dbz63h1rfrj.jpg", "truncated" : false, "in_reply_to_status_id" : "", "annotations" : [ ], "in_reply_to_screen_name" : "", "geo" : null, "user" : { "name" : "赵海俊的微薄", "domain" : "", "geo_enabled" : true, "followers_count" : 315, "statuses_count" : 2984, "favourites_count" : 53, "city" : "5", "description" : "运动健将", "verified" : false, "id" : 1668562204, "gender" : "m", "friends_count" : 611, "screen_name" : "赵海俊的微薄", "allow_all_act_msg" : false, "following" : false, "url" : "http://blog.sina.com.cn/eshesoulheart", "profile_image_url" : "http://tp1.sinaimg.cn/1668562204/50/1279885528/1", "created_at" : "Thu Dec 10 00:00:00 +0800 2009", "province" : "11", "location" : "北京 朝阳区" }, "favorited" : false, "thumbnail_pic" : "http://ww3.sinaimg.cn/thumbnail/63743d1cjw6dbz63h1rfrj.jpg", "in_reply_to_user_id" : "", "id" : 4046214423, "source" : "<a href=\"http://tech.sina.com.cn/\" rel=\"nofollow\">新浪科技</a>" } }
其他
Java示例
请从 微博SDK开发包下载 下载Java SDK
代码示例如下:
package weibo4j.examples; import weibo4j.Status; import weibo4j.Weibo; public class UpdateComment { /** * 对一条微博信息进行评论 * @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("测试12345");//发表新微博信息 Thread.sleep(1000); String sid = status.getId()+"";//微博id System.out.println(sid + " : "+ status.getText()+" "+status.getCreatedAt()); weibo.updateComment("测试评论", sid, null);//对刚发表的微博进行评论 Comment comment = weibo.updateComment("测试评论", sid, null); System.out.println(comment.getId() + " : " + comment.getText() + " " + comment.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开发包下载 处下载PHP SDK(支持OAuth验证之版本)
代码示例如下:
//Statuses/comment // 对一条微博信息进行评论 $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; } //微博id $sid = $msg['id']; echo($sid." : ".$msg['text']." ".$msg["created_at"]); sleep(5); //对刚发表的微博进行评论 $msg = $c->send_comment($sid,"测试评论",null); 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']);