查询当前在线用户
所有应用(包括免费应用)均可在我的应用 -> 查看详情 -> 高级功能 -> 在线用户查询和上下线提醒 自助启用和关闭。
所有增强型应用(包括免费应用),均可以免费调用IM在线用户查询接口,2021年11月起,IM在线用户查询接口不再单独扣除消息条数。 但启用后,若使用了PubSub模块,会造成PubSub消息数的消耗。
GET http://{rest-host}/v2/im/here_now
杭州: rest-hangzhou.goeasy.io
新加坡: rest-singapore.goeasy.io
参数 | 类型 | 必须 | 描述 |
---|---|---|---|
rest-host | String | 是 | 根据您创建应用的区域选择 杭州:rest-hangzhou.goeasy.io 新加坡:暂不支持IM,敬请期待 |
appkey | String | 是 | common key 或者 rest key |
userIds | Array | 是 | 要查询的用户id列表,每次最多不超过50个 传入多个时:userIds=user1&userIds=user2 |
curl -X GET "http://rest-hangzhou.goeasy.io/v2/im/here_now?appkey=BC-xxxxx&userIds=user1&userIds=user2&userIds=user3"
{
"code":200,
"content":[
{"id":"user1","data":{"nickname":"Jack"}},
{"id":"user2","data":{"nickname":"Cherry"}},
{"id":"user3","data":{"nickname":"Tonny"}}
]
}
{
"code":401,
"content":"Unauthorized"
}