Users/search/en

跳转到: 导航, 搜索
(Created page with '{{api_desc_en| uri=search| desc=Search for weibos with the keyword| format=json| httpMethod=GET| needAuth=false| rateLimit=true| params={{api_args|q|true|string|keyword, encoded …')
 
第1行: 第1行:
{{api_desc_en|
+
{{api_desc2_en|
uri=search|
+
uri=users/search|
desc=Search for weibos with the keyword|
+
desc=Search for users with the keyword|
format=json|
+
format=XML/JSON|
 
httpMethod=GET|
 
httpMethod=GET|
 
needAuth=false|
 
needAuth=false|
 
rateLimit=true|
 
rateLimit=true|
params={{api_args|q|true|string|keyword, encoded by URL Encode.}}
+
params={{api_args|q|true|string|Keyword. Encoded by URL Encode.}}
{{api_args|page|false|int|Page.default is 1}}
+
{{api_args|snick|false|int|Whether search for nickname. 0 is no, 1 is yes.}}
{{api_args|rpp|false|int, default is 20, max is 200|Weibos count per page}}
+
{{api_args|sdomain|false|int|Whether search for domain name. 0 is no, 1 is yes}}
{{api_args|callback|false|string|Only support JSON. For JSONP cross site data access.}}
+
{{api_args|sintro|false|int|Whether search for user description. 0 is no, 1 is yes.}}
{{api_args|geocode|false|string|Returns weibos around the place with the geo data。Geo data format is "longitude, latitude, radius". Radius supports km (kilometer), m (meter), mi (mile) unit. Data should be encoded by URL encode}}|
+
{{api_args|province|false|int|Provice ID ,see [[省份城市编码表/en|Province and city code table]]}}
 +
{{api_args|city|false|int|City ID,see [[省份城市编码表/en|Province and city code table]]]]}}
 +
{{api_args|gender|false|string|Gender. m is male, f is female.}}
 +
{{api_args|comorsch|false|string|Company or school name}}
 +
{{api_args|sort|false|int|Sort type,1 is by time, 2 is by follower count}}
 +
{{api_args|page|false|int|page}}
 +
{{api_args|count|false|int|weibo count per page (default is 10). }}
 +
{{api_args|callback|false|string|Only supports JSON. For JSONP cross site data access.}}
 +
{{api_args|base_app|false|int|Whether based on the current application. 1 is yes}}|
 
getParam=&q=王若琳&callback=foo|
 
getParam=&q=王若琳&callback=foo|
 
postParam=|
 
postParam=|
 
result=
 
result=
===JSON Example without callback parameter ===
+
===XML Example===
 
<pre>
 
<pre>
{
+
<?xml version="1.0" encoding="UTF-8"?>
"results":[
+
<searchResult>
{
+
  <users>
"to_user_id":1728647563,
+
    <user>
"to_user":"kiroro恋",
+
      <id>1795666007</id>
"text":"喜欢坐在你的车里听王若琳的歌",
+
      <screen_name>王若琳星闻</screen_name>
"id":4192745203,
+
      <name>王若琳星闻</name>
"from_user_id":1728647563,
+
      <province>11</province>
"from_user":"kiroro恋",
+
      <city>1000</city>
"iso_language_code":"nl",
+
      <location>北京</location>
"source":"<a href=\"http://t.sina.com.cn\" rel=\"nofollow\">新浪微博</a>",
+
      <description/>
"profile_image_url":"http://tp4.sinaimg.cn/1728647563/50/1289280876/0",
+
      <url/>
"created_at":"Thu Dec 09 13:57:20 +0800 2010"
+
      <profile_image_url>http://tp4.sinaimg.cn/1795666007/50/1282886247/0</profile_image_url>
},
+
      <domain/>
...
+
      <gender>f</gender>
],
+
      <followers_count>286</followers_count>
"since_id":0,
+
      <friends_count>213</friends_count>
"max_id":4192745203,
+
      <statuses_count>9</statuses_count>
"results_per_page":0,
+
      <favourites_count>0</favourites_count>
"next_page":"?page=2&max_id=1291869235&q=王若琳",
+
      <created_at>Sun Aug 15 00:00:00 +0800 2010</created_at>
"refresh_url":"?since_id=1291874240&q=王若琳",
+
      <following>false</following>
"completed_in":0.24699999392032623,
+
      <verified>false</verified>
"page":1,"query":"王若琳"
+
      <allow_all_act_msg>true</allow_all_act_msg>
}
+
      <geo_enabled>true</geo_enabled>
 +
      <status>
 +
        <created_at>Tue Oct 26 13:24:19 +0800 2010</created_at>
 +
        <id>3277931869</id>
 +
        <text>【环保音乐会世博奏响 王若琳自曝宅女环保生活】 当晚,整个舞台群星璀璨,王若琳倾情演绎《Adult crap》《玫瑰玫瑰我爱你》一举征服了观众的心,著名环保歌手朱哲琴则用她空灵的歌声一曲《阿姐鼓》震撼全场,仿佛将观众...http://sinaurl.cn/h4WVid</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/>
 +
        <thumbnail_pic>http://ss7.sinaimg.cn/thumbnail/6b07b0574937e5218ba66&amp;690</thumbnail_pic>
 +
        <bmiddle_pic>http://ss7.sinaimg.cn/bmiddle/6b07b0574937e5218ba66&amp;690</bmiddle_pic>
 +
        <original_pic>http://ss7.sinaimg.cn/orignal/6b07b0574937e5218ba66&amp;690</original_pic>
 +
      </status>
 +
    </user>
 +
    ...
 +
  </users>
 +
</searchResult>
 +
</pre>
 +
===JSON Example without callback===
 +
<pre>
 +
[
 +
    {
 +
        "name" : "王若琳",
 +
        "domain" : "",
 +
        "geo_enabled" : true,
 +
        "followers_count" : 52,
 +
        "statuses_count" : 6,
 +
        "favourites_count" : 0,
 +
        "city" : "5",
 +
        "description" : "我啊!不说了!",
 +
        "verified" : false,
 +
        "id" : 1427803427,
 +
        "gender" : "f",
 +
        "friends_count" : 11,
 +
        "screen_name" : "王若琳",
 +
        "allow_all_act_msg" : false,
 +
        "following" : false,
 +
        "url" : "",
 +
        "profile_image_url" : "http://tp4.sinaimg.cn/1427803427/50/1259749109/0",
 +
        "created_at" : "Wed Dec 02 00:00:00 +0800 2009",
 +
        "province" : "11",
 +
        "location" : "北京 朝阳区"
 +
    },
 +
    ....
 +
]
 
</pre>
 
</pre>
 
===JSON Example(callback=foo)===
 
===JSON Example(callback=foo)===
 
<pre>
 
<pre>
 
foo(
 
foo(
{
+
[
"results":[
+
    {
{
+
"name" : "王若琳",
"to_user_id":1728647563,
+
"domain" : "",
"to_user":"kiroro恋",
+
"geo_enabled" : true,
"text":"喜欢坐在你的车里听王若琳的歌",
+
"followers_count" : 52,
"id":4192745203,
+
"statuses_count" : 6,
"from_user_id":1728647563,
+
"favourites_count" : 0,
"from_user":"kiroro恋",
+
"city" : "5",
"iso_language_code":"nl",
+
"description" : "我啊!不说了!",
"source":"<a href=\"http://t.sina.com.cn\" rel=\"nofollow\">新浪微博</a>",
+
"verified" : false,
"profile_image_url":"http://tp4.sinaimg.cn/1728647563/50/1289280876/0",
+
"id" : 1427803427,
"created_at":"Thu Dec 09 13:57:20 +0800 2010"
+
"gender" : "f",
},
+
"friends_count" : 11,
],
+
"screen_name" : "王若琳",
"since_id":0,
+
"allow_all_act_msg" : false,
"max_id":4192745203,
+
"following" : false,
"results_per_page":0,
+
"url" : "",
"next_page":"?page=2&max_id=1291869235&q=王若琳",
+
"profile_image_url" : "http://tp4.sinaimg.cn/1427803427/50/1259749109/0",
"refresh_url":"?since_id=1291874240&q=王若琳",
+
"created_at" : "Wed Dec 02 00:00:00 +0800 2009",
"completed_in":0.24699999392032623,
+
"province" : "11",
"page":1,"query":"王若琳"
+
"location" : "北京 朝阳区"
}
+
    },
 +
    ...
 +
]
 
)
 
)
 
</pre>|
 
</pre>|
 
useAge=
 
useAge=
* It returns null if keyword is null|
+
* Return 400 error if the keyword is null|
 
otherInfo=None
 
otherInfo=None
 
}}
 
}}

