Statuses/mentions/en

Jump to: navigation, search

Contents

statuses/mentions

Return the latest N weibos metioned the authenticating user. (That is the weibo contained @username)

URL

http://api.t.sina.com.cn/statuses/mentions.(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)
since_id false int64 Returns then weibos with an ID greater than (that is, more recent than) the specified ID
max_id false int64 Return the weibos with an ID smaller than the specified ID.
count false int, default is 20, max is 200. Specify the number of weibos return.
page false int, default is 1. Specify results page. Based on the number of the authenticating user’s followings and the number of the followings’s weibos, the max number of weibos that page feature can access is different, usually up to about 1000 weibos.

Notes

None

Example Request

XML
curl -u "username:password" "http://api.t.sina.com.cn/statuses/mentions.xml?source=appkey&count=5&page=2"
JSON
curl -u "username:password" "http://api.t.sina.com.cn/statuses/mentions.json?source=appkey&count=5&page=2"

Response

XML Example

 <?xml version="1.0" encoding="UTF-8"?>
<statuses>
  <status>
    <created_at>Tue Sep 07 12:50:46 +0800 2010</created_at>
    <id>2381621377</id>
    <text>实诚人。 //@loo00://@huchao:这个太亮了...</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>1403132707</id>
      <screen_name>madmole</screen_name>
      <name>madmole</name>
      <province>11</province>
      <city>8</city>
      <location>北京 海淀区</location>
      <description/>
      <url>http://blog.sina.com.cn/madmole</url>
      <profile_image_url>http://tp4.sinaimg.cn/1403132707/50/1279878220</profile_image_url>
      <domain>madmole</domain>
      <gender>m</gender>
      <followers_count>74</followers_count>
      <friends_count>103</friends_count>
      <statuses_count>547</statuses_count>
      <favourites_count>4</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>Tue Sep 07 09:55:42 +0800 2010</created_at>
      <id>2377078389</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/>
      <thumbnail_pic>http://ss6.sinaimg.cn/thumbnail/61e8a1fdg8fa1b0a50c95&690</thumbnail_pic>
      <bmiddle_pic>http://ss6.sinaimg.cn/bmiddle/61e8a1fdg8fa1b0a50c95&690</bmiddle_pic>
      <original_pic>http://ss6.sinaimg.cn/orignal/61e8a1fdg8fa1b0a50c95&690</original_pic>
      <user>
        <id>1642635773</id>
        <screen_name>我们爱讲冷笑话</screen_name>
        <name>我们爱讲冷笑话</name>
        <province>11</province>
        <city>1</city>
        <location>北京 东城区</location>
        <description>我们爱讲冷笑话lengxiaohua.net官方微博</description>
        <url>http://lengxiaohua.net</url>
        <profile_image_url>http://tp2.sinaimg.cn/1642635773/50/1283204219</profile_image_url>
        <domain>lengxiaohua</domain>
        <gender>f</gender>
        <followers_count>250573</followers_count>
        <friends_count>6</friends_count>
        <statuses_count>3215</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>
  </status>
  <status>
    <created_at>Tue Sep 07 10:27:45 +0800 2010</created_at>
    <id>2377870842</id>
    <text>//@huchao:这个太亮了...</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>1642473375</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/1642473375/50/1279882929</profile_image_url>
      <domain>adayaxx</domain>
      <gender>f</gender>
      <followers_count>86</followers_count>
      <friends_count>71</friends_count>
      <statuses_count>615</statuses_count>
      <favourites_count>1</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>Tue Sep 07 09:55:42 +0800 2010</created_at>
      <id>2377078389</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/>
      <thumbnail_pic>http://ss6.sinaimg.cn/thumbnail/61e8a1fdg8fa1b0a50c95&690</thumbnail_pic>
      <bmiddle_pic>http://ss6.sinaimg.cn/bmiddle/61e8a1fdg8fa1b0a50c95&690</bmiddle_pic>
      <original_pic>http://ss6.sinaimg.cn/orignal/61e8a1fdg8fa1b0a50c95&690</original_pic>
      <user>
        <id>1642635773</id>
        <screen_name>我们爱讲冷笑话</screen_name>
        <name>我们爱讲冷笑话</name>
        <province>11</province>
        <city>1</city>
        <location>北京 东城区</location>
        <description>我们爱讲冷笑话lengxiaohua.net官方微博</description>
        <url>http://lengxiaohua.net</url>
        <profile_image_url>http://tp2.sinaimg.cn/1642635773/50/1283204219</profile_image_url>
        <domain>lengxiaohua</domain>
        <gender>f</gender>
        <followers_count>250573</followers_count>
        <friends_count>6</friends_count>
        <statuses_count>3215</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>
  </status>
