在线状态
订阅在线状态事件
请求说明
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个
参数说明
参数 | 类型 | 必须 | 说明 |
---|---|---|---|
accid | String | 是 | 事件订阅人账号 |
eventType | int | 是 | 事件类型,固定设置为1,即 eventType=1 |
publisherAccids | String | 是 | 被订阅人的账号列表,最多100个账号,JSONArray格式。示例:["pub_user1","pub_user2"] |
ttl | long | 是 | 有效期,单位:秒。取值范围: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
具体请参考code状态表
取消在线状态事件订阅
请求说明
POST https://api.netease.im/nimserver/event/subscribe/delete.action HTTP/1.1
Content-Type:application/x-www-form-urlencoded;charset=utf-8
请求中Headers的设置请参考接口概述
接口描述
取消订阅指定人员的在线状态事件
参数说明
参数 | 类型 | 必须 | 说明 |
---|---|---|---|
accid | String | 是 | 事件订阅人账号 |
eventType | int | 是 | 事件类型,固定设置为1,即 eventType=1 |
publisherAccids | String | 是 | 取消被订阅人的账号列表,最多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
具体请参考code状态表
取消全部在线状态事件订阅
请求说明
POST https://api.netease.im/nimserver/event/subscribe/batchdel.action HTTP/1.1
Content-Type:application/x-www-form-urlencoded;charset=utf-8
请求中Headers的设置请参考接口概述
接口描述
取消指定事件的全部订阅关系
参数说明
参数 | 类型 | 必须 | 说明 |
---|---|---|---|
accid | String | 是 | 事件订阅人账号 |
eventType | int | 是 | 事件类型,固定设置为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
具体请参考code状态表
查询在线状态事件订阅关系
请求说明
POST https://api.netease.im/nimserver/event/subscribe/query.action HTTP/1.1
Content-Type:application/x-www-form-urlencoded;charset=utf-8
请求中Headers的设置请参考接口概述
接口描述
查询指定人员的有效在线状态事件订阅关系
参数说明
参数 | 类型 | 必须 | 说明 |
---|---|---|---|
accid | String | 是 | 事件订阅人账号 |
eventType | int | 是 | 事件类型,固定设置为1,即 eventType=1 |
publisherAccids | String | 是 | 被订阅人的账号列表,最多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
具体请参考code状态表
本篇文档内容是否对您有帮助?


此文档对你是否有帮助
×


×