Odoo 19 introduces a significant modernization of its external API, marking a crucial step forward in enhancing security, standardization, and developer experience. The legacy XML-RPC and JSON-RPC endpoints are being deprecated in favor of the new JSON-RPC 2.0 API.
The End of XML-RPC and Legacy JSON-RPC
The traditional XML-RPC and older JSON-RPC endpoints have served the Odoo community for years, but they come with limitations in terms of security and flexibility. The new JSON-RPC 2.0 API addresses these shortcomings, offering a more robust and standardized interface for interacting with Odoo.
"The adoption of JSON-RPC 2.0 represents a significant step towards a more secure and efficient Odoo ecosystem."
Removal Timeline
Odoo has outlined a clear timeline for the removal of the legacy APIs:
- Odoo Online 21.1 (Winter 2027): XML-RPC and legacy JSON-RPC will be removed from Odoo Online.
- Odoo Enterprise 22 (Fall 2028): The deprecation will be completed with the release of Odoo Enterprise 22.
Security Improvements and Standardization
The new JSON-RPC 2.0 API brings several security enhancements and standardization improvements:
- Enhanced security through better authentication mechanisms and error handling.
- Improved standardization, making it easier for developers to work across different versions of Odoo.
- Simplified and more consistent API endpoints.
Migrating to JSON-RPC 2.0: A Step-by-Step Guide
To assist developers in transitioning to the new API, Odoo provides a comprehensive migration guide and tools. Here’s a basic example of refactoring Python code to use the new JSON-RPC 2.0 endpoint:
import jsonrpcclient
# Old XML-RPC
url = "https://example.odoo.com"
common = xmlrpc.client.ServerProxy('{}/xmlrpc/2/common'.format(url))
# New JSON-RPC 2.0
url = "https://example.odoo.com/odoo"
common = jsonrpcclient.ServerProxy(url)
Developers are encouraged to start migrating their applications to the new JSON-RPC 2.0 API to ensure compatibility with future Odoo releases.