3CX WebAPI uninstall

Created by Oleg Agapov, Modified on Mon, 24 Mar at 8:45 AM by Oleg Agapov

1. Debian


It is necessary to stop and delete webapi daemon and delete /var/ww/webapi folder.


#!/bin/bash

# Checking the required access rights
if [[ $EUID -ne 0 ]]; then
   echo "Run as a root."
   exit 1
fi

SERVICE_NAME="webapi"
WEBAPI_DIR="/var/www/webapi"

echo "Stopping and deleting systemd-сервиса $SERVICE_NAME..."

# Stopping daemon
systemctl stop $SERVICE_NAME

# Disabling autorun
systemctl disable $SERVICE_NAME

# Deleting webapi service
SERVICE_FILE="/etc/systemd/system/${SERVICE_NAME}.service"
if [ -f "$SERVICE_FILE" ]; then
    rm "$SERVICE_FILE"
    echo "File systemd-service deleted."
else
    echo "File systemd-service not found."
fi

# Restart systemd
systemctl daemon-reload
systemctl reset-failed

echo "Deleting folder $WEBAPI_DIR..."
rm -rf "$WEBAPI_DIR"

echo "Done"
Generic



2. Windows


It is necessary to stop and delete webapi windows service and delete C:\Program Files\3CX Phone System\Bin\webapi


@echo off
setlocal

REM Name of the Windows service to delete
set SERVICE_NAME=webapi

REM Check if running with administrator privileges
net session >nul 2>&1
if %errorLevel% NEQ 0 (
    echo Please run this script as Administrator.
    pause
    exit /b 1
)

REM Stop the service if it's running
echo Stopping service %SERVICE_NAME%...
sc stop %SERVICE_NAME% >nul 2>&1

REM Wait a few seconds to ensure the service is stopped
timeout /t 3 /nobreak >nul

REM Delete the service
echo Deleting service %SERVICE_NAME%...
sc delete %SERVICE_NAME%

echo Done. The service %SERVICE_NAME% has been removed.
pause
endlocal
Generic

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article