</statuses>

JSON Example

  [
   {
      "created_at":"Tue Sep 07 12:50:46 +0800 2010",
      "id":2381621377,
      "text":"实诚人。 //@loo00://@huchao:这个太亮了...",
      "source":"<a href=\"http://t.sina.com.cn\" rel=\"nofollow\">新浪微博</a>",
      "favorited":false,
      "truncated":false,
      "in_reply_to_status_id":"",
      "in_reply_to_user_id":"",
      "in_reply_to_screen_name":"",
      "geo":null,
      "user":{
         "id":1403132707,
         "screen_name":"madmole",
         "name":"madmole",
         "province":"11",
         "city":"8",
         "location":"北京 海淀区",
         "description":"",
         "url":"http://blog.sina.com.cn/madmole",
         "profile_image_url":"http://tp4.sinaimg.cn/1403132707/50/1279878220",
         "domain":"madmole",
         "gender":"m",
         "followers_count":74,
         "friends_count":103,
         "statuses_count":547,
         "favourites_count":4,
         "created_at":"Fri Aug 28 00:00:00 +0800 2009",
         "following":false,
         "allow_all_act_msg":false,
         "geo_enabled":false,
         "verified":false
      },
      "retweeted_status":{
         "created_at":"Tue Sep 07 09:55:42 +0800 2010",
         "id":2377078389,
         "text":"发布招聘启事的家伙肯定收了经理啥好处了~~",
         "source":"<a href=\"http://t.sina.com.cn\" rel=\"nofollow\">新浪微博</a>",
         "favorited":false,
         "truncated":false,
         "in_reply_to_status_id":"",
         "in_reply_to_user_id":"",
         "in_reply_to_screen_name":"",
         "thumbnail_pic":"http://ss6.sinaimg.cn/thumbnail/61e8a1fdg8fa1b0a50c95&690",
         "bmiddle_pic":"http://ss6.sinaimg.cn/bmiddle/61e8a1fdg8fa1b0a50c95&690",
         "original_pic":"http://ss6.sinaimg.cn/orignal/61e8a1fdg8fa1b0a50c95&690",
         "geo":null,
         "user":{
            "id":1642635773,
            "screen_name":"我们爱讲冷笑话",
            "name":"我们爱讲冷笑话",
            "province":"11",
            "city":"1",
            "location":"北京 东城区",
            "description":"我们爱讲冷笑话lengxiaohua.net官方微博",
            "url":"http://lengxiaohua.net",
            "profile_image_url":"http://tp2.sinaimg.cn/1642635773/50/1283204219",
            "domain":"lengxiaohua",
            "gender":"f",
            "followers_count":250573,
            "friends_count":6,
            "statuses_count":3215,
            "favourites_count":0,
            "created_at":"Fri Aug 28 00:00:00 +0800 2009",
            "following":false,
            "allow_all_act_msg":false,
            "geo_enabled":false,
            "verified":false
         }
      }
   },
   {
      "created_at":"Tue Sep 07 10:27:45 +0800 2010",
      "id":2377870842,
      "text":"//@huchao:这个太亮了...",
      "source":"<a href=\"http://t.sina.com.cn\" rel=\"nofollow\">新浪微博</a>",
      "favorited":false,
      "truncated":false,
      "in_reply_to_status_id":"",
      "in_reply_to_user_id":"",
      "in_reply_to_screen_name":"",
      "geo":null,
      "user":{
         "id":1642473375,
         "screen_name":"娄阿姨叫小白兔",
         "name":"娄阿姨叫小白兔",
         "province":"11",
         "city":"8",
         "location":"北京 海淀区",
         "description":"老不正经",
         "url":"http://1",
         "profile_image_url":"http://tp4.sinaimg.cn/1642473375/50/1279882929",
         "domain":"adayaxx",
         "gender":"f",
         "followers_count":86,
         "friends_count":71,
         "statuses_count":615,
         "favourites_count":1,
         "created_at":"Fri Aug 28 00:00:00 +0800 2009",
         "following":false,
         "allow_all_act_msg":false,
         "geo_enabled":false,
         "verified":false
      },
      "retweeted_status":{
         "created_at":"Tue Sep 07 09:55:42 +0800 2010",
         "id":2377078389,
         "text":"发布招聘启事的家伙肯定收了经理啥好处了~~",
         "source":"<a href=\"http://t.sina.com.cn\" rel=\"nofollow\">新浪微博</a>",
         "favorited":false,
         "truncated":false,
         "in_reply_to_status_id":"",
         "in_reply_to_user_id":"",
         "in_reply_to_screen_name":"",
         "thumbnail_pic":"http://ss6.sinaimg.cn/thumbnail/61e8a1fdg8fa1b0a50c95&690",
         "bmiddle_pic":"http://ss6.sinaimg.cn/bmiddle/61e8a1fdg8fa1b0a50c95&690",
         "original_pic":"http://ss6.sinaimg.cn/orignal/61e8a1fdg8fa1b0a50c95&690",
         "geo":null,
         "user":{
            "id":1642635773,
            "screen_name":"我们爱讲冷笑话",
            "name":"我们爱讲冷笑话",
            "province":"11",
            "city":"1",
            "location":"北京 东城区",
            "description":"我们爱讲冷笑话lengxiaohua.net官方微博",
            "url":"http://lengxiaohua.net",
            "profile_image_url":"http://tp2.sinaimg.cn/1642635773/50/1283204219",
            "domain":"lengxiaohua",
            "gender":"f",
            "followers_count":250573,
            "friends_count":6,
            "statuses_count":3215,
            "favourites_count":0,
            "created_at":"Fri Aug 28 00:00:00 +0800 2009",
            "following":false,
            "allow_all_act_msg":false,
            "geo_enabled":false,
            "verified":false
         }
      }
   }
]

