TheStoryCoder
TheStoryCoder

Reputation: 3640

Odoo: How to find Odoo version through XML-RPC API?

I'm writing a PHP library for accessing the Odoo XML-RPC API and I need to know the Odoo version of the server I'm talking to - but I can't figure out how to determine the version. Is there a certain model that will tell me or how do I do that?

UPDATE

I thought I have figured it out. The ir.module.module model will give you a list of all the installed modules. Then in the base module you look at the installed_version property. BUT this requires admin access! I need to do this as the regular user that is normally using the API.

But for anyone who has that kind of access this is what you would do. Using ripcord (see example here) you would use this line to retrive just the base module:

$models->execute_kw($db, $username, $password, 'ir.module.module', 'search_read', array(array(array('name', '=', 'base'))) );

Upvotes: 1

Views: 1446

Answers (2)

Hassan ALi
Hassan ALi

Reputation: 1331

Following code is valid and working fine tested on multiple servers.

$url = 'https://###.###.###.##:8069'; 
$db = 'demo'; 
$username = 'user_name'; 
$password = 'password';
$common = ripcord::client("$url/xmlrpc/2/common"); 
$models = ripcord::client("$url/xmlrpc/2/object"); 
$common->version(); 
$uid = $common->authenticate($db, $username, $password, array());

These examples use the Ripcord library, which provides a simple XML-RPC API. Ripcord requires that XML-RPC support be enabled in your PHP installation.

Since calls are performed over HTTPS, it also requires that the OpenSSL extension be enabled.

Upvotes: 0

Veikko
Veikko

Reputation: 3620

You can get the Odoo version even without authentication from the API common endpoint. See documentation on https://www.odoo.com/documentation/12.0/webservices/odoo.html heading ”Logging in” and the first code sample there. You can find the server_version property there.

$common = ripcord::client($url.'/xmlrpc/2/common');
$common->version();

Upvotes: 0

Related Questions