2011年1月24日 (一) 11:31的版本

目录

users/search

Search for users with the keyword

URL

http://api.t.sina.com.cn/users/search.(json%7Cxml)

Supported Formats

XML/JSON

HTTP Request Method

GET

Requires Authentication

false
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)
q true string Keyword. Encoded by URL Encode.
snick false int Whether search for nickname. 0 is no, 1 is yes.
sdomain false int Whether search for domain name. 0 is no, 1 is yes
sintro false int Whether search for user description. 0 is no, 1 is yes.
province false int Provice ID ,see Province and city code table
city false int City ID,see Province and city code table]]
gender false string Gender. m is male, f is female.
comorsch false string Company or school name
sort false int Sort type,1 is by time, 2 is by follower count
page false int page
count false int weibo count per page (default is 10).
callback false string Only supports JSON. For JSONP cross site data access.
base_app false int Whether based on the current application. 1 is yes

Notes

  • Return 400 error if the keyword is null

Example Request

XML
curl -u "username:password" "http://api.t.sina.com.cn/users/search.xml?source=appkey&q=王若琳&callback=foo"
JSON
curl -u "username:password" "http://api.t.sina.com.cn/users/search.json?source=appkey&q=王若琳&callback=foo"

Response

XML Example

<?xml version="1.0" encoding="UTF-8"?>
<searchResult>
  <users>
    <user>
      <id>1795666007</id>
      <screen_name>王若琳星闻</screen_name>
      <name>王若琳星闻</name>
      <province>11</province>
      <city>1000</city>
      <location>北京</location>
      <description/>
      <url/>
      <profile_image_url>http://tp4.sinaimg.cn/1795666007/50/1282886247/0</profile_image_url>
      <domain/>
      <gender>f</gender>
      <followers_count>286</followers_count>
      <friends_count>213</friends_count>
      <statuses_count>9</statuses_count>
      <favourites_count>0</favourites_count>
      <created_at>Sun Aug 15 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>
      <status>
        <created_at>Tue Oct 26 13:24:19 +0800 2010</created_at>
        <id>3277931869</id>
        <text>【环保音乐会世博奏响 王若琳自曝宅女环保生活】 当晚,整个舞台群星璀璨,王若琳倾情演绎《Adult crap》《玫瑰玫瑰我爱你》一举征服了观众的心,著名环保歌手朱哲琴则用她空灵的歌声一曲《阿姐鼓》震撼全场,仿佛将观众...http://sinaurl.cn/h4WVid</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/>
        <thumbnail_pic>http://ss7.sinaimg.cn/thumbnail/6b07b0574937e5218ba66&690</thumbnail_pic>
        <bmiddle_pic>http://ss7.sinaimg.cn/bmiddle/6b07b0574937e5218ba66&690</bmiddle_pic>
        <original_pic>http://ss7.sinaimg.cn/orignal/6b07b0574937e5218ba66&690</original_pic>
      </status>
    </user>
    ...
  </users>
