Having a REST API

Dear Sir,
Instead of JSON-RPC, is it possible to have restfull api by Python for Web Client (vue.js), for example, a moudule similar to the following?


Any module can define its own routes like the timesheet module. Of course it is not mandatory to use the user application decorator for authentication, you can use the app.auth_required which is the one used for the JSON-RPC.
In case you want to implement a fully compatible RESTful, you should probably look at how it is done in trytond.protocols.dispatcher._dispatch.
Also Tryton does not used RESTful by default because we want to have batch and context support which does not fit well in REST.

Thanks for your reply.
One thing, it was said that the overall performance of REST would be better than JSON-RPC, what is your opinion? thanks.

No, the performance does not really depend on the protocol used but on how the procedure behind is implemented. Both protocols use HTTP and JSON (usually for REST) so there will be no difference in encoding/decoding.
But as I said, REST does not really have an API for batch work like updating or creating many records at once. So if you plan to do such thing, our JSON-RPC will be faster because it will avoid client-server round-trip for each record.

1 Like

Understand, thanks a lot !