Community mailing list archives

Re: About JSON-RPC in odoo

by André P.<> - 05/06/2015 11:55:28
No docs as far as I know, but I've had success using this library:

Here's a small example:

            login = new $.JsonRpcClient({ ajaxUrl: '' });
  'call', {"base_location": "",
                                "db": "mydatabase",
                                "login": "admin",
                                "password": "admin",
                                "context": {}}, function(data) {
                                       client = new $.JsonRpcClient({ ajaxUrl: '' });
                             'call', {"context": {},
                                                            "model": "res.partner",
                                                            "method": "create",
                                                            "args": [{"name": "John",
                                                                      "email": ""}],
                                                            "kwargs": {"context": {}},
                                                            "session_id": data.session_id}, function(done) {
                                                                 console.log("Partner created");

This code logs in to the database, then creates a new res.partner and finally sends a message to the log confirming the creation.

Beware that if you need to run this code outside the same domain as the Odoo instance, you need to set up the CORS headers ( We use Nginx as a reverse proxy to Odoo, so we configured it to add the headers on the replies.

2015-05-06 13:03 GMT+01:00 zahid jalal <>:
Hi every one

We have devlopped many Odoo/openerp mobile/webapp clients using the XMLRPC webservice. Now we are trynig to rewrite some of them to use JSON-RPC . But we are confronted to the lack of documentation about JSON-RPC in odoo.
This page was not of a great help. it does not not provide any information about urls to use for different call requests, nor the way to use session trough many json call.

Is there any source of some extensive documentation abour JSON-RPC in Odoo ?



Post to:


André Paramés



Avenida das Túlipas,

nº 6, 13º A/B 

1495-161 Algés

t.   +351 808 455 255



Rua do Espinheiro,

nº 641, 2 SALA 2.3 

4400-450 V.N. Gaia