json-rpc

48 views
Skip to first unread message

Peter Müller

unread,
Feb 6, 2016, 12:15:04 PM2/6/16
to tryton-dev
I'm working with the JSON-RPC interface and coming along the above example request to read records.

Is there a way to get all records/fields at once ? I try empty list and null for the id's and fields, but w/o success.

BTW: I found different very short docs or comments about the json-rpc calls, methods and params. Is there anything a little bit more complete.

Regards, Peter

{
   "id": 8,
   "method": "model.ir.model.read",
   "params":
   [
      1,
     "qdWWyL6guIJrnxTFGaWX7xc6o/BH+QnZbFcgU=",
     [47, 71],
     ["info", "model", "name", "module"],
     {
       "language": "fr_FR", "locale": {
          "date": "%d.%m.%Y", "thousands_sep": "", "grouping": [],
         "decimal_point": ","
       },
       "language_direction": "ltr", "groups": [1], "timezone": null
      }
   ]
 }

Cédric Krier

unread,
Feb 6, 2016, 1:10:05 PM2/6/16
to tryton-dev
On 2016-02-06 08:32, Peter Müller wrote:
> I'm working with the JSON-RPC interface and coming along the above example
> request to read records.
>
> Is there a way to get all records/fields at once ? I try empty list and
> null for the id's and fields, but w/o success.

JSON-RPC interface just follow the standard: http://json-rpc.org/
With few special behaviour:

- the two first parameters are the user id and the session
- the parameter at the position RPC.instantiate will be instanciated
automatically
- the last parameter must be the context dictionary.

So for your question, you should use the ModelStorage.search method
first to get the ids or the ModelStorage.search_read.

> BTW: I found different very short docs or comments about the json-rpc
> calls, methods and params. Is there anything a little bit more complete.

Now, you know the details, you can submit a documentation patch :-)

--
Cédric Krier - B2CK SPRL
Email/Jabber: cedric...@b2ck.com
Tel: +32 472 54 46 59
Website: http://www.b2ck.com/

Peter Müller

unread,
Feb 7, 2016, 6:50:04 AM2/7/16
to tryton-dev
Hi Cédri,

yes I know the json-rpc specification and was not shure about the usage in tryton (eg. the response has a different structure in the specification). Anyway, looking in the source I will get it. Thank you !

Cédric Krier

unread,
Feb 7, 2016, 7:50:03 AM2/7/16
to tryton-dev
On 2016-02-07 02:28, Peter Müller wrote:
> Hi Cédri,
>
> yes I know the json-rpc specification and was not shure about the usage in
> tryton (eg. the response has a different structure in the specification).

Could you be more precise because for me the response follows the
specification.

Peter Müller

unread,
Feb 7, 2016, 3:25:04 PM2/7/16
to tryton-dev
El diumenge, 7 febrer de 2016 13:50:03 UTC+1, Cédric Krier va escriure:
Could you be more precise because for me the response follows the
specification.


I was not shure about "result" and "error" field.  But I noticed right now, that  I read the 1.0 specs.
With v.2.0 it is ok.  

 
Reply all
Reply to author
Forward
0 new messages