Field Description - weibo

  • created_at: Create time
  • id: Weibo ID
  • text: Weibo content
  • source: Weibo source
  • favorited: Whether it is favroited
  • truncated: Whether it is truncated
  • in_reply_to_status_id: The reply’s ID
  • in_reply_to_user_id: UID of the replyer
  • in_reply_to_screen_name: Nickname of replyer
  • thumbnail_pic: Thumbnail picture
  • bmiddle_pic: Medium picture
  • original_pic:Original picture
  • user: User profile
  • retweeted_status: eposted weibo content, the content is the status, This filed is only available for a reposted weibo.

Field Description - user

  • id: User ID
  • screen_name: User’s nickname displayed on the home page
  • name: Friendly displayed name, the same as screen_name
  • province: Province code ( see Province and city code table)
  • city: City code ( see Province and city code table)
  • location:Address
  • description: Personal description
  • url: Url of the user’s blog
  • profile_image_url: Profile image
  • domain: The user’s personalized weibo url
  • gender: Gender, m—male, f- - female, n-- unknown
  • followers_count: Followers count
  • friends_count: Following count
  • statuses_count: Weibo count
  • favourites_count: Favorites count
  • created_at: Created time
  • following: Whether the current user is following the user that posts the weibo (Not supported yet)
  • verified: Whether the user is verified by his real identity, marked with “V”

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 GetMentions {

	/**
	 * 获取@当前用户的微博列表 
	 * @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.getMentions();
        	for(Status status : list) {
        		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/mentions
//获取@当前用户的微博列表
$c = new WeiboClient( WB_AKEY , 
                      WB_SKEY , 
                      $_SESSION['last_key']['oauth_token'] , 
                      $_SESSION['last_key']['oauth_token_secret']  );
$msg  = $c->mentions();
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){
	$id = $data['id'];
	$text = $data['text'];
	echo $id."=".$text.";";
}



文档更新时间: 19 January 2011