成员查询
获取聊天室成员¶
方法名:/chatroom/user/query
签名方法:请参考 通用 API 接口签名规则
URL:http(s)://api-cn.ronghub.com/chatroom/user/query.[format]
[format] 表示返回格式,可以为 json
或 xml
,注意不要带 [ ]。
HTTP 方法:POST
表单参数
名称 | 类型 | 说明 |
---|---|---|
chatroomId | String | 要查询的聊天室 ID(必传) |
count | String | 要获取的聊天室成员信息数,最多返回 500 个成员信息(必传) |
order | String | 加入聊天室的先后顺序, 1 为加入时间正序, 2 为加入时间倒序(必传) |
返回值
名称 | 类型 | 说明 |
---|---|---|
code | Int | 200:成功。 |
total | Int | 当前聊天室中用户数。 |
users | String[] | 聊天室成员数组,最多为 500 个。 |
id | String | 用户 Id。 |
time | String | 加入聊天室时间。 |
JSON 格式:
{
"code":200,
"total":1000,
"users":[{
"id":"uid1",
"time":"2015-09-10 16:38:26"
},
{
"id":"uid2",
"time":"2015-09-10 16:38:26"
}]
}
XML 格式:
<xml>
<code>200</code>
<total>1000</total>
<users>
<concurrent-hash-map>
<entry>
<string>id</string>
<string>uid1</string>
</entry>
<entry>
<string>time</string>
<string>2015-09-10 16:38:26</string>
</entry>
</concurrent-hash-map>
</users>
</xml>
返回值请参考 API 方法返回值说明
示例
Request:
POST /chatroom/user/query.json HTTP/1.1
Host: api-cn.ronghub.com
App-Key: uwd1c0sxdlx2
Timestamp: 1408710653491
Nonce: 14314
Signature: 45beb7cc7307889a8e711219a47b7cf6a5b000e8
Content-Type: Application/x-www-form-urlencoded
chatroomId=10001&count=2&order=1
Response:
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
{
"code":200,
"total":500,
"users":[
{
"id":"uid1",
"time":"2015-09-10 16:38:26"
},
{
"id":"uid2",
"time":"2015-09-10 16:38:26"
}]
}
查询用户是否加入¶
方法名:/chatroom/user/exist
签名方法:请参考 通用 API 接口签名规则
URL:http(s)://api-cn.ronghub.com/chatroom/user/exist.[format]
[format] 表示返回格式,可以为 json
或 xml
,注意不要带 [ ]。
HTTP 方法:POST
表单参数
名称 | 类型 | 说明 |
---|---|---|
chatroomId | String | 要查询的聊天室 ID(必传) |
userId | String | 要查询的用户 ID(必传) |
返回值
名称 | 类型 | 说明 |
---|---|---|
code | Int | 200:成功。 |
isInChrm | Boolean | 用户是否在聊天室中,true 表示在聊天室中,false 表示不在聊天室中。 |
JSON 格式:
{
"code":200,
"isInChrm":true
}
XML 格式:
<xml>
<code>200</code>
<isInChrm>true</isInChrm>
</xml>
返回值请参考 API 方法返回值说明
示例
Request:
POST /chatroom/user/exist.json HTTP/1.1
Host: api-cn.ronghub.com
App-Key: uwd1c0sxdlx2
Timestamp: 1408710653491
Nonce: 14314
Signature: 45beb7cc7307889a8e711219a47b7cf6a5b000e8
Content-Type: Application/x-www-form-urlencoded
chatroomId=10001&userId=5
Response:
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
{"code":200,"isInChrm":true}
批量查询用户是否加入¶
方法名:/chatroom/users/exist
调用频率:每秒钟最多调用 20 次
签名方法:请参考 通用 API 接口签名规则
URL:http(s)://api-cn.ronghub.com/chatroom/users/exist.[format]
[format] 表示返回格式,可以为 json
或 xml
,注意不要带 [ ]。
HTTP 方法:POST
表单参数
名称 | 类型 | 说明 |
---|---|---|
chatroomId | String | 要查询的聊天室 ID(必传) |
userId | String | 要查询的用户 ID,每次最多不超过 1000 个用户 ID(必传) |
返回值
名称 | 类型 | 说明 |
---|---|---|
code | Int | 200:成功。 |
userid | String | 聊天室中用户 ID。 |
isInChrm | Int | 用户是否在聊天室中,1 表示在聊天室中,0 表示不在聊天室中。 |
JSON 格式:
{
"code":200,
"result":[
{"userid":"y41z2IXBW", "isInChrm":0},
{"userid":"niCtlxnas", "isInChrm":1}
]
}
返回值请参考 API 方法返回值说明
示例
Request:
POST /chatroom/users/exist.json HTTP/1.1
Host: api-cn.ronghub.com
App-Key: uwd1c0sxdlx2
Timestamp: 1408710653491
Nonce: 14314
Signature: 45beb7cc7307889a8e711219a47b7cf6a5b000e8
Content-Type: Application/x-www-form-urlencoded
chatroomId=10001&userId=y41z2IXBW&userId=niCtlxnas
Response:
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
{
"code":200,
"result":[
{"userid":"y41z2IXBW", "isInChrm":0},
{"userid":"niCtlxnas", "isInChrm":1}
]
}