在线状态
订阅在线状态事件
请求说明
POST https://api.netease.im/nimserver/event/subscribe/add.action HTTP/1.1
Content-Type:application/x-www-form-urlencoded;charset=utf-8
请求中Headers的设置请参考接口概述
接口描述
订阅指定人员的在线状态事件,每个账号最大有效订阅账号不超过3000个
参数说明
参数类型必须说明
accidString是事件订阅人账号
eventTypeint是事件类型,固定设置为1,即 eventType=1
publisherAccidsString是被订阅人的账号列表,最多100个账号,JSONArray格式。示例:["pub_user1","pub_user2"]
ttllong是有效期,单位:秒。取值范围:60~2592000(即60秒到30天)
curl请求示例
curl -X POST -H "CheckSum: fc040248923c881f2fe7cc39602b79565230155c" -H "AppKey: f1234540c12345673123456847aaaaaa" -H "Nonce: 1" -H "CurTime: 1451200147" -H "Content-Type: application/x-www-form-urlencoded" -d 'accid=user1&eventType=1&publisherAccids=["pub_user1","pub_user2"]&ttl=86400' "https://api.netease.im/nimserver/event/subscribe/add.action"
返回说明
http 响应:json
"Content‐type":"application/json;charset=utf‐8"
{
"code": 200,
"failedAccid":[] //订阅失败的账号数组
}
主要的返回码
200、403、414、416、419、431、500
取消在线状态事件订阅
请求说明
POST https://api.netease.im/nimserver/event/subscribe/delete.action HTTP/1.1
Content-Type:application/x-www-form-urlencoded;charset=utf-8
请求中Headers的设置请参考接口概述
接口描述
取消订阅指定人员的在线状态事件
参数说明
参数类型必须说明
accidString是事件订阅人账号
eventTypeint是事件类型,固定设置为1,即 eventType=1
publisherAccidsString是取消被订阅人的账号列表,最多100个账号,JSONArray格式。示例:["pub_user1","pub_user2"]
curl请求示例
curl -X POST -H "CheckSum: fc040248923c881f2fe7cc39602b79565230155c" -H "AppKey: f1234540c12345673123456847aaaaaa" -H "Nonce: 1" -H "CurTime: 1451200147" -H "Content-Type: application/x-www-form-urlencoded" -d 'accid=user1&eventType=1&publisherAccids=["pub_user1","pub_user2"]' "https://api.netease.im/nimserver/event/subscribe/delete.action"
返回说明
http 响应:json
"Content‐type":"application/json;charset=utf‐8"
{
"code": 200,
"failedAccid":[] //取消订阅失败的账号数组
}
主要的返回码
200、403、414、416、419、431、500
取消全部在线状态事件订阅
请求说明
POST https://api.netease.im/nimserver/event/subscribe/batchdel.action HTTP/1.1
Content-Type:application/x-www-form-urlencoded;charset=utf-8
请求中Headers的设置请参考接口概述
接口描述
取消指定事件的全部订阅关系
参数说明
参数类型必须说明
accidString是事件订阅人账号
eventTypeint是事件类型,固定设置为1,即 eventType=1
curl请求示例
curl -X POST -H "CheckSum: fc040248923c881f2fe7cc39602b79565230155c" -H "AppKey: f1234540c12345673123456847aaaaaa" -H "Nonce: 1" -H "CurTime: 1451200147" -H "Content-Type: application/x-www-form-urlencoded" -d 'accid=user1&eventType=1' "https://api.netease.im/nimserver/event/subscribe/batchdel.action"
返回说明
http 响应:json
"Content‐type":"application/json;charset=utf‐8"
{
"code": 200
}
主要的返回码
200、403、414、416、419、431、500
查询在线状态事件订阅关系
请求说明
POST https://api.netease.im/nimserver/event/subscribe/query.action HTTP/1.1
Content-Type:application/x-www-form-urlencoded;charset=utf-8
请求中Headers的设置请参考接口概述
接口描述
查询指定人员的有效在线状态事件订阅关系
参数说明
参数类型必须说明
accidString是事件订阅人账号
eventTypeint是事件类型,固定设置为1,即 eventType=1
publisherAccidsString是被订阅人的账号列表,最多100个账号,JSONArray格式。示例:["pub_user1","pub_user2"]
curl请求示例
curl -X POST -H "CheckSum: fc040248923c881f2fe7cc39602b79565230155c" -H "AppKey: f1234540c12345673123456847aaaaaa" -H "Nonce: 1" -H "CurTime: 1451200147" -H "Content-Type: application/x-www-form-urlencoded" -d 'accid=user1&eventType=1&publisherAccis=["pub_user1","pub_user2"]' "https://api.netease.im/nimserver/event/subscribe/query.action"
返回说明
http 响应:json
"Content‐type":"application/json;charset=utf‐8"
{
"code": 200,
"subscribes":[
{"accid":"pub_user1",//被订阅人账号
"eventType":1, //事件类型
"expireTime":1490341879766, //过期时间
"subscribeTime":1490255479766 //订阅时间
},
...
]
}
主要的返回码
200、403、414、416、419、431、500
本篇文档内容是否对您有帮助?
有帮助
我要吐槽
如果遇到产品相关问题,您可 提交工单 或 在线客服 寻求帮助。
您的改进建议
×
问题类型
内容错误
内容没更新
描述不清
链接有误
步骤不完整
内容缺失(缺少代码/示例)
其他
更多建议
请输入您的建议或问题(至少5个字符,至多500个字符)
联系方式
标记内容
同时提交标记内容
提交
此文档对你是否有帮助
×
有帮助
我要吐槽
×
反馈成功
非常感谢您的反馈,我们会继续努力做得更好。