| Availability |
Odoo Online
Odoo.sh
On Premise
|
| Lines of code | 972 |
| Technical Name |
odoo_rpc_to_json_2 |
| License | LGPL-3 |
| Website | https://www.carreres.es/ |
| Versions | 16.0 17.0 18.0 |
| Availability |
Odoo Online
Odoo.sh
On Premise
|
| Lines of code | 972 |
| Technical Name |
odoo_rpc_to_json_2 |
| License | LGPL-3 |
| Website | https://www.carreres.es/ |
| Versions | 16.0 17.0 18.0 |
JSON/2 API — Odoo 19 Compatibility Layer
Bring the power of Odoo 19’s modern API to your current Odoo 16, 17, or 18 instance — without migrating.
With the arrival of Odoo 19, the legacy XML-RPC protocol is formally replaced by the modern,
high-performance JSON/2 API. This industrial-grade bridge module lets your existing Odoo
instance expose the exact same endpoints — /json/2/<model>/<method>
and /jsonrpc2 — so your integrations work today and keep working after the upgrade.
Why choose this module?
Enterprise-Grade Security
Bearer token validation using timing-safe hmac.compare_digest. Keys are stored as SHA-256 hashes — never in plain text. Optional expiration dates for every key.
Dual Endpoint Support
RESTful /json/2/ interface (Odoo 19 native) and the classic /jsonrpc2 envelope. One module, total compatibility with every integrator and automation script.
Audit Logs & Debugging
Every API call is automatically logged: client IP, user, duration in milliseconds, HTTP status, and full error traceback. Debug integrations without touching the server console.
Centralized Key Management
Manage all external API access from a single, clean panel inside Odoo. Each key is associated with an Odoo user, inheriting their access control rules natively — no extra configuration needed.
- Full administrative control over who can access the API.
- Real-time Active / Archived status per key.
- Automatic expiration date support.
Works with Any HTTP Client
Test the API instantly from Postman, Insomnia, curl, or any HTTP client. The screenshot shows a live call to /json/2/res.users/search_read returning a 200 OK in 25 ms — authenticated with a Bearer token and the X-Odoo-Database header.
- Standard HTTP — no proprietary SDK needed.
- Compatible with Postman, curl, Python, Node.js…
- JSON response, standard HTTP status codes.
Logs & Real-Time Debugging
Shopify sync failing? Amazon connector throwing errors? The API Logs view records every incoming call with surgical precision — client IP, response time (ms), ORM method called, and the exact error traceback.
- Client IP tracking per request.
- Millisecond-precision duration logs.
- Full error trace in developer mode.
Quick Start
# 2. Call the REST endpoint (Odoo 19-style):
curl -X POST https://your-odoo.com/json/2/res.partner/search_read \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "X-Odoo-Database: your-db" \
-H "Content-Type: application/json" \
-d '{"domain": [], "fields": ["name","email"], "limit": 5}'
# 3. Or use the classic JSON-RPC 2.0 envelope:
curl -X POST https://your-odoo.com/jsonrpc2 \
-H "Authorization: Bearer YOUR_API_KEY" \
-d '{"jsonrpc":"2.0","method":"call","id":1,"params":{"model":"res.partner","method":"search_read","args":[[]],"kwargs":{"fields":["name"],"limit":5}}}'
How to Use
From installation to your first authenticated API call in under 5 minutes.
Install the Module
Place the folder in your addons path, restart Odoo, update the app list, and click Install.
Generate an API Key
Go to JSON-RPC 2.0 › Generate API Key. Choose a user, set an optional expiry date, and click Generate Key. Copy the key immediately — it’s shown only once.
Send Your Request
Call /json/2/<model>/<method> with the Authorization: Bearer header. Use any HTTP client: curl, Python, Postman, Node.js…
Monitor in Odoo
Check JSON-RPC 2.0 › API Logs for a real-time audit trail of every call: IP, user, duration, status, and any error trace.
curl -X POST https://your-odoo.com/json/2/res.partner/search_read \
-H "Content-Type: application/json" \
-H "Authorization: Bearer jrpc2_your_key_here" \
-H "X-Odoo-Database: your_db" \
-d '{"domain": [["is_company","=",true]], "fields": ["name","email"], "limit": 5}'
# Create a record
curl -X POST https://your-odoo.com/json/2/res.partner/create \
-H "Content-Type: application/json" \
-H "Authorization: Bearer jrpc2_your_key_here" \
-H "X-Odoo-Database: your_db" \
-d '{"name": "Integration Partner", "email": "api@example.com"}'
-H "Content-Type: application/json" \
-H "Authorization: Bearer jrpc2_your_key_here" \
-d '{
"jsonrpc": "2.0", "method": "call", "id": 1,
"params": {
"db": "your_db",
"model": "res.partner", "method": "search_read",
"args": [[]], "kwargs": {"fields": ["name"], "limit": 5}
}
}'
⚠ Error Response Format
On failure, /json/2/ returns a semantic HTTP status code (400, 401, 403, 500) and a consistent JSON body:
"name": "odoo.exceptions.AccessError",
"message": "You do not have permission to access this document.",
"debug": "<traceback â only in Odoo debug mode>"
}
Ready to connect your Odoo?
Install the module, generate your first API key, and start making secure JSON/2 requests immediately. Full backward compatibility — zero performance trade-offs.
Please log in to comment on this module