/users/show.json(get)
GET users/show
Returns a variety of information about theuser specified by therequired user_id or screen_name parameter. The author'smost recent Tweet will be returned inline when possible.
返回一一系列用户信息,必须要求有用户的user_id 或者 screen_name 作为参数。作者最近很可能通过inline 返回用户信息。
Resource URL(资源请求地址)
https://api.twitter.com/1.1/users/show.json
Parameters(参数)
user_idrequired
The ID of the user for whom to return resultsfor. Either an id or screen_name is required for this method.
ExampleValues: 12345
screen_namerequired
The screen name of the user for whom to returnresults for. Either a id or screen_name is required for this method.
ExampleValues: noradio
include_entitiesoptional
The entities nodewill be disincluded when set to false.
ExampleValues: false
Example Request
https://api.twitter.com/1.1/users/show.json?user_id=1399229940
GET/1.1/users/show.json?user_id=1399229940 HTTP/1.1
X-HostCommonName:
api.twitter.com
Authorization:
OAuthoauth_consumer_key="DC0sePOBbQ8bYdC8r4Smg",oauth_signature_method="HMAC-SHA1",oauth_timestamp="1368168204",oauth_nonce="-359292805",oauth_version="1.0",oauth_token="1399229940-f0Eg0F8zwLOZ8lQ8FbqFTWHQzBozQjbrCJX5Sid",oauth_signature="lV5BAsBd%2FxvrELRK1yZz8x4b5i0%3D"
Host:
api.twitter.com
X-Target-URI:
Connection:
Keep-Alive
HTTP/1.1 200 OK
content-type:
application/json;charset=utf-8
x-frame-options:
SAMEORIGIN
x-rate-limit-remaining:
178
last-modified:
Fri, 10 May 201306:43:24 GMT
status:
200 OK
date:
Fri, 10 May 2013 06:43:24 GMT
x-transaction:
ba449cae08edd3f2
pragma:
no-cache
cache-control:
no-cache, no-store, must-revalidate,pre-check=0, post-check=0
x-xss-protection:
1; mode=block
x-rate-limit-limit:
180
expires:
Tue, 31 Mar 1981 05:00:00 GMT
set-cookie:
lang=zh-cn
set-cookie:
guest_id=v1%3A136816820434005740;Domain=.twitter.com; Path=/; Expires=Sun, 10-May-2015 06:43:24 UTC
content-length:
1976
x-rate-limit-reset:
1368169103
server:
tfe
strict-transport-security:
max-age=631138519
x-access-level:
read-write-directmessages
{
"id": 1399229940,
"id_str": "1399229940",
"name": "liuxingyu",
"screen_name": "liuxingyu2",
"location": "",
"description": "",
"url": null,
"entities": {
"description": {
"urls": []
}
},
"protected": false,
"followers_count": 4,
"friends_count": 3,
"listed_count": 0,
"created_at": "Fri May03 09:02:17 +0000 2013",
"favourites_count": 0,
"utc_offset": 28800,
"time_zone": "Beijing",
"geo_enabled": true,
"verified": false,
"statuses_count": 1,
"lang": "zh-cn",
"status": {
"created_at": "Fri May03 09:15:59 +0000 2013",
"id": 330249367258796000,
"id_str": "330249367258796033",
"text": "我的Twitter被冻结了,又申请了一个,哈哈。",
"source": "web",
"truncated": false,
"in_reply_to_status_id": null,
"in_reply_to_status_id_str": null,
"in_reply_to_user_id": null,
"in_reply_to_user_id_str": null,
"in_reply_to_screen_name": null,
"geo": null,
"coordinates": null,
"place": null,
"contributors": null,
"retweet_count": 0,
"favorite_count": 0,
"entities": {
"hashtags": [],
"symbols": [],
"urls": [],
"user_mentions": []
},
"favorited": false,
"retweeted": false,
"lang": "zh"
},
"contributors_enabled": false,
"is_translator": false,
"profile_background_color": "C0DEED",
"profile_background_image_url": "http://a0.twimg.com/images/themes/theme1/bg.png",
"profile_background_image_url_https": "https://si0.twimg.com/images/themes/theme1/bg.png",
"profile_background_tile": false,
"profile_image_url": "http://a0.twimg.com/profile_images/3607040025/4379f0e72e5ce5b16a5bdef445438d79_normal.jpeg",
"profile_image_url_https": "https://si0.twimg.com/profile_images/3607040025/4379f0e72e5ce5b16a5bdef445438d79_normal.jpeg",
"profile_banner_url": "https://si0.twimg.com/profile_banners/1399229940/1367572365",
"profile_link_color": "0084B4",
"profile_sidebar_border_color": "C0DEED",
"profile_sidebar_fill_color": "DDEEF6",
"profile_text_color": "333333",
"profile_use_background_image": true,
"default_profile": true,
"default_profile_image": false,
"following": false,
"follow_request_sent": false,
"notifications": false
}
总结:
user_id 参数,如果查询自己的信息输入的是自己的用户ID 如果是查询别人的信息,则输入的是别人的用户ID