Mute an account in modules
Update time: 2023/10/24 06:44:15
Mute or unmute chat in a specific module.
Overview
Mute or unmute chats in P2P chat module, team chat module, or chat room module.
If an account is muted in a module, the user cannot send messages in the module. Sending messages will return a 423 error code. However, the user can still receive messages and send custom system notifications.
API rate limit
- Apps can call the API by 100 times per second. If API calls exceeds the rate limit, requests from the app will be blocked for 10 seconds before the API become available again.
Request URI
bashPOST https://api-sg.netease.im/nimserver/user/muteModule.action HTTP/1.1
Content-Type: application/x-www-form-urlencoded;charset=utf-8
Request parameters
-
For information about how to set the header in a POST request, see API Call methods.
-
The settings of the body in a POST request:
Parameter | Type | Required | Description |
---|---|---|---|
accid | String | Yes | user account, up to 32 characters. |
muteP2P | Boolean | No | Whether to mute the account in the private chat module true: mute the account, false : unmute the account. |
muteTeam | Boolean | No | Whether to mute the account in the group chat module true: mute the account, false : unmute the account. |
muteRoom | Boolean | No | Whether to mute the account in the chat room module true: mute the account, false : unmute the account. |
muteQChat | Boolean | No | Whether to mute the account in the QChat module true: mute the account, false : unmute the account. |
- The parameters
muteP2P
,muteTeam
,muteRoom
, andmuteQChat
are all optional. However, you must at least specify one parameter, otherwise a 414 error will be reported. - It is preferred you specify values for all options when calling this API and indicate the account's mute status in each module.
Response fields
Field | Description |
---|---|
code | HTTP status code, 200 means the request is successful. |
data | User’s mute status in each module |
data
representation
Field | Description |
---|---|
muteP2P | Mute status in the private chat module |
muteTeam | Mute status in the group chat module |
muteRoom | Mute status in the chat room module |
muteQChat | Mute status in the QChat module |
Examples
Sample request (cURL)
curlcurl -X POST -H "AppKey: go9dnk4***803mgq3" -H "Nonce: 4tgg**23t23t" -H "CurTime: 1443592222" -H "CheckSum: 9e9db3b6c9abb2e1962cf3e6f7316fcc55583f86" -H "Content-Type: application/x-www-form-urlencoded" -d 'accid=123123&muteP2P=true' 'https://api.netease.im/nimserver/nimserver/user/muteModule.action'
Sample success response
json"Content-Type": "application/json; charset=utf-8"
{
"code":200
"data":{
"muteP2P": false,
"muteTeam": true,
"muteRoom": false,
"muteQChat": false
}
}
Sample error response
json"Content-Type": "application/json; charset=utf-8"
{
"code":414
"desc":"missing required parameter" // No mute status is specified.
}
Status codes
The following status codes are related to responses of this API. For more status codes, see Status codes.
Status code | Description | Recommendation |
---|---|---|
200 | Success | - |
414 | Parameter error | Check the format and restrictions of arguments based on the error message. |
500 | Internal Server Error | - |
Was this page helpful?