Instant Messaging
Server
Limits
Platform Service
Third-party Callback
Third-party Callback Overview
Message-related Callback
Related Callbacks of User Information
Related Callbacks of Advanced Team
Related Callbacks of Super Team
Related Callbacks of Audio and Video
Callback related to Log in
Data Sync
Data Sync Service Overview
IM Session Message Delivery
Other IM Message Delivery
Audio/video/whiteboard Duration Message Delivery
API Reference
Overview
Status Code
Account Management
Register an Account
Refresh Token
Ban Account
Login Authentication
User Profile
Online Status

Online Status

Update time: 2022/11/25 16:01:37

Subscribing to online status event

Subscribes to online status event of specified peer, and the maximum number of valid subscriptions per account does not exceed 3,000.

Request URL

POST https://api-sg.netease.im/nimserver/event/subscribe/add.action HTTP/1.1
Content-Type:application/x-www-form-urlencoded;charset=utf-8

For information about headers in the request, see Overview.

Parameters

ParameterTypeRequiredDescription
accidStringYesEvent subscriber's account
eventTypeintYesEvent type, fixed to 1, i.e. eventType=1
publisherAccidsStringYesList of subscribed pulisher accounts, 100 accounts in maximum, in JSONArray format. Example: ["pub_user1","pub_user2"]
ttllongYesValidity period, unit: seconds. Value range: 60~2592000 (60 seconds to 30 days)

curl request example

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-sg.netease.im/nimserver/event/subscribe/add.action"

Response

The data returned in the HTTP response is in JSON format.


"Content‐type":"application/json;charset=utf‐8"
{
  "code": 200,
  "failedAccid":[] //Array of accounts with failed subscription
}

Valid status codes

200、403、414、416、419、431、500

See Status codes .


Unsubscribe from online status event

Unsubscribes events from online status of a specified peer.

Request URL

POST https://api-sg.netease.im/nimserver/event/subscribe/delete.action HTTP/1.1
Content-Type:application/x-www-form-urlencoded;charset=utf-8

For information about headers in the request, see Overview.

Parameters

ParameterTypeRequiredDescription
accidStringYesEvent subscriber's account
eventTypeintYesEvent type, fixed to 1, i.e. eventType=1
publisherAccidsStringYesAccount list of unsubscribed publishers, 100 accounts in maximum, in JSONArray format. Example: ["pub_user1","pub_user2"]

curl request example

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-sg.netease.im/nimserver/event/subscribe/delete.action"

Response

The data returned in the HTTP response is in JSON format.


"Content‐type":"application/json;charset=utf‐8"
{
  "code": 200,
  "failedAccid":[] //Array of accounts with failed un-subscription
}

Valid status codes

200、403、414、416、419、431、500

See Status codes .


Unsubscribing from all online status events

Cancels all subscriptions for the specified event

Request URL

POST https://api-sg.netease.im/nimserver/event/subscribe/batchdel.action HTTP/1.1
Content-Type:application/x-www-form-urlencoded;charset=utf-8

For information about headers in the request, see Overview.

Parameters

ParameterTypeRequiredDescription
accidStringYesEvent subscriber's account
eventTypeintYesEvent type, fixed to 1, i.e. eventType=1

curl request example

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-sg.netease.im/nimserver/event/subscribe/batchdel.action"

Response

The data returned in the HTTP response is in JSON format.


"Content‐type":"application/json;charset=utf‐8"
{
  "code": 200
}

Valid status codes

200、403、414、416、419、431、500

See Status codes .


Query the subscriptions to online status

Request URL

POST https://api-sg.netease.im/nimserver/event/subscribe/query.action HTTP/1.1
Content-Type:application/x-www-form-urlencoded;charset=utf-8

For information about headers in the request, see Overview.

Query the subscriptions to online status of specified peer

Parameters

ParameterTypeRequiredDescription
accidStringYesEvent subscriber's account
eventTypeintYesEvent type, fixed to 1, i.e. eventType=1
publisherAccidsStringYesList of subscribed pulisher accounts, 100 accounts in maximum, in JSONArray format. Example: ["pub_user1","pub_user2"]

curl request example

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-sg.netease.im/nimserver/event/subscribe/query.action"

Response

The data returned in the HTTP response is in JSON format.


"Content‐type":"application/json;charset=utf‐8"
{
  "code": 200,
  "subscribes":[
    {"accid":"pub_user1",// Account of subscribed publisher
     "eventType":1, //event type
     "expireTime":1490341879766, //Expiration time
     "subscribeTime":1490255479766 //Subscription time
    },
   ...
  ]
}

Valid status codes

200、403、414、416、419、431、500

See Status codes .

Was this topic helpful?
Yes
No
  • Subscribing to online status event
  • Request URL
  • Parameters
  • curl request example
  • Response
  • Valid status codes
  • Unsubscribe from online status event
  • Request URL
  • Parameters
  • curl request example
  • Response
  • Valid status codes
  • Unsubscribing from all online status events
  • Request URL
  • Parameters
  • curl request example
  • Response
  • Valid status codes
  • Query the subscriptions to online status
  • Request URL
  • Parameters
  • curl request example
  • Response
  • Valid status codes