1. Go to this page and download the library: Download odxproxy/client library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
odxproxy / client example snippets
use OdxProxy\Odx;
// 1. Initialize the client (do this once per request)
Odx::init([
'gateway_url' => 'https://gateway.odxproxy.io',
'gateway_api_key' => 'YOUR_GATEWAY_KEY',
'url' => 'https://my-odoo-instance.com',
'user_id' => 1,
'db' => 'odoo_db',
'api_key' => 'ODOO_USER_API_KEY'
]);
// 2. Use it anywhere
try {
// Fetch partners
$partners = Odx::searchRead('res.partner', [['customer_rank', '>', 0]]);
print_r($partners);
} catch (\OdxProxy\Exception\OdxException $e) {
echo "Error {$e->getCode()}: {$e->getMessage()}";
}
use OdxProxy\Exception\OdxException;
try {
Odx::create('res.partner', ['invalid_field' => 'value']);
} catch (OdxException $e) {
// The HTTP Status Code (or 200 if Odoo returned a logic error)
$code = $e->getCode();
// The human readable message
$msg = $e->getMessage();
// Detailed debug data (if available from Odoo)
$data = $e->data;
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.