User presence status

Update time: 2023/10/09 03:48:14

Subscribing to user presence status

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

Request URL

httpPOST 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

curlcurl -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.

json
"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 user presence status

Unsubscribes events from user presence status of a specified peer.

Request URL

httpPOST 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

curlcurl -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.

json
"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 user presence status

Cancels all subscriptions for the specified event

Request URL

httpPOST 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

curlcurl -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.

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

Valid status codes

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

See Status codes .


Query subscriptions to user presence status

Request URL

httpPOST 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 user presence status of a specified member

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

curlcurl -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.

json
"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 page helpful?
Yes
No
  • Subscribing to user presence status
  • Request URL
  • Parameters
  • curl request example
  • Response
  • Valid status codes
  • Unsubscribe from user presence status
  • Request URL
  • Parameters
  • curl request example
  • Response
  • Valid status codes
  • Unsubscribing from all user presence status
  • Request URL
  • Parameters
  • curl request example
  • Response
  • Valid status codes
  • Query subscriptions to user presence status
  • Request URL
  • Parameters
  • curl request example
  • Response
  • Valid status codes