Skip to Content
Odoo Menu
  • Prijavi
  • Try it free
  • Aplikacije
    Finance
    • Knjigovodstvo
    • Obračun
    • Stroški
    • Spreadsheet (BI)
    • Dokumenti
    • Podpisovanje
    Prodaja
    • CRM
    • Prodaja
    • POS Shop
    • POS Restaurant
    • Naročnine
    • Najem
    Spletne strani
    • Website Builder
    • Spletna trgovina
    • Blog
    • Forum
    • Pogovor v živo
    • eUčenje
    Dobavna veriga
    • Zaloga
    • Proizvodnja
    • PLM
    • Nabava
    • Vzdrževanje
    • Kakovost
    Kadri
    • Kadri
    • Kadrovanje
    • Odsotnost
    • Ocenjevanja
    • Priporočila
    • Vozni park
    Marketing
    • Družbeno Trženje
    • Email Marketing
    • SMS Marketing
    • Dogodki
    • Avtomatizacija trženja
    • Ankete
    Storitve
    • Projekt
    • Časovnice
    • Storitve na terenu
    • Služba za pomoč
    • Načrtovanje
    • Termini
    Produktivnost
    • Razprave
    • Odobritve
    • IoT
    • Voip
    • Znanje
    • WhatsApp
    Third party apps Odoo Studio Odoo Cloud Platform
  • Industrije
    Trgovina na drobno
    • Book Store
    • Trgovina z oblačili
    • Trgovina s pohištvom
    • Grocery Store
    • Trgovina s strojno opremo računalnikov
    • Trgovina z igračami
    Food & Hospitality
    • Bar and Pub
    • Restavracija
    • Hitra hrana
    • Guest House
    • Beverage Distributor
    • Hotel
    Nepremičnine
    • Real Estate Agency
    • Arhitekturno podjetje
    • Gradbeništvo
    • Estate Management
    • Vrtnarjenje
    • Združenje lastnikov nepremičnin
    Svetovanje
    • Računovodsko podjetje
    • Odoo Partner
    • Marketinška agencija
    • Law firm
    • Pridobivanje talentov
    • Audit & Certification
    Proizvodnja
    • Tekstil
    • Metal
    • Pohištvo
    • Hrana
    • Brewery
    • Poslovna darila
    Health & Fitness
    • Športni klub
    • Trgovina z očali
    • Fitnes center
    • Wellness Practitioners
    • Lekarna
    • Frizerski salon
    Trades
    • Handyman
    • IT Hardware & Support
    • Sistemi sončne energije
    • Izdelovalec čevljev
    • Čistilne storitve
    • HVAC Services
    Ostali
    • Neprofitna organizacija
    • Agencija za okolje
    • Najem oglasnih panojev
    • Fotografija
    • Najem koles
    • Prodajalec programske opreme
    Browse all Industries
  • Skupnost
    Learn
    • Tutorials
    • Dokumentacija
    • Certifikati
    • Šolanje
    • Blog
    • Podcast
    Empower Education
    • Education Program
    • Scale Up! Business Game
    • Visit Odoo
    Get the Software
    • Prenesi
    • Compare Editions
    • Releases
    Collaborate
    • Github
    • Forum
    • Dogodki
    • Prevodi
    • Become a Partner
    • Services for Partners
    • Register your Accounting Firm
    Get Services
    • Find a Partner
    • Find an Accountant
    • Meet an advisor
    • Implementation Services
    • Sklici kupca
    • Podpora
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Get a demo
  • Določanje cen
  • Pomoč

Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:

  • CRM
  • e-Commerce
  • Knjigovodstvo
  • Zaloga
  • PoS
  • Projekt
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Ključne besede (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Ključne besede (View all)
odoo accounting v14 pos v15
About this forum
Pomoč

Odoo custom API module not working in hosted version

Naroči se

Get notified when there's activity on this post

This question has been flagged
addonsapiv18
1 Odgovori
3330 Prikazi
Avatar
Shalitha Wanasinghe

I have created custom API module for odoo 18. My endpoint REST APIs are working fine in local version. But when I try to use it in the hosted version it gives 404 error.




0
Avatar
Opusti
Avatar
Gracious Joseph
Best Answer

When your custom API module works in your local Odoo instance but gives a 404 error on the hosted version, it indicates that the hosted environment may not be configured to load your custom module or that there are deployment-specific issues. Here are steps to diagnose and resolve this issue:

1. Verify Module Installation on Hosted Version

Ensure your custom API module is installed and available on the hosted instance:

  • Check Installed Modules:
    • Go to Apps and ensure your module is listed as installed.
  • Install/Upgrade Your Module:
    • If not installed, install it via the Apps menu or run:
      bashCopy codepython3 odoo-bin -u <your_module_name> -c /etc/odoo/odoo.conf
      

2. Check the API Endpoint Configuration

  • Verify Endpoint Routing: Ensure your custom endpoints are defined correctly in your controllers file and are accessible in the hosted environment.
    Example:
    pythonCopy codefrom odoo import http
    
    class MyAPIController(http.Controller):
        @http.route('/my_api/endpoint', type='json', auth='public', methods=['POST'], csrf=False)
        def my_api_method(self, **kwargs):
            return {'message': 'API is working!'}
    
  • Test Endpoint in Hosted Version: Use a tool like curl or Postman to test the endpoint directly:
    bashCopy codecurl -X POST https://your-hosted-instance.com/my_api/endpoint -d '{}'
    

3. Verify Server Logs

  • Check Logs for Clues: Look for errors in the Odoo log file (/var/log/odoo/odoo.log or equivalent) when the 404 error occurs.
    Key things to look for:
    • Errors related to module loading.
    • Missing or unregistered routes.
    You can filter logs for your module:
    bashCopy codegrep '<your_module_name>' /var/log/odoo/odoo.log
    

4. Inspect Hosted Environment Configuration

  • Custom Module Deployment: Ensure the custom module is properly uploaded to the hosted instance. Verify:
    • The module is in the addons directory or an equivalent path.
    • The path to your custom module is listed in the addons_path of the Odoo configuration file.
    Example of a valid addons_path:
    iniCopy codeaddons_path = /usr/lib/python3/dist-packages/odoo/addons,/opt/odoo/custom_addons
    
  • Restart Odoo Server: If you recently added or updated the module, ensure the server is restarted:
    bashCopy codesudo service odoo restart
    

5. Verify Access Control and Authentication

  • Authentication Requirements: If your API requires authentication, ensure the credentials used in the hosted version are correct.
    • If using auth='public', ensure the endpoint doesn't have unnecessary restrictions.
    • For authenticated endpoints, verify the Authorization header is included in requests.
  • Cross-Origin Resource Sharing (CORS): If accessing the API from a different domain, ensure the hosted instance has proper CORS settings.

6. Firewall or Proxy Issues

  • Firewall Rules: Ensure that the hosted environment allows traffic on the required port (usually 8069 for Odoo).
  • Reverse Proxy Configuration: If using a reverse proxy (e.g., Nginx), ensure it forwards requests to your custom API correctly. Update the proxy configuration if necessary.
    Example Nginx configuration for API:
    nginxCopy codelocation /my_api/ {
        proxy_pass http://127.0.0.1:8069/my_api/;
    }
    

7. Debugging in Hosted Environment

  • Enable Debug Mode: Temporarily enable debug mode to inspect if your module routes are loaded:
    bashCopy codepython3 odoo-bin -c /etc/odoo/odoo.conf --dev=all
    
  • Test All Routes: Use Odoo's route debugging to check if your custom route is registered:
    • Access /web/environment/routes to see all loaded routes.

8. Redeploy the Module

If the issue persists, re-upload and reinstall your module:

  • Remove the existing module from the addons path.
  • Re-upload the module folder to the appropriate addons_path.
  • Restart the Odoo server and reinstall the module.

9. Host Provider Limitations

If your Odoo instance is on a hosted SaaS platform (e.g., Odoo Online), it may restrict custom module usage or require specific deployment steps. Contact your hosting provider to confirm:

  • If custom modules are supported.
  • The process to deploy custom modules in their environment.

Summary Checklist

  1. Ensure your module is installed and accessible in the hosted instance.
  2. Verify the API endpoint configuration in your module.
  3. Check server logs for routing or deployment errors.
  4. Confirm the module is in the addons_path.
  5. Restart the Odoo server after module changes.
  6. Ensure the hosted instance allows traffic to your API endpoint.
  7. Confirm with the hosting provider for any restrictions on custom modules.

0
Avatar
Opusti
Enjoying the discussion? Don't just read, join in!

Create an account today to enjoy exclusive features and engage with our awesome community!

Prijavi
Related Posts Odgovori Prikazi Aktivnost
Custom Code: REST API: Subscriptions Name Change
api sales_order Subscriptions v18
Avatar
Avatar
1
mar. 25
1582
Is it possible to sell on credit directly at the point of sale and leave the order pending payment?
v18
Avatar
Avatar
2
sep. 25
681
Odoo isn't seeing an add-on that I downloaded and placed in the addons folder Solved
addons
Avatar
Avatar
Avatar
Avatar
Avatar
5
okt. 25
2344
Has anyone integrated Helpdesk with Zoom for meeting scheduling?
api
Avatar
Avatar
1
avg. 25
1288
ADD ON FINANCIAL MODULE/FISCALE ACCOUNTING FOR ODOO 18 COMMUNITY
addons
Avatar
Avatar
Avatar
2
avg. 25
1706
Community
  • Tutorials
  • Dokumentacija
  • Forum
Open Source
  • Prenesi
  • Github
  • Runbot
  • Prevodi
Services
  • Odoo.sh Hosting
  • Podpora
  • Nadgradnja
  • Custom Developments
  • Izobraževanje
  • Find an Accountant
  • Find a Partner
  • Become a Partner
About us
  • Our company
  • Sredstva blagovne znamke
  • Kontakt
  • Zaposlitve
  • Dogodki
  • Podcast
  • Blog
  • Stranke
  • Pravno • Zasebnost
  • Varnost
الْعَرَبيّة Català 简体中文 繁體中文 (台灣) Čeština Dansk Nederlands English Suomi Français Deutsch हिंदी Bahasa Indonesia Italiano 日本語 한국어 (KR) Lietuvių kalba Język polski Português (BR) română русский язык Slovenský jazyk slovenščina Español (América Latina) Español ภาษาไทย Türkçe українська Tiếng Việt

Odoo is a suite of open source business apps that cover all your company needs: CRM, eCommerce, accounting, inventory, point of sale, project management, etc.

Odoo's unique value proposition is to be at the same time very easy to use and fully integrated.

Website made with

Odoo Experience on YouTube

1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.

Live support on Youtube
Watch now