</searchResult>

JSON Example without callback

[
    {
        "name" : "王若琳",
        "domain" : "",
        "geo_enabled" : true,
        "followers_count" : 52,
        "statuses_count" : 6,
        "favourites_count" : 0,
        "city" : "5",
        "description" : "我啊!不说了!",
        "verified" : false,
        "id" : 1427803427,
        "gender" : "f",
        "friends_count" : 11,
        "screen_name" : "王若琳",
        "allow_all_act_msg" : false,
        "following" : false,
        "url" : "",
        "profile_image_url" : "http://tp4.sinaimg.cn/1427803427/50/1259749109/0",
        "created_at" : "Wed Dec 02 00:00:00 +0800 2009",
        "province" : "11",
        "location" : "北京 朝阳区"
    },
    ....
]

JSON Example(callback=foo)

foo(
	[
	    {
		"name" : "王若琳",
		"domain" : "",
		"geo_enabled" : true,
		"followers_count" : 52,
		"statuses_count" : 6,
		"favourites_count" : 0,
		"city" : "5",
		"description" : "我啊!不说了!",
		"verified" : false,
		"id" : 1427803427,
		"gender" : "f",
		"friends_count" : 11,
		"screen_name" : "王若琳",
		"allow_all_act_msg" : false,
		"following" : false,
		"url" : "",
		"profile_image_url" : "http://tp4.sinaimg.cn/1427803427/50/1259749109/0",
		"created_at" : "Wed Dec 02 00:00:00 +0800 2009",
		"province" : "11",
		"location" : "北京 朝阳区"
	    },
	    ...
	]
)

Others

None