API Servers

The system provides two API servers for external communication. This page documents their systemd service configuration on Linux systems (Google Cloud Platform and Raspberry Pi).

Note

For new external partner integrations, use the FastAPI REST API Bridge instead of Twisted. See FastAPI for details.


FastAPI REST API Bridge Server

Modern REST API server for external partner integrations. Runs on port 8001 (internal) and is exposed via Apache at /api path.

Service Configuration:

Service file: /etc/systemd/system/odoo-api-bridge.service

The service is automatically created by the installation script scripts/install_api_bridge.sh from the odoo_xmlrpc_twisted repository.

Example configuration:

[Unit]
Description=Odoo API Bridge FastAPI Server
After=network.target
Wants=network.target

[Service]
Type=exec
User=odooapi
Group=odooapi
WorkingDirectory=/usr/local/logistics/Python/repo/odoo_xmlrpc_twisted
Environment=PATH=/usr/local/logistics/Python/venv/odoo_xmlrpc_twisted/bin
Environment=PYTHONPATH=/usr/local/logistics/Python/repo/odoo_xmlrpc_twisted
Environment=ENVIRONMENT=production
ExecStart=/usr/local/logistics/Python/venv/odoo_xmlrpc_twisted/bin/uvicorn odoo_bridge_secure:app --host 127.0.0.1 --port 8001 --workers 2
ExecReload=/bin/kill -HUP $MAINPID
Restart=always
RestartSec=5

[Install]
WantedBy=multi-user.target

Service Management:

Enable the service to start at boot:

sudo systemctl enable odoo-api-bridge

Start the service:

sudo systemctl start odoo-api-bridge

Stop the service:

sudo systemctl stop odoo-api-bridge

Check service status:

sudo systemctl status odoo-api-bridge

View logs:

sudo journalctl -u odoo-api-bridge -f

For complete installation and configuration: See FastAPI


Twisted XMLRPC Server (Legacy)

Legacy XMLRPC server for existing integrations. According to the following description a service has been created for Twisted Server. The description both includes Google Cloud Platform and Raspberry Pi.

  1. twisted-server.service

    Script``twisted-server.service`` installed in directory /etc/systemd/system/. Script starts the Django Server on Debian Linux.

    Example of the script twisted-server.service:

    sudo nano /etc/systemd/system/twisted-server.service
    

    Content:

    [Unit]
    Description=Handling of the Twisted Server
    After=multi-user.target
    
    [Service]
    Type=simple
    ExecStart=/usr/local/logistics/Python/venv/odoo_xmlrpc_twisted/bin/python3 /usr/local/logistics/Python/repo/odoo_xmlrpc_twisted/Twisted.py
    Restart=on-abort
    
    [Install]
    WantedBy=multi-user.target
    

  1. Start and Stop of the Server

    Reload Systemd to read the new service unit file:

    sudo systemctl daemon-reload
    

    Enable the service to start at boot:

    sudo systemctl enable twisted-server
    

    Start of the Server

    sudo systemctl start twisted-server
    

    Stop of the Server

    sudo systemctl stop twisted-server
    

    Status of the Server

    sudo systemctl status twisted-server