How amlaksil/odoo-json-rpc-api works
Project type and purpose
• This is an open-source collection of example JSON-RPC request payloads for Odoo’s API. It’s not a full-stack application with frontend/backend code, but rather a set of sample requests (employee-*.json, product-*.json) accompanied by a README explaining how to call Odoo’s JSON-RPC services.
• Purpose: Provide developers with ready-made request templates (CRUD operations) against Odoo models via JSON-RPC 2.0.
File structure
• Top level:
• README.md — explains API usage, services, methods, examples.
• employee-create.json, employee-read.json, … product-*.json — JSON payloads for create, read, update, delete, search operations on hr.employee and product.template models.
• No code directories, build scripts, or config files—just sample payloads and documentation.
README for additional insights
• Describes the JSON-RPC 2.0 protocol for Odoo: authentication (common service), object service (CRUD), report, workflow, web, action, wizard, security, data, utility.
• Shows example request/response formats and best practices.
Main components
a. Client Component
• Represents any external application or script using these JSON sample files to drive requests.
b. JSON-RPC Transport Layer
• HTTP(S) endpoint exposing JSON-RPC 2.0.
• Handles request/response marshalling.
c. Odoo Services Layer
• Common Service (authenticate)
• Object Service (execute: CRUD/search_read)
• Other services (report, workflow, web, action, wizard, security, data, utility)
d. Odoo Core & ORM
• Business logic, model definitions (hr.employee, product.template)
e. Odoo Database
• PostgreSQL storing all records
f. Error Handling & Session Management
• Session store or in-memory registry for authenticated sessions
g. External Integrations (optional)
• Mail servers, file storage, third-party APIs invoked by Odoo actions or reports
Relationships and interactions
• Client → JSON-RPC Endpoint: send example JSON payload (employee-create.json → HTTP POST).
• JSON-RPC Layer → Common Service: authenticate() to establish session (database, username, password).
• JSON-RPC Layer → Object Service: execute(model_name, method_name, args).
• Object Service → ORM → Database: perform SQL queries/updates.
• Object Service → returns JSON result/error back up to client.
• Other services follow similar flow (report generation → file storage; workflow → schedule tasks, etc.).
Architectural patterns & design principles
• Layered architecture: transport layer, service layer, ORM/core, persistence
• Separation of concerns: authentication vs. object operations vs. reporting vs. workflow
• Stateless requests with session ID token
• Extensible services: additional services can be plugged in along the same JSON-RPC interface
Technologies, frameworks, libraries
• HTTP(S) + JSON-RPC 2.0 protocol
• Odoo server (Python, built-in ORM on PostgreSQL)
• PostgreSQL database
• Clients: any HTTP client or CLI script loading .json payloads
Customizing for this open-source sample project
• “Sample Request Library” as your entry point—show it feeding into the JSON-RPC endpoint.
• Only the services used by the sample files (common and object) more prominently, dim or outline the others.
• A typical CRUD use case flow:
1. authenticate (common)
2. execute create/read/write/unlink (object)
3. return result or error