Перейти к содержимому

Multiple Database Support In API Framework Of Odoo

Module For Multiple Database


Multiple Database Support Using api_header_db Module.

To enable multiple database selection in your API, use the api_header_db module provided to you. Follow the steps below for configuration and usage. 

Configuration Steps


a. Enable the Module

Add the api_header_db module to the server_wide_modules parameter in your Odoo configuration file (odoo.conf).

Example: server_wide_modules = base,web,api_header_db

b. Restart the Server

Once the configuration change is done, restart the Odoo server to apply the update.

Specifying the Database for API Requests


After the module is enabled, the target database can be specified in an API request using either of the following methods:

Option 1: Query Parameter

Include db or database as a query parameter in the request URL.

Example: /api/endpoint?db=my_database

Option 2: Request Header

Send db or database as a header in the API request.
Example: db: my_database


Summary

By enabling the api_header_db module and specifying the database through query parameters or request headers, API can seamlessly support multi-database environments