Delete a roaming message

Update time: 2022/12/09 08:17:38

Overview

Delete roaming messages by session type (P2P chat or group chat)

Rate limit

The API can be called by 100 times per second for each app. 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 https://api.netease.im/nimserver/msg/delRoamSession.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:

ParameterTypeRequiredDescription
type int Yes Session type, 1: P2P chat session, 2: group chat session. Other values return 414 code.
from StringYes IM account (accid) of the sender. Up to 32 characters are allowed.
toStringYes Recipient. If type=1, pass the IM account of the recipient (accid). If type=2, pass the group ID (tid)

Example

cURL request

curlcurl -X POST -H "AppKey: go9dnk49bkd9jd9vmel1kglw0803mgq3" -H "Nonce: 4tgggergigwow323t23t" -H "CurTime: 1443592222" -H "CheckSum: 9e9db3b6c9abb2e1962cf3e6f7316fcc55583f86" -H "Content-Type: application/x-www-form-urlencoded" -d 'type=2&from=cs4&to=2775725369' 'https://api.netease.im/nimserver/msg/delRoamSession.action'

Example success response

HTTP response in JSON

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

Example error response

json"Content-Type": "application/json; charset=utf-8"
{
    "code": 414,
    "desc": "type must be 1 or 2"  // type is invalid
}

Status code

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

Status code Description Recommendation
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.
500 Internal Server Error -
Was this page helpful?
Yes
No
  • Overview
  • Rate limit
  • Request URL
  • Request parameters
  • Example
  • cURL request
  • Example success response
  • Example error response
  • Status code