批量查询用户资料
批量获取指定用户的信息,返回的信息包括用户的基本信息和拓展信息。
开通服务
信息托管服务已默认开通,您可以直接调用此接口。
请求方法
POST: https://数据中心域名/user/profile/batch/query.json
频率限制: 每秒钟限 100 次
签名规则: 所有服务端 API 请求均需要进行规则校验,详见 API 请求签名。
正文参数
HTTP 请求正文数据格式为 application/x-www-form-urlencoded,支持以下 HTTP 表单参数:
| 参数 | 类型 | 必传 | 说明 | 
|---|---|---|---|
| userId | Array | 是 | 用户 ID,最多一次100个。 | 
请求示例
HTTP
POST /user/profile/batch/query.json HTTP/1.1
Host: api.rong-api.com
App-Key: uwd1c0sxdlx2
Nonce: 14314
Timestamp: 1408710653491
Signature: 45beb7cc7307889a8e711219a47b7cf6a5b000e8
Content-Type: application/x-www-form-urlencoded
userId=u1&userId=u2
返回结果
HTTP 响应正文包含具有以下结构的 JSON 对象:
| 返回值 | 返回类型 | 说明 | 
|---|---|---|
| code | Number | 返回码,200 为正常。 | 
| userList | JSONArray | 用户列表信息 | 
| userList 结构 | 
userList 结构的组成:
| 返回值 | 返回类型 | 说明 | 
|---|---|---|
| userList[i].userId | String | 用户ID | 
| userList[i].version | long | 用户托管信息版本号 | 
| userList[i].userProfile | String | 用户基本信息,为 JSON 数据 | 
| userList[i].userExtProfile | String | 用户扩展信息,为 JSON 数据 | 
userProfile 中的 key 如下:
| key 值 | 类型 | 长度/取值范围 | 描述 | 
|---|---|---|---|
| uniqueId | String | 长度不超过 32 个字符 | 用户应用号 | 
| name | String | 长度不超过 32 个字符 | 昵称 | 
| portraitUri | String | 长度不超过 128 个字符 | 头像地址 | 
| email | String | 长度不超过 128 个字符 | Email 地址 | 
| birthday | String | 长度不超过 32 个字符 | 生日 | 
| gender | Int | 取值范为: 
 | 性别 | 
| location | String | 长度不超过 32 个字符 | 所在地 | 
| role | Int | 0~100 | 角色 | 
| level | Int | 0~100 | 级别 | 
返回结果示例
HTTP
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
{
    "code": 200,
    "userList": [
        {
            "userId": "u1",
            "version": 12343433499942,
            "userProfile": {"birthday":"20011221","level":2},
            "userExtProfile": {"ext_1":"testext"}
        },
        {
            "userId": "u2",
            "userProfile": {"gender":1,"level":5}
        }
    ]
}