Odoo 19 et son API JSON-2: la page se lit dans le corps
Objectif Lire les 250 contacts d'un vrai Odoo 19 par son API JSON-2, page par page, sans base de données ouverte.
Odoo 19 remplace XML-RPC et JSON-RPC, retirés en Odoo 22, par POST /json/2/<modèle>/<méthode>. Chaque intégration existante doit migrer, et Odoo Online n'ouvre pas sa base: l'API est sa seule porte. JSON-2 lit offset et limit dans le corps JSON seulement.
- body: le domaine, les champs et l'ordre qu'Odoo attend
- param_binding: body écrit offset et limit dans le corps
- trois requêtes, 250 contacts, aucun en double
POST /json/2/res.partner/search_read HTTP/1.1 200 POST /json/2/res.partner/search_read HTTP/1.1 200 POST /json/2/res.partner/search_read HTTP/1.1 200
manifests/10-partners.yaml
apiVersion: connectors.lumnik.io/v1kind: Connectormetadata: name: scenario-odoo-json2-a connector_type: rest-generic scopes: [crm-a]spec: base_url: http://host.docker.internal:18072 auth: kind: bearer token_env: SCENARIO_ODOO_JSON2_A_KEY # an Odoo API key, Preferences → Account Security headers: - { name: X-Odoo-Database, value: scen } endpoints: - id: partners method: POST path: /json/2/res.partner/search_read body: # sent as JSON: JSON-2 reads its arguments from the body domain: [[ref, "=like", "LUM-%"]] fields: [name, ref, city, email] order: id pagination: kind: offset param_binding: body # offset and limit written into the body, page after page offset_param: offset limit_param: limit limit: 100 response_path: $ target: kind: hybrid table: connector.scenario_odoo_partners_a unique_key: $.id promote: - { name: partner_id, path: $.id, type: bigint } - { name: name, path: $.name, type: text } - { name: ref, path: $.ref, type: text } - { name: city, path: $.city, type: text } - { name: email, path: $.email, type: text }$ lm apply -f 10-partners.yaml
Applied connector "scenario-odoo-json2-a" — 1 endpoint
$ lm source rest test scenario-odoo-json2-a
ENDPOINT METHOD STATUS ITEMS VERDICT
partners POST 200 100 ok
$ lm connector run scenario-odoo-json2-a
run scheduled: b9261716-4cca-4b81-adfe-dd87617fc5a7
$ lm run get b9261716-4cca-4b81-adfe-dd87617fc5a7 --wait-evaluated
ID CONNECTOR ENDPOINT STATUS IN OUT SKIPPED DEAD-LETTERS STARTED ENDED EVALUATED
b9261716 scenario-odoo-json2-a partners Completed 250 250 0 0 2026-11-21 18:40 2026-11-21 18:40 yes- pre-flight
- POST 200 · 100 items · ok
- Odoo's log
- 3 × POST /json/2/res.partner/search_read 200
- run
- IN 250 · OUT 250 · DEAD-LETTERS 0
preuves: replay.log, 01-seed.txt, 02-preflight.txt, 03-run.json, 04-odoo-requests.txt · transform v1
Limites
- La clé d'API est créée par le shell d'Odoo: un utilisateur la crée dans Préférences, Sécurité du compte.
- Pas encore de watermark: chaque run relit le domaine entier.
- Odoo 18 et avant n'ont pas JSON-2: lisez leur PostgreSQL (odoo-product-name-json).
- Sans icreated/lumnik#2123, offset et limit partaient dans l'URL, qu'Odoo ignore: chaque page renvoyait tout.
- 250 contacts synthétiques.
Ce scénario tourne sur lumnik Open, gratuit et open source.
Essayer lumnik Open →