- Модуль: im
- Путь к файлу: ~/bitrix/modules/im/classes/general/im_rest.php
- Класс: CIMRestService
- Вызов: CIMRestService::messageDelete
static function messageDelete($arParams, $n, CRestServer $server)
{
$arParams = array_change_key_case($arParams, CASE_UPPER);
if (isset($arParams['MESSAGE_ID']))
{
$arParams['ID'] = $arParams['MESSAGE_ID'];
}
$arParams['ID'] = intval($arParams['ID']);
if ($arParams['ID'] <= 0)
{
throw new BitrixRestRestException("Message ID can't be empty", "MESSAGE_ID_ERROR", CRestServer::STATUS_WRONG_REQUEST);
}
$res = CIMMessenger::Delete($arParams['ID']);
if (!$res)
{
throw new BitrixRestRestException("Time has expired for modification or you don't have access", "CANT_EDIT_MESSAGE", CRestServer::STATUS_FORBIDDEN);
}
return true;
}