Users.getInfo
目录 |
[编辑] 描述
获取用户的信息。如果用户设置了隐私或者调用接口时没有传递session_key或access_token参数,只会返回参数uids对应的用户的姓名(name)、性别(sex)、是否为星级用户(star)、头像(headurl)等数据。 当uids为空时,会返回当前用户,也就是session_key或access_token对应用户的信息。
[编辑] 参数表
| Name | Required | Type | Description |
|---|---|---|---|
| method | true | string | users.getInfo |
| sig | true | string | 签名认证。是用当次请求的所有参数计算出来的值。点击此处查看详细算法 |
| v | true | string | API的版本号,固定值为1.0 |
| api_key | false | string | 申请应用时分配的api_key,调用接口时候代表应用的唯一身份 |
| session_key | false | string | 当前用户的session_key |
| access_token | false | string | OAuth2.0验证授权后获得的token。当传入此参数时,api_key和session_key可以不用传入。 |
| format | false | string | 返回值的格式。请指定为JSON或者XML,推荐使用JSON,缺省值为XML |
| uids | false | string | 需要查询的用户的ID,多个ID用逗号隔开。例如:uids=1232,342,12324。建议都传入此参数。当此参数为空时,缺省值为session_key或access_token对应用户的ID。 |
| fields | false | string | 返回的字段列表,可以指定返回那些字段,用逗号分隔。如:uid,name,sex,star,zidou,vip,birthday,tinyurl,headurl,mainurl,hometown_location work_history,university_history。如果不传递此参数默认返回uid,name,tinyurl,headhurl,zidou,star。此参数请指定为你需要的字段,为了提升响应速度,你不需要用到的字段请不要传入。注意:当不传入session_key或没有权限时,fields失效! |
[编辑] 返回XML样例
<?xml version="1.0" encoding="UTF-8"?>
<users_getInfo_response xmlns="http://api.xiaonei.com/1.0/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://api.xiaonei.com/1.0/
http://api.xiaonei.com/1.0/xiaonei.xsd" list="true">
<user>
<uid>8055</uid>
<name>刘德华</name>
<sex>1</sex>
<star>1</star>
<zidou>1</zidou>
<birthday>1961-09-27</birthday>
<email_hash>650628530_9c6b2b93842c46155b75b14a34054924</email_hash>
<tinyurl>
http://head.xiaonei.com/photos/tiny_10942g177.jpg
</tinyurl>
<headurl>
http://head.xiaonei.com/photos/tiny_10942g177.jpg
</headurl>
<mainurl>
http://head.xiaonei.com/photos/tiny_10942g177.jpg
</mainurl>
<hometown_location>
<country>中国</country>
<province>黑龙江</province>
<city>哈尔滨</city>
</hometown_location>
<work_history list="true">
<work_info>
<company_name>千橡互联</company_name>
<description>一家互联网公司</description>
<start_date>2006-01</start_date>
<end_date />
</work_info>
</work_history>
<university_history list="true">
<university_info>
<name>北京第二外国语学院</name>
<year>2003</year>
<department>人文学院</department>
</university_info>
</university_history>
<hs_history list="true">
<hs_info>
<name>黑龙江省实验中学</name>
<grad_year>1999</grad_year>
</hs_info>
</hs_history>
</user>
</users_getInfo_response>
[编辑] 返回JSON样例
[{ “uid”:222332 , ”name”:”Ramos” , ”sex”:1 , ”star”:1 ,”zidou”:1 ”birthday”:”2008-10-12”,
"email_hash”:” 650628530_9c6b2b93842c46155b75b14a34054924”,
“tinyurl”:” http://head.xiaonei.com/photos/tiny_10942g177.jpg”,
“headurl”:” http://head.xiaonei.com/photos/tiny_10942g177.jpg”,
“mainurl”:” http://head.xiaonei.com/photos/tiny_10942g177.jpg”,
“hometown_location”:{“country”:”中国”,”province”:”四川”,”city”:”乐山”},
”work_history”:[
{“company_name”:”千橡”,
”description”:”优秀的公司”,
”start_date”:”2008-7-7”,”end_date”:””}
],
“university_history”:[
{“name”:” 北京第二外国语学院”,”year”:2003,
“department”:” 人文学院”}
],
“hs_history”:[
{“name”:” 黑龙江省实验中学”,”grad_year”:1999}
],}]
[编辑] 返回参数
其中name代表fields里可传入的参数
| Name | Description |
|---|---|
| <uid> | 表示用户id |
| <name> | 表示用户名 |
| <sex> | 表示性别,值1表示男性;值0表示女性 |
| <star> | 表示是否为星级用户,值“1”表示“是”;值“0”表示“不是” |
| <zidou> | 表示是否为vip用户,值1表示是;值0表示不是 |
| <vip> | 表示是否为vip用户等级,前提是zidou节点必须为1 |
| <birthday> | 表示出生时间,格式为:yyyy-mm-dd,需要自行格式化日期显示格式。注:年份60后,实际返回1760-mm-dd;70后,返回1770-mm-dd;80后,返回1780-mm-dd;90后,返回1790-mm-dd |
| <email_hash> | 用户经过验证的email的信息字符串:email通过了connect.registerUsers接口。字符串包含的email经过了crc32和md5的编码 |
| <tinyurl> | 表示头像链接 50*50大小 |
| <headurl> | 表示头像链接 100*100大小 |
| <mainurl> | 表示头像链接 200*200大小 |
| <hometown_location> | 表示家乡信息 |
| <country>(子节点) | 表示所在国家 |
| <province>(子节点) | 表示所在省份 |
| <city>(子节点) | 表示所在城市 |
| <work_info> | 表示工作信息 |
| <company_name>(子节点) | 表示所在公司 |
| <description>(子节点) | 表示工作描述 |
| <start_date>(子节点) | 表示入职时间 |
| <end_date>(子节点) | 离职时间 |
| <university_info> | 表示就读大学信息 |
| <name>(子节点) | 表示大学名 |
| <year>(子节点) | 表示入学时间 |
| <department>(子节点) | 表示学院 |
| <hs_info> | 表示就读高中学校信息 |
| <name>(子节点) | 表示高中学校名 |
| <grad_year>(子节点) | 表示入学时间 |
Language:
中文 • English