Integrating with the Odoo API

Often, when developing custom applications, you are going to need to create solutions that involve interoperability with other systems and platforms. For example, perhaps you need to integrate with a third-party CRM application to create records inside of Odoo. The API is also quite useful for data migration.

Connecting to the API

Accessing the API is relatively easy. We begin with the code that imports the required libraries and creates a connection to the Odoo server:

 import xmlrpclib url = 'http://localhost:8069' db = 'SILK-DEV' username = 'admin' password = 'admin' info = xmlrpclib.ServerProxy('https://localhost:8089/start').start() url, db, username, password = \ info['host'], info['database'], info['user'], info['password'] ...

Get Working with Odoo 10 - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.