Chat Room
Update time: 2022/11/25 08:17:29
Creating a chat room
Creates a chat room.
Request URL
httpPOST https://api.netease.im/nimserver/chatroom/create.action HTTP/1.1
Content-Type:application/x-www-form-urlencoded;charset=utf-8
For information about headers in the request, see Overview.
Parameters
Parameter | Type | Required | Description |
---|---|---|---|
creator | String | Yes | Account accid of the chat room owner |
name | String | Yes | Chat room name, with up to 128 characters |
announcement | String | No | Announcement, with up to 4096 characters |
broadcasturl | String | No | Live streaming address, with up to 1024 characters |
ext | String | No | Extension field, with up to 4096 characters |
queuelevel | int | No | Queue management permission: 0: Everyone can modify the queue, 1: Only the anchor administrator can modify the queue. 0 is the default |
curl request example
curlcurl -X POST -H "CheckSum: fc040248923c881f2fe7cc39602b79565230155c" -H "AppKey: f1234540c12345673123456847aaaaaa" -H "Nonce: 1" -H "CurTime: 1451217360" -H "Content-Type: application/x-www-form-urlencoded" -d 'name=mychat room&announcement=&broadcasturl=xxxxxx&creator=zhangsan' 'https://api.netease.im/nimserver/chatroom/create.action'
Response
The data returned in the HTTP response is in JSON format.
json
"Content-Type": "application/json; charset=utf-8"
{
"chat room": {
"roomid": 66,
"valid": true,
"announcement": null,
"name": "mychat room",
"broadcasturl": "xxxxxx",
"ext": "",
"creator": "zhangsan"
},
"code": 200
}
Valid status codes
200、403、414、416、419、431、500
See Status codes .
Querying the chat room profile
Queries the chat room profile.
Request URL
httpPOST https://api.netease.im/nimserver/chatroom/get.action HTTP/1.1
Content-Type:application/x-www-form-urlencoded;charset=utf-8
For information about headers in the request, see Overview.
Parameters
Parameter | Type | Required | Description |
---|---|---|---|
roomid | long | Yes | Chat room ID |
needOnlineUserCount | String | No | Whether to return the number of online users, true or false, the default is false |
curl request example
curlcurl -X POST -H "CheckSum: fc040248923c881f2fe7cc39602b79565230155c" -H "AppKey: f1234540c12345673123456847aaaaaa" -H "Nonce: 1" -H "CurTime: 1451217360" -H "Content-Type: application/x-www-form-urlencoded" -d 'roomid=66&needOnlineUserCount=true' 'https://api.netease.im/nimserver/chatroom/get.action'
Response
The data returned in the HTTP response is in JSON format.
json"Content-Type": "application/json; charset=utf-8"
{
"chat room": {
"roomid": 66,
"valid": true,
"muted":false, //Whether the chat room is in the state of all muted, meaning only the administrator and owner can speak
"announcement": null,
"name": "mychat room",
"broadcasturl": "xxxxxx",
"onlineusercount": 1,
"ext": "",
"creator": "zhangsan",
"queuelevel": 0,
"ionotify": true // Whether chat room entry and leave notification is enabled
},
"code": 200
}
Valid status codes
200、403、404、414、416、431、500
See Status codes .
Query chat room profiles
Queries multiple chat room profiles at a time.
Request URL
httpPOST https://api.netease.im/nimserver/chatroom/getBatch.action HTTP/1.1
Content-Type:application/x-www-form-urlencoded;charset=utf-8
For information about headers in the request, see Overview.
Parameters
Parameter | Type | Required | Description |
---|---|---|---|
roomids | String | Yes | Multiple roomids in the format: ["6001","6002","6003"] (accid corresponding to JSONArray, parsing error results in code 414), limited to 20 roomids |
needOnlineUserCount | String | No | Whether to return the number of online users, true or false, the default is false |
curl request example
curlcurl -X POST -H "CheckSum: fc040248923c881f2fe7cc39602b79565230155c" -H "AppKey: f1234540c12345673123456847aaaaaa" -H "Nonce: 1" -H "CurTime: 1451217360" -H "Content-Type: application/x-www-form-urlencoded" -d 'roomids=["6001","6002","6003"]&needOnlineUserCount=true' 'https://api.netease.im/nimserver/chatroom/getBatch.action'
Response
The data returned in the HTTP response is in JSON format.
json"Content-Type": "application/json; charset=utf-8"
{
"noExistRooms": [//ID list of chat rooms that do not exist
6001
],
"succRooms": [
{
"roomid": 6002,
"valid": true,
"announcement": "hi,this is announcement",
"muted": false,
"name": "6002 chat room",
"broadcasturl": "",
"onlineusercount": 0,
"ext": "6002 ext",
"creator": "zhangsan",
"queuelevel": 0,
"ionotify": true // Whether chat room entry and leave notification is enabled
}
],
"failRooms": [//IDs of chat rooms that have failed, possible reasons include return of error code 500 in verification
6003
],
"code": 200
}
Valid status codes
200、403、404、414、416、431、500
See Status codes .
Updating chat room information
Updates a chat room profile.
Request URL
httpPOST https://api.netease.im/nimserver/chatroom/update.action HTTP/1.1
Content-Type:application/x-www-form-urlencoded;charset=utf-8
For information about headers in the request, see Overview.
Parameters
Parameter | Type | Required | Description |
---|---|---|---|
roomid | long | Yes | Chat room ID |
name | String | No | Chat room name, with up to 128 characters |
announcement | String | No | Announcement, with up to 4096 characters |
broadcasturl | String | No | Live streaming address, with up to 1024 characters |
ext | String | No | Extension field, the length of which is limited to 4096 characters |
needNotify | String | No | true or false, whether to send update notification events, the default is true |
notifyExt | String | No | Extension field of notification event, the length of which is limited to 2048 |
queuelevel | int | No | Queue management permission: 0: Everyone can modify the queue, 1: Only the anchor administrator can modify the queue. |
curl request example
curlcurl -X POST -H "CheckSum: 95a26060d002a473057a71cb7d949d6e91d6d167" -H "AppKey: f1234540c12345673123456847aaaaaa" -H "Nonce: 1" -H "CurTime: 1451214690" -H "Content-Type: application/x-www-form-urlencoded" -d 'roomid=66&name=mynewchat room&announcement=mynewchat room' 'https://api.netease.im/nimserver/chatroom/update.action'
Response
The data returned in the HTTP response is in JSON format.
json"Content-Type": "application/json; charset=utf-8"
{
"chat room": {
"roomid": 66,
"valid": true,
"announcement": "This is a chat room",
"name": "mychat room",
"broadcasturl": "xxxxxx",
"ext": "",
"creator": "zhangsan"
},
"code": 200
}
Valid status codes
200, 403, 404, 414, 416, 431, 500, 13002
See Status codes .
Changing the on/off status
Changes the on/off status of a chat room.
Request URL
httpPOST https://api.netease.im/nimserver/chatroom/toggleCloseStat.action HTTP/1.1
Content-Type:application/x-www-form-urlencoded;charset=utf-8
For information about headers in the request, see Overview.
Parameters
Parameter | Type | Required | Description |
---|---|---|---|
roomid | long | Yes | Chat room ID |
operator | String | Yes | Operator account, can only be operated by the creator |
valid | String | Yes | true or false, false: close chat room; true: open chat room |
curl request example
curlcurl -X POST -H "CheckSum: 95a26060d002a473057a71cb7d949d6e91d6d167" -H "AppKey: f1234540c12345673123456847aaaaaa" -H "Nonce: 1" -H "CurTime: 1451214690" -H "Content-Type: application/x-www-form-urlencoded" -d 'roomid=66&operator=zhangsan&valid=true' 'https://api.netease.im/nimserver/chatroom/toggleCloseStat.action'
Response
The data returned in the HTTP response is in JSON format.
json"Content-Type": "application/json; charset=utf-8"
{
"desc": {
"roomid": 13,
"valid": true,
"announcement": "This is a chat room",
"name": "myChat room",
"broadcasturl": "http://www.xxxx.com/xxxxxx",
"ext": "",
"creator": "zhangsan"
},
"code": 200
}
Valid status codes
200, 403, 404, 414, 416, 417, 419, 431, 500
See Status codes .
Setting user roles in the chat room
Sets user roles in the chat room.
Request URL
httpPOST https://api.netease.im/nimserver/chatroom/setMemberRole.action HTTP/1.1
Content-Type:application/x-www-form-urlencoded;charset=utf-8
For information about headers in the request, see Overview.
Parameters
Parameter | Type | Required | Description |
---|---|---|---|
roomid | long | Yes | Chat room ID |
operator | String | Yes | operator account accid |
target | String | Yes | account of the operated accid |
opt | int | Yes | operation: 1: Set as administrator, operator must be owner 2: set as normal user, the operator must be owner or administrator -1: set as blocklisted user, the operator must be owner or administrator -2: Set as muted user, operator must be owner or administrator |
optvalue | String | Yes | true or false, true: set; false: unset; After executing "unset", members not in the mute list or blocklist will become visitors |
notifyExt | String | No | Notification extension field, with a length limited to 2048, json format is recommended |
curl request example
curlcurl -X POST -H "CheckSum: 51eb13ea5ee3a2c00e8388e48e61c65c7866c366" -H "AppKey: fe416640c8e8a72734219e1847ad2547" -H "Nonce: 1" -H "CurTime: 1451207708" -H "Content-Type: application/x-www-form-urlencoded" -d 'roomid=66&operator=zhangsan&target=lisi&opt=2&optvalue=true' 'https://api.netease.im/nimserver/chatroom/setMemberRole.action'
Response
The data returned in the HTTP response is in JSON format.
json"Content-Type": "application/json; charset=utf-8"
{
"desc": {
"roomid": 16,
"level": 10,
"accid": "zhangsan",
"type": "COMMON"
},
"code": 200
}
Note:
The type field returned may be:
LIMITED, //restricted user, blocklist + mute
COMMON, //ordinary fixed member
CREATOR, //owner
administrator, // administrator
TEMPORARY, //temporary user, non-fixed member
Valid status codes
200, 403, 404, 414, 416, 417, 419, 431, 500, 13002
See Status codes .
Requesting the URL address of a chat room
Requests the URL address and token of a chat room.
Request URL
httpPOST https://api.netease.im/nimserver/chatroom/requestAddr.action HTTP/1.1
Content-Type:application/x-www-form-urlencoded;charset=utf-8
For information about headers in the request, see Overview.
Parameters
Parameter | Type | Required | Description |
---|---|---|---|
roomid | long | Yes | Chat room ID |
accid | String | Yes | Account of user joining chat room |
clienttype | int | No | 1: weblink (used if client is web); 2: commonlink (used if client is non-web); 3: wechatlink (for WeChat applet), the default is 1 |
clientip | String | No | Client ip, when this parameter is passed, an appropriate address will be returned based on the region of user ip |
curl request example
curlcurl -X POST -H "CheckSum: 51eb13ea5ee3a2c00e8388e48e61c65c7866c366" -H "AppKey: f1234540c12345673123456847aaaaaa" -H "Nonce: 1" -H "CurTime: 1451217708" -H "Content-Type: application/x-www-form-urlencoded" -d 'roomid=66&accid=zhangsan&clienttype=1' 'https://api.netease.im/nimserver/chatroom/requestAddr.action'
Response
The data returned in the HTTP response is in JSON format.
json"Content-Type": "application/json; charset=utf-8"
{
"addr": [
"testchat.netease.im:6666",
"testchat.netease.im:8888"
],
"code": 200
}
Valid status codes
200, 403, 414, 416, 431, 500, 514, 13002
See Status codes .
Sending messages
Request URL
httpPOST https://api.netease.im/nimserver/chatroom/sendMsg.action HTTP/1.1
Content-Type:application/x-www-form-urlencoded;charset=utf-8
For information about headers in the request, see Overview.
Send messages in the chat room
Parameters
Parameter | Type | Required | Description |
---|---|---|---|
roomid | long | Yes | Chat room ID |
msgId | String | Yes | client message id, using random strings such as uuid, messages with the same msgId will be deduplicated by the client |
fromAccid | String | Yes | Account of the message sender accid |
msgType | int | Yes | Message type: 0: indicates text message, 1: indicates image, 2: indicates audio, 3: indicates video, 4: indicates geographic location information, 6: indicates file, 10: indicates Tips message, 100: Custom message type (Special attention, for applications without activated GuardEase anti-spam feature, this type of message will not be submitted to anti-spam filtering) |
subType | int | No | Custom message subtype, greater than 0 |
resendFlag | int | No | Resend tag, 0: non-resend, 1: Resend. If the message is resent, deduplication logic check based on msgid will be performed |
attach | String | No | Text message: complete the message copy; For other types of messages, see message format example; Length limit is 4096 characters |
ext | String | No | Message extension field, the content can be customized, JSON format should be preferred, with a length limit of 4096 characters |
skipHistory | int | No | Whether to skip storing cloud history, 0: Don't skip, save the message history; 1: Skip, no history is saved on the cloud; the default is 0 |
abandonRatio | int | No | Optional, the probability of message abandonment. Value range [0-9999]; 0 indicates no message is abandoned, 9999 indicates 99.99% probability of abandoning the message, and 0 is the default; Note that if this parameter is not blank, the highPriority parameter below will be invalid; This parameter can be used to control the message flow of a specific service type. |
highPriority | Boolean | No | Optional, true indicates high-priority message, which will be given priority by CommsEase in terms of delivery; false indicates low-priority message. The default is false. It is strongly recommended to apply appropriate parameters to ensure the delivery of high-priority in-app messages when necessary. Only applying high priority equals no priority. A one-to-one chat room supports up to 10 high priority messages per second, and those in excess will be deemed as normal messages. High priority messages can be re-sent upon joining. See needHighPriorityMsgResend parameter |
needHighPriorityMsgResend | Boolean | No | Optional, true indicates that the message will be resent, and false indicates that the message will not be resent. The default is true. Note: If set to true, when the user rejoins the chat room after leaving, the message sent will still be received by the user, provided the validity period is not expired by then. The current default validity period is 30s. NeedHighPriorityMsgResend does not take effect if highPriority is not configured. |
useYiDun | int | No | Optional, whether to use GuardEase for anti-spam on a message, the optional value is 0. 0: (if GuardEase is activated) Do not use GuardEase for anti-spam but general anti-spam, custom messages included. No input in the field indicates by default that GuardEase anti-spam feature, if enabled on the app, will be used to distinguish spam messages |
yidunAntiCheating | String | No | Optional, a field exclusive to GuardEase anti-spam enhanced anti-cheating, limited to json with up to 1024 characters (For details, see GuardEase Anti-Spam interface document - exclusive field for anti-spam and anti-section-sweeping) |
bid | String | No | Optional, anti-spam service ID, used to implement "anti-spam configuration for a message", if left empty, then the original anti-spam configuration applies |
antispam | String | No | For applications with activated GuardEase antispam feature, specify if the message contents should go through GuardEase detection (antispamCustom)? true or false, the default is false. Only valid for messages of type: 100 custom message. |
notifyTargetTags | String | No | Optional, tag expression, up to 128 characters |
antispamCustom | String | No | It takes effect when the antispam parameter is set to true. User-defined anti-spam detection content, in JSON format, length is limited to 5000 characters (the same as body field). antispamCustom should be in the format as follows: {"type":1,"data":"custom content"} Field description: 1. type: 1: text, 2: image. 2. data: Text content or image address. |
env | String | No | Owning environment, depending on env, you can configure different message delivery for addresses |
curl request example
curlcurl -X POST -H "CheckSum: 51eb13ea5ee3a2c00e8388e48e61c65c7866c366" -H "AppKey: f541664055e557244421661866ad7799" -H "Nonce: 1" -H "CurTime: 1451207708" -H "Content-Type: application/x-www-form-urlencoded" -d 'roomid=36&fromAccid=zhangsan&msgType=0&attach=This+is+test+msg&msgId=c9e6c306-804f-4ec3-b8f0-573778829419' 'https://api.netease.im/nimserver/chatroom/sendMsg.action'
Response
The data returned in the HTTP response is in JSON format.
json
"Content-Type": "application/json; charset=utf-8"
{
"code":200,
"desc":{
"time": "1456396333115",
"fromAvator":"http://b12026.nos.netease.com/MTAxMTAxMA==/bmltYV84NDU4OF8xNDU1ODczMjA2NzUwX2QzNjkxMjI2LWY2NmQtNDQ3Ni0E2LTg4NGE4MDNmOGIwMQ==",
"msgid_client": "c9e6c306-804f-4ec3-b8f0-573778829419",
"fromClientType": "REST",
"attach": "This+is+test+msg",
"roomId": "36",
"fromAccount": "zhangsan",
"fromNick": "Zhang San",
"type": "0",
"ext": "",
"highPriorityFlag":1, //High priority message flag, not having this flag indicates non-high priority
"msgAbandonFlag":"1" //Flag for abandoning message, returned only when the abandonRatio parameter is passed. If this flag is not returned, it indicates the message is not abandoned.
}
}
Valid status codes
200, 403, 414, 416, 431, 500
See Status codes .
Adding a chatbot to the chat room
Adds a chatbot to the chat room. The chatbot expires in 24 hours.
Request URL
httpPOST https://api.netease.im/nimserver/chatroom/addRobot.action HTTP/1.1
Content-Type:application/x-www-form-urlencoded;charset=utf-8
For information about headers in the request, see Overview.
Parameters
Parameter | Type | Required | Description |
---|---|---|---|
roomid | long | Yes | Chat room ID |
accids | JSONArray | Yes | Accid list of robot accounts, which must be valid account, 100 accounts in maximum |
roleExt | String | No | Robot information extension field, recommended to be in json format with a length of 4096 characters |
notifyExt | String | No | Extension field for notification about robot joining the chat room, recommended to be in json format with a length of 2048 characters |
curl request example
curlcurl -X POST -H "CheckSum: 51eb13ea5ee3a2c00e8388e48e61c65c7866c366" -H "AppKey: f541664055e557244421661866ad7799" -H "Nonce: 1" -H "CurTime: 1451207708" -H "Content-Type: application/x-www-form-urlencoded" -d 'roomid=70&accids=["zhangsan","lisi"]' 'https://api.netease.im/nimserver/chatroom/addRobot.action'
Response
The data returned in the HTTP response is in JSON format.
json
"Content-Type": "application/json; charset=utf-8"
{
"desc": {
"failAccids": "[\"hzzhangsan\"]",
"successAccids": "[\"hzlisi\"]",
"oldAccids": "[\"hzwangwu\"]"
},
"code": 200
}
Valid status codes
200, 403, 414, 416, 417, 419, 431, 500, 13003
See Status codes .
Deleting a chatbot from the chat room
Deletes a chatbot from the chat room.
Request URL
httpPOST https://api.netease.im/nimserver/chatroom/removeRobot.action HTTP/1.1
Content-Type:application/x-www-form-urlencoded;charset=utf-8
For information about headers in the request, see Overview.
Parameters
Parameter | Type | Required | Description |
---|---|---|---|
roomid | long | Yes | Chat room ID |
accids | JSONArray | Yes | Accid list of robot accounts, which must be valid account, 100 accounts in maximum |
curl request example
curlcurl -X POST -H "CheckSum: 51eb13ea5ee3a2c00e8388e48e61c65c7866c366" -H "AppKey: f541664055e557244421661866ad7799" -H "Nonce: 1" -H "CurTime: 1451207708" -H "Content-Type: application/x-www-form-urlencoded" -d 'roomid=70&accids=["zhangsan","lisi"]' 'https://api.netease.im/nimserver/chatroom/removeRobot.action'
Response
The data returned in the HTTP response is in JSON format.
json
"Content-Type": "application/json; charset=utf-8"
{
"desc": {
"failAccids": "[\"hzzhangsan\"]",
"successAccids": "[\"hzlisi\"]"
},
"code": 200
}
Valid status codes
200, 403, 404, 414, 416, 419, 431, 500
See Status codes .
Deleting chatbots
Deletes all chatbots from a chat room.
Request URL
httpPOST https://api.netease.im/nimserver/chatroom/cleanRobot.action HTTP/1.1
Content-Type:application/x-www-form-urlencoded;charset=utf-8
For information about headers in the request, see Overview.
Parameters
Parameter | Type | Required | Description |
---|---|---|---|
roomid | long | Yes | Chat room ID |
notify | boolean | No | Whether to send the message of leave chat room notification, the default is false |
curl request example
curlcurl -X POST -H "CheckSum: 51eb13ea5ee3a2c00e8388e48e61c65c7866c366" -H "AppKey: f541664055e557244421661866ad7799" -H "Nonce: 1" -H "CurTime: 1451207708" -H "Content-Type: application/x-www-form-urlencoded" -d 'roomid=70¬ify=false' 'https://api.netease.im/nimserver/chatroom/cleanRobot.action'
Response
The data returned in the HTTP response is in JSON format.
json
"Content-Type": "application/json; charset=utf-8"
{
"code": 200,
"desc": {
"size": 2
}
}
Valid status codes
200, 403, 414, 416, 500
See Status codes .
Setting temporary mute status
Mutes the members in the chat room temporarily.
Request URL
httpPOST https://api.netease.im/nimserver/chatroom/temporaryMute.action HTTP/1.1
Content-Type:application/x-www-form-urlencoded;charset=utf-8
For information about headers in the request, see Overview.
Parameters
Parameter | Type | Required | Description |
---|---|---|---|
roomid | long | Yes | Chat room ID |
operator | String | Yes | Operator accid, must be administrator or creator |
target | String | Yes | Account accid of muted target |
muteDuration | long | Yes | 0: unmute; >0 set mute time (in seconds), max. 2592000 seconds (30 days) |
needNotify | String | No | Whether broadcast is needed upon completion of operation, true or false, the default is true |
notifyExt | String | No | The extension field of notification broadcast event, with a length limited to 2048 characters |
curl request example
curlcurl -X POST -H "CheckSum: 66dc1ad0166a37037abcdfeb749bhh049c937777" -H "AppKey: acd7y640c85j8kf734219e1847aggggg" -H "Nonce: 1" -H "CurTime: 1451200147" -H "Content-Type: application/x-www-form-urlencoded" -d 'roomid=123&operator=zhangsan&target=lisi&muteDuration=300¬ifyExt=This is an extension field' "https://api.netease.im/nimserver/chatroom/temporaryMute.action"
Response
The data returned in the HTTP response is in JSON format.
json
"Content-Type": "application/json; charset=utf-8"
{
"desc": {
"muteDuration": 300
},
"code": 200
}
Valid status codes
200, 403, 404, 414, 416, 417, 419, 431, 500, 13002
See Status codes .
Muting all members in the chat room
Mutes all members in the chat room. In this case, only the owner and administrator can send messages.
Request URL
httpPOST https://api.netease.im/nimserver/chatroom/muteRoom.action HTTP/1.1
Content-Type:application/x-www-form-urlencoded;charset=utf-8
For information about headers in the request, see Overview.
Parameters
Parameter | Type | Required | Description |
---|---|---|---|
roomid | long | Yes | Chat room ID |
operator | String | Yes | Operator accid, must be administrator or creator |
mute | String | Yes | true or false |
needNotify | String | No | true or false, the default is true |
notifyExt | String | No | Notification extension field |
curl request example
curlcurl -X POST -H "CheckSum: 32dc17d0190f37037abc9feb749bbf049c9367e7" -H "AppKey: fe416640c8e8a72734219e1847ad2547" -H "Nonce: 1" -H "CurTime: 1451200147" -H "Content-Type: application/x-www-form-urlencoded" -d 'roomid=4235&operator=zhangsan&mute=true' "https://api.netease.im/nimserver/chatroom/muteRoom.action"
Response
The data returned in the HTTP response is in JSON format.
json
"Content-Type": "application/json; charset=utf-8"
{
"desc": {
"success": true
},
"code": 200
}
Valid status codes
200, 403, 414, 416, 431, 500
See Status codes .
Querying TOP N indicators in a chat room
Request URL
httpPOST https://api.netease.im/nimserver/stats/chatroom/topn.action HTTP/1.1
Content-Type:application/x-www-form-urlencoded;charset=utf-8
For information about headers in the request, see Overview.
1. Top N list of chat room related indicators are listed by specified period based on timestamp
2. The statistics of the current day can be queried on the next day
3. Only statistics for the last 30 days can be queried
Parameters
Parameter | Type | Required | Description |
---|---|---|---|
topn | int | No | Top N value, in the range of 1~500, default is 100 |
timestamp | long | No | Time coordinate point of the index to be queried. If not provided, the current time is the default, in the unit of either second or millisecond |
period | String | No | Statistical period, optional values include hour/day, hour is the default |
orderby | String | No | Take the sort value, optional values include active/join/message, which indicates sort by daily activity, by entry person-time and by number of messages respectively, the default is active |
curl request example
curlcurl -X POST -H "CheckSum: 32dc17d0190f37037abc9feb749bbf049c9367e7" -H "AppKey: fe416640c8e8a72734219e1847ad2547" -H "Nonce: 1" -H "CurTime: 1451200147" -H "Content-Type: application/x-www-form-urlencoded" -d 'timestamp=1471781873&period=hour&topn=3&orderby=join' "https://api.netease.im/nimserver/stats/chatroom/topn.action"
Response
The data returned in the HTTP response is in JSON format.
json
"Content-Type": "application/json; charset=utf-8"
{
"code": 200,
"data": [
{
"activeNums": 5955, // number of active users in the chat room
"datetime": 1471712400, // The statistical time point, in seconds, should be 0:00 of the day for statistics by day; or the specified whole hour of the day for statistics by hour
"joinNums": 18621, // number of entry person-times
"msgs": 2793, //number of messages occurred in the chat room
"period": "HOUR", // Statistical period, HOUR indicates hourly statistics; DAY indicates daily statistics
"roomId": 3571337 // Chat room ID
},
{
"activeNums": 6047,
"datetime": 1471708800,
"joinNums": 15785,
"msgs": 2706,
"period": "HOUR",
"roomId": 3573737
},
{
"activeNums": 5498,
"datetime": 1471708800,
"joinNums": 14590,
"msgs": 2258,
"period": "HOUR",
"roomId": 3513774
}
]
}
Valid status codes
200, 403, 414, 416, 431, 500
See Status codes .
Getting a paginated list of members
Gets a paginated list of members
Request URL
httpPOST https://api.netease.im/nimserver/chatroom/membersByPage.action HTTP/1.1
Content-Type:application/x-www-form-urlencoded;charset=utf-8
For information about headers in the request, see Overview.
Parameters
Parameter | Type | Required | Description |
---|---|---|---|
roomid | long | Yes | Chat room ID |
type | int | Yes | Type of members to be queried, 0: fixed member; 1: non-fixed member; 2: on-line fixed member |
endtime | long | Yes | In milliseconds, the timestamp of the last member based on reverse chronological order, 0 represents current system time |
limit | long | Yes | Number of returned entries, <=100d> |
curl request example
curlcurl -X POST -H "CheckSum: 32dc17d0190f37037abc9feb749bbf049c9367e7" -H "AppKey: fe416640c8e8a72734219e1847ad2547" -H "Nonce: 1" -H "CurTime: 1451207708" -H "Content-Type: application/x-www-form-urlencoded" -d 'roomid=4235&type=0&endtime=0&limit=20' "https://api.netease.im/nimserver/chatroom/membersByPage.action"
Response
The data returned in the HTTP response is in JSON format.
json
"Content-Type": "application/json; charset=utf-8"
{
"desc": {
"data": [
{
"roomid": 111,
"accid": "abc",
"nick": "abc",
"avator": "http://nim.nos.netease.com/MTAxMTAwMg==/bmltYV8xNzg4NTA1NF8xNDU2Mjg0NDQ3MDcyX2E4NmYzNWI5LWRhYWEtNDRmNC05ZjU1LTJhMDUyMGE5MzQ4ZA==",
"ext": "ext",
"type": "administrator",
"level": 2,
"onlineStat": true,
"joinTime": 1487145487971,
"Blocklisted": true,
"muted": true,
"tempMuted": true,
"tempMuteTtl": 120,
"isRobot": true,
"robotExpirAt":120
}
]
},
"code": 200
}
Response
Field | Type | Description |
---|---|---|
roomid | long | Chat room ID |
accid | String | user accid |
nick | String | display name shown in a chat room |
avator | String | profile picture shown in a chat room |
ext | String | developer extension field |
type | String | Role type: UNSET (not set), LIMITED (restricted user, blocklisted or muted), COMMON (ordinary fixed member), owner (creator), administrator (administrator), TEMPORARY (temporary user, non-fixed member) |
level | int | Member level (absent if member level not set) |
onlineStat | Boolean | online or not. |
joinTime | long | Time point of joining a chat room |
Blocklisted | Boolean | Blocklisted or not (absent if not blocklisted) |
muted | Boolean | muted or not (absent if not muted) |
tempMuted | Boolean | temporarily muted or not (absent if not temporarily muted) |
tempMuteTtl | long | The duration of the temporary mute, in seconds (absent if not temporarily muted) |
isRobot | Boolean | Whether it is a chat room robot (absent if not a chatbot) |
robotExpirAt | int | The duration of robot failure, in seconds (absent if not a chatbot) |
200, 403, 414, 416, 431, 500
See Status codes .
Get mutiple online member profiles at a time
Gets online member profiles at a time.
Request URL
httpPOST https://api.netease.im/nimserver/chatroom/queryMembers.action HTTP/1.1
Content-Type:application/x-www-form-urlencoded;charset=utf-8
For information about headers in the request, see Overview.
Parameters
Parameter | Type | Required | Description |
---|---|---|---|
roomid | long | Yes | Chat room ID |
accids | JSONArray | Yes | \["abc","def"\], account list, with up to 200 entries |
curl request example
curlcurl -X POST -H "CheckSum: 32dc17d0190f37037abc9feb749bbf049c9367e7" -H "AppKey: fe416640c8e8a72734219e1847ad2547" -H "Nonce: 1" -H "CurTime: 1451207708" -H "Content-Type: application/x-www-form-urlencoded" -d 'roomid=4235&accids=["abc","def"]' "https://api.netease.im/nimserver/chatroom/queryMembers.action"
Response
The data returned in the HTTP response is in JSON format.
json
"Content-Type": "application/json; charset=utf-8"
{
"desc": {
"data": [
{
"roomid": 111,
"accid": "abc",
"nick": "cba",
"type": "CREATOR", //COMMON: ordinary members (fixed member); CREATOR: chat room creator; administrator: chat room administrator; TEMPORARY: temporary user (non-fixed member); ANONYMOUS: anonymous user (no registered account); LIMITED: Restricted user (blocklist + mute)
"onlineStat": true
}
]
},
"code": 200
}
Valid status codes
200, 403, 414, 416, 431, 500
See Status codes .
Changing user profiles in a chat room
Changes user profiles in a chat room.
Request URL
httpPOST https://api.netease.im/nimserver/chatroom/updateMyRoomRole.action HTTP/1.1
Content-Type:application/x-www-form-urlencoded;charset=utf-8
For information about headers in the request, see Overview.
Parameters
Parameter | Type | Required | Description |
---|---|---|---|
roomid | long | Yes | Chat room ID |
accid | String | Yes | accid requiring role information change |
save | boolean | No | Whether the changed information needs to be persisted, the default is false, which only takes effect for fixed members of the chat room |
needNotify | boolean | No | Whether notification is needed |
notifyExt | String | No | Notification content, with a length limit of 2048 |
nick | String | No | Chat room role information: profile name, with no more than 64 characters |
avator | String | No | Chat room role information: profile picture |
ext | String | No | Chat room role information: developer extension field |
curl request example
curlcurl -X POST -H "CheckSum: 51eb13ea5ee3a2c00e8388e48e61c65c7866c366" -H "AppKey: he516640c8e8a72734219eh847ad2547" -H "Nonce: 1" -H "CurTime: 1451207708" -H "Content-Type: application/x-www-form-urlencoded" -d 'roomid=36&accid=hzyangfeng201403&save=true&needNotify=true&nick=myNick' "https://api.netease.im/nimserver/chatroom/updateMyRoomRole.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, 431, 500
See Status codes .
Querying the list of chat rooms created by users
Updates multiple queue elements in a chat room at a time.
Request URL
httpPOST https://api.netease.im/nimserver/chatroom/queryUserRoomIds.action HTTP/1.1
Content-Type:application/x-www-form-urlencoded;charset=utf-8
For information about headers in the request, see Overview.
Parameters
Parameter | Type | Required | Description |
---|---|---|---|
creator | String | Yes | accid of Chat room creator |
curl request example
curlcurl -X POST -H 'appkey: fe416640c8e8a72734219e1847ad2547' -H 'cache-control: no-cache' -H 'checksum: 18f5435a7bf287af9150ad608797f75265495034' -H 'content-type: application/x-www-form-urlencoded' -H 'curtime: 1508481877' -H 'nonce: 12345' -d 'creator=xiaoming01' "https://api.netease.im/nimserver/chatroom/queryUserRoomIds.action"
Response
The data returned in the HTTP response is in JSON format.
json
"Content-Type": "application/json; charset=utf-8"
{
"code": 200,
"desc":{
"roomids": [
"1015",
"2016",
"2017",
"5062",
"23037398"
]
}
}
Valid status codes
200, 403, 414, 416, 431, 500
See Status codes .
Turning off notifications for joining or leaving specified chat rooms
Turns off notifications for joining or leaving specified chat rooms.
Request URL
httpPOST https://api.netease.im/nimserver/chatroom/updateInOutNotification.action HTTP/1.1
Content-Type:application/x-www-form-urlencoded;charset=utf-8
For information about headers in the request, see Overview.
Parameters
Parameter | Type | Required | Description |
---|---|---|---|
roomid | long | Yes | Chat room id |
close | boolean | Yes | true/false, whether to turn off entry and leave notifications |
curl request example
curlcurl -X POST -H 'appkey: fe416640c8e8a72734219e1847ad2547' -H 'cache-control: no-cache' -H 'checksum: 18f5435a7bf287af9150ad608797f75265495034' -H 'content-type: application/x-www-form-urlencoded' -H 'curtime: 1508481877' -H 'nonce: 12345' -d 'close=false&roomid=3001' "https://api.netease.im/nimserver/chatroom/updateInOutNotification.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, 500
See Status codes .
Muting members by tag
Mutes members by tag.
Request URL
httpPOST https://api.netease.im/nimserver/chatroom/tagTemporaryMute.action HTTP/1.1
Content-Type:application/x-www-form-urlencoded;charset=utf-8
For information about headers in the request, see Overview.
Parameters
Parameter | Type | Required | Description |
---|---|---|---|
roomid | long | Yes | Chat room id |
operator | string | Yes | Operator accid, must be owner or administrator |
targetTag | string | Yes | Target tag |
needNotify | boolean | No | true/false, whether to send notification about muting, the default is true |
notifyExt | string | No | Mute notification extension field |
muteDuration | int | Yes | Mute duration, in seconds, 30 days in maximum, if set to 0, then the mute is cancelled |
notifyTargetTags | string | No | Target tag expression of mute notification, if it is missing, the notification will be sent to the person who has set the targetTag |
curl request example
curlcurl -X POST -H 'appkey: fe416640c8e8a72734219e1847ad2547' -H 'cache-control: no-cache' -H 'checksum: 18f5435a7bf287af9150ad608797f75265495034' -H 'content-type: application/x-www-form-urlencoded' -H 'curtime: 1508481877' -H 'nonce: 12345' -d 'targetTag=abc&roomid=3001&operator=xxx&muteDuration=123' "https://api.netease.im/nimserver/chatroom/tagTemporaryMute.action"
Response
The data returned in the HTTP response is in JSON format.
json"Content-Type": "application/json; charset=utf-8"
{
"code": 200,
"desc": {
"muteDuration": 100 //mute duration, if mute is cancelled, then return the remaining duration of the last mute
}
}
Valid status codes
200, 403, 414, 416, 500
See Status codes .
Querying the number of online users by tag
Queries the number of online users under by tag. Note that the number of online users is counted as 1 for multiple logins with an account.
Request URL
httpPOST https://api.netease.im/nimserver/chatroom/tagMembersCount.action HTTP/1.1
Content-Type:application/x-www-form-urlencoded;charset=utf-8
For information about headers in the request, see Overview.
Parameters
Parameter | Type | Required | Description |
---|---|---|---|
roomid | long | Yes | Chat room id |
tag | string | Yes | Tag |
curl request example
curlcurl -X POST -H 'appkey: fe416640c8e8a72734219e1847ad2547' -H 'cache-control: no-cache' -H 'checksum: 18f5435a7bf287af9150ad608797f75265495034' -H 'content-type: application/x-www-form-urlencoded' -H 'curtime: 1508481877' -H 'nonce: 12345' -d 'tag=abc&roomid=3001' "https://api.netease.im/nimserver/chatroom/tagMembersCount.action"
Response
The data returned in the HTTP response is in JSON format.
json"Content-Type": "application/json; charset=utf-8"
{
"data": {
"tag": "abc",
"onlineUserCount":222
},
"code": 200
}
Valid status codes
200, 403, 414, 416, 500
See Status codes .
Querying online member list by tag
Queries online member list by tag. Note that multiple records will be returned with multi-client login.
Request URL
httpPOST https://api.netease.im/nimserver/chatroom/tagMembersQuery.action HTTP/1.1
Content-Type:application/x-www-form-urlencoded;charset=utf-8
For information about headers in the request, see Overview.
Parameters
Parameter | Type | Required | Description |
---|---|---|---|
roomid | long | Yes | Chat room id |
tag | string | Yes | Tag |
endTime | long | Yes | Start time, searched in reverse order, if 0 is passed, then search starts from the current time forward |
limit | int | Yes | Number of entries, 100 in maximum |
curl request example
curlcurl -X POST -H 'appkey: fe416640c8e8a72734219e1847ad2547' -H 'cache-control: no-cache' -H 'checksum: 18f5435a7bf287af9150ad608797f75265495034' -H 'content-type: application/x-www-form-urlencoded' -H 'curtime: 1508481877' -H 'nonce: 12345' -d 'tag=abc&roomid=3001&endTime=0&limit=100' "https://api.netease.im/nimserver/chatroom/tagMembersQuery.action"
Response
The data returned in the HTTP response is in JSON format.
json"Content-Type": "application/json; charset=utf-8"
{
"desc": {
"data": [
{
"roomid": 111,
"accid": "abc",
"nick": "zlw",
"avator": "http://nim.nos.netease.com/MTAxMTAwMg==xxx==",
"ext": "ext",
"type": "administrator",
"level": 2,
"onlineStat": true,
"joinTime": "1487145487971",
"Blocklisted": true,
"muted": true,
"tempMuted": true,
"tempMuteTtl": 120,
"isRobot": true,
"robotExpirAt": 120,
"tags": "aaa",
"notifyTargetTags": "{\"tag\": \"abc\"} and {\"tag\": \"def\"}"
}
]
},
"code": 200
}
Valid status codes
200, 403, 414, 416, 500
See Status codes .