4

I'm confused between the concepts of Odoo RPC, XML RPC, JSON RPC, and REST API in the domain of Odoo. To my knowledge, these are the only 4 APIs that can be used in Odoo.

In Odoo's documentation, only xml rpc and json rpc are mentioned. But on this website: Odoo RPC They've discussed Odoorpc library. Fourth one is REST API, how does it fit in odoo? When we create a controller with a specific route, would it be called a REST API?

Hussam Cheema
  • 536
  • 1
  • 7
  • 13

1 Answers1

4

RPC and REST are different approaches to how to call an API. RPC is a bit harder to use but more powerful, REST is easier but less powerful.

Odoo only has one API: RPC. Odoo has no REST API.

You can call Odoo's RPC it through XML-RPC or JSON-RPC, but the API is the same. Just use the format that best fits your other system. In case you don't care, go for JSON-RPC, which is the one odoo itself uses.

The docs you link are unofficial, and the odoorpc lib is another unofficial library that makes interacting with odoo API more comfortable. These are the official docs: https://www.odoo.com/documentation/14.0/webservices/odoo.html

Yajo
  • 5,808
  • 2
  • 30
  • 34
  • But Odoorpc uses "odoorpc" library (you can see in the link given above) while xmlrpc and jsonrpc uses their own libraries for the functionality. xmlrpc uses "xmlrpc.client" and jsonrpc uses "urllib.request" library. Also you've mentioned that Odoo has no REST API but @Paxmees mentioned in his answer that External API is also a REST API.!! – Hussam Cheema Nov 20 '20 at 05:23
  • Thanks @Yajo for this answer. The official docs don't mention JSON-RPC. Are You sure it's equally supported? – Stefan Dec 09 '21 at 17:25
  • Yes, as said that's the one used by the Odoo web client. See https://github.com/odoo/odoo/blob/f02622684c6a220a425044d8d4a5fd474efdb519/addons/web/static/src/core/network/rpc_service.js#L41-L96 – Yajo Dec 16 '21 at 18:23