查询
查询聊天室基础信息,包括:聊天室 ID、名称、创建时间
方法名:/chatroom/query
签名方法:请参考 通用 API 接口签名规则
URL:http(s)://api-cn.ronghub.com/chatroom/query.[format]
[format] 表示返回格式,可以为 json
或 xml
,注意不要带 [ ]。
HTTP 方法:POST
表单参数
名称 | 类型 | 说明 |
---|---|---|
chatroomId | String | 要查询的聊天室id(必传) |
返回值
名称 | 类型 | 说明 |
---|---|---|
code | Int | 返回码,200 为正常。 |
chatRooms | String[] | 聊天室信息数组。 |
chrmId | String | 聊天室 ID。 |
name | String | 聊天室名称。 |
time | String | 聊天室创建时间。 |
JSON 格式:
{
"code":200,
"chatRooms":[{
"chrmId":"10001",
"name":"name1",
"time":"2014-11-11 11:3:34"
}]
}
XML 格式:
<xml>
<code>200</code>
<chatrooms>
<concurrent-hash-map>
<entry>
<string>chrmId</string>
<string>10001</string>
</entry>
<entry>
<string>name</string>
<string>name1</string>
</entry>
<entry>
<string>time</string>
<string>2014-11-11 11:1:31</string>
</entry>
</concurrent-hash-map>
</chatrooms>
</xml>
返回值请参考 API 方法返回值说明
当提交多个时表示查询多个聊天室,参见下面示例。
示例
Request:
POST /chatroom/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&chatroomId=10002
Response:
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
{
"code":200,
"chatRooms":[{
"chatroomId":"10001","name":"name1","time":"2014-01-01 1:1:1"
},
{
"chatroomId":"10002","name":"name2","time":"2014-01-01 1:1:2"
}]
}