用户名片
更新用户名片
请求说明
POST https://api.netease.im/nimserver/user/updateUinfo.action HTTP/1.1
Content-Type: application/x-www-form-urlencoded;charset=utf-8
请求中Headers的设置请参考接口概述
接口描述
更新用户名片。用户名片中包含的用户信息,在群组、聊天室等场景下,会暴露给群组、聊天室内的其他用户。这些字段里mobile,email,birth,gender等字段属于非必填、可能涉及隐私的信息,如果您的业务下,这些信息为敏感信息,建议在通过扩展字段ex填写相关资料并事先加密。
参数说明
参数 | 类型 | 必须 | 说明 |
---|---|---|---|
accid | String | 是 | 用户帐号,最大长度32字符,必须保证一个APP内唯一 |
name | String | 否 | 用户昵称,最大长度64字符,可设置为空字符串 |
icon | String | 否 | 用户头像,最大长度1024字节,可设置为空字符串 |
sign | String | 否 | 用户签名,最大长度256字符,可设置为空字符串 |
String | 否 | 用户email,最大长度64字符,可设置为空字符串 | |
birth | String | 否 | 用户生日,最大长度16字符,可设置为空字符串 |
mobile | String | 否 | 用户mobile,最大长度32字符,非中国大陆手机号码需要填写国家代码(如美国:+1-xxxxxxxxxx)或地区代码(如香港:+852-xxxxxxxx),可设置为空字符串 |
gender | int | 否 | 用户性别,0表示未知,1表示男,2女表示女,其它会报参数错误 |
ex | String | 否 | 用户名片扩展字段,最大长度1024字符,用户可自行扩展,建议封装成JSON字符串,也可以设置为空字符串 |
curl请求示例
curl -X POST -H "AppKey: go9dnk49bkd9jd9vmel1kglw0803mgq3" -H "Nonce: 4tgggergigwow323t23t" -H "CurTime: 1443592222" -H "CheckSum: 9e9db3b6c9abb2e1962cf3e6f7316fcc55583f86" -H "Content-Type: application/x-www-form-urlencoded" -d 'accid=zhangsan&name=Jack' 'https://api.netease.im/nimserver/user/updateUinfo.action'
返回说明
http 响应:json
"Content-Type": "application/json; charset=utf-8"
{
"code":200
}
主要的返回码
200、403、414、416、431、500
具体请参考code状态表
获取用户名片
请求说明
POST https://api.netease.im/nimserver/user/getUinfos.action HTTP/1.1
Content-Type: application/x-www-form-urlencoded;charset=utf-8
请求中Headers的设置请参考接口概述
接口描述
获取用户名片,可批量
参数说明
参数 | 类型 | 必须 | 说明 |
---|---|---|---|
accids | String | 是 | 用户帐号(例如:JSONArray对应的accid串,如:["zhangsan"],如果解析出错,会报414)(一次查询最多为200) |
curl请求示例
curl -X POST -H "AppKey: go9dnk49bkd9jd9vmel1kglw0803mgq3" -H "Nonce: 4tgggergigwow323t23t" -H "CurTime: 1443592222" -H "CheckSum: 9e9db3b6c9abb2e1962cf3e6f7316fcc55583f86" -H "Content-Type: application/x-www-form-urlencoded" -d 'accids=["zhangsan"]' 'https://api.netease.im/nimserver/user/getUinfos.action'
返回说明
http 响应:json
"Content-Type": "application/json; charset=utf-8"
{
"code":200,
"uinfos":
[
{"email":"t1@163.com","accid":"t1","name":"abc","gender":1,"mobile":"18645454545"},
{"accid":"t2","name":"def","gender":0}
]
}
主要的返回码
200、403、414、416、431、500
具体请参考code状态表