Delete a message

Update time: 2022/12/09 08:01:39

Delete a message.

Rate limit

  • Apps can call the API by 10 times per minute. If an app calls the API exceeding the limit, requests from the app will be blocked for 10 seconds before the API become available again.

Request URL

httpPOST http://api.netease.im/nimserver/msg/delMsg.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
deleteMsgid String Yes ID of the message to be deleted.
timetag Long Yes The creation time of the message to be deleted ( the time returned by the CommsEase server when the message is delivered)
type int Yes Only 7 or 8 are valid. 7: P2P message; 8: group message. Other values are invalid.
from String Yes CommsEase IM account of the sender(accid)
to String Yes If a P2P message is deleted, the recipient IM account(accid) is required. If a group message is deleted, the group ID(tid) is required.

Example

cURL request

httpcurl -X POST -H "AppKey: go9dnk49bkd9jd9vmel1kglw0803mgq3" -H "Nonce: 4tgggergigwow323t23t" -H "CurTime: 1443592222" -H "CheckSum: 9e9db3b6c9abb2e1962cf3e6f7316fcc55583f86" -H "Content-Type: application/x-www-form-urlencoded" -d 'deleteMsgid=10386192&timetag=1481528155741&type=7&from=t1&to=t4'  'https://api.netease.im/nimserver/msg/delMsg.action'

Example success response

http"Content-Type": "application/json; charset=utf-8"
{
    "code": 200
}

Example error response

json"Content-Type": "application/json; charset=utf-8"
{
    "code": 414
    "desc": "illegal type!"  // invalid type value
}

Status codes

The following status codes are related to responses of this API. For more status codes, see Status codes.

Code Description Recommendation
200 Success -
403 Possible reasons for a failed request:
  • Authentication failed
  • The message cannot be recalled.
Handle the error based on the specific message.
414 Parameter error Check the format and restrictions of arguments based on the error message.
416 Too many requests Lower the number of requests within a period of time.
500 Internal Server Error -
Was this page helpful?
Yes
No
  • Rate limit
  • Request URL
  • Request parameters
  • Example
  • cURL request
  • Example success response
  • Example error response
  • Status codes