Back

Odoo ERP API Essential Guide

Aug 18, 20246 minute read

What type of API does Odoo ERP provide?

Based on the search results provided, Odoo ERP does not appear to use REST, GraphQL, or SOAP APIs specifically. The search results do not contain any information about Odoo's API type.

To determine what type of API Odoo uses, we would need to:

  1. Check Odoo's official documentation
  2. Look for developer resources specific to Odoo's API
  3. Examine sample API calls or endpoints for Odoo

Without that specific information about Odoo, I cannot confidently state what type of API it implements. The search results do not provide the necessary details to answer this question about Odoo's API type.

Does the Odoo ERP API have webhooks?

The official Odoo ERP API does have webhooks available. Webhooks in Odoo can be used to subscribe to various events, including placing an order, changing a product's price, collecting data for data warehousing, integrating with accounting software, and filtering order items and informing shippers about orders.

Webhooks allow you to subscribe to certain events that happen in Odoo. When one of these events is triggered, Odoo will send an HTTP POST payload to the webhook's configured URL. Webhooks are useful for executing code after specific events occur in Odoo, such as creating a new product, updating stock quantity, or confirming a quotation. Using webhooks is more efficient than polling the API regularly, as it allows for instant updates and reduces the number of API requests. Webhook event data can be stored as JSON or XML.

To use webhooks, you need to register a webhook URL with Odoo. Once registered, Odoo will send an HTTP POST request to that URL every time the specified event occurs. It's important to respond quickly to webhook requests, as Odoo has a configurable timeout period and will retry the connection if there's no response or an error. You should acknowledge receipt of webhook data by sending a 200 OK response, as any response outside the 200 range will indicate to Odoo that the webhook was not received.

For development and testing, you can use tools like RequestBin, Pagekite, or ngrok to handle webhooks. It's recommended to defer processing of webhook data until after sending the response to avoid timeout issues, and to monitor your webhook tool's admin interface for failing webhooks.

The webhook functionality in Odoo is provided through a module called "webhooks" which is available on the Odoo App Store for various versions. This module depends on the "restapi" module, which is also available on the Odoo App Store. A quick reference guide for using Odoo webhooks is available at https://synconics.gitbook.io/webhook/.

Rate Limits and other limitations

Based on the search results provided, there is no specific information about the exact API rate limits for the Odoo ERP API. However, I can provide some key points about Odoo API limitations and performance:

Standard API Limitations

  1. The standard Odoo API has limitations when it comes to handling large data flows and intensive activity:

    • Creating more than 2-3 Sales Orders per second per worker is already difficult, even on the latest Odoo 14 & 15 Enterprise versions.
    • The API struggles with medium to large data imports.
  2. The standard API approach has the following drawbacks:

    • It can only accommodate a limited number of concurrent transactions and users without failure.
    • The system cannot accept beyond a limited amount of data.
    • It is not scalable.

Performance Considerations

  1. The standard Odoo API performance is limited because:

    • POST transactions must be validated at the Odoo level by the ORM mechanisms.
    • The API can't handle large data flows combined with intensive activity.
  2. For high-performance scenarios, advanced solutions may be necessary:

    • An advanced API integration approach can accommodate more concurrent users and process larger data volumes.
    • A high-performance API solution may be required for scenarios with very high transaction rates (e.g., 1500 inserts per second and 10,000 downloads per second).

Key Points to Consider

  • The specific API rate limits are not explicitly stated in the provided search results.
  • API limitations can vary depending on the Odoo version, deployment type, and specific use case.
  • For projects requiring high API performance, it's important to assess the volume and speed requirements from the beginning.
  • Custom API solutions may be necessary for scenarios with thousands of concurrent users or high transaction volumes.

While the exact rate limits are not provided, it's clear that the standard Odoo API has limitations when it comes to high-volume or high-concurrency scenarios. For specific rate limit information, it would be best to consult the official Odoo documentation or contact Odoo support directly.

Latest API Version

Based on the search results provided, here are the key points regarding the most recent version of the Odoo ERP API:

  1. The most recent major version of Odoo is Odoo 17.0, which was released in November 2023 [3].

  2. Odoo provides support and bug fixing for the 3 latest major versions [3].

  3. The currently supported major versions are:

    • Odoo 17.0 (supported until October 2026)
    • Odoo 16.0 (supported until November 2025)
    • Odoo 15.0 (supported until November 2024) [3]
  4. Odoo releases intermediary versions called "Online versions" or "SaaS" versions for Odoo Online hosting every two months. The latest SaaS version mentioned is saas~17.2, released in April 2024 [3].

  5. The external API documentation is available for Odoo 17.0, which suggests that this is the most recent version of the API as well [1].

  6. It's important to note that online versions (SaaS) are not released for Odoo.sh and On-Premise installations [3].

  7. Access to data via the external API is only available on Custom Odoo pricing plans, not on One App Free or Standard plans [1].

In summary, the most recent version of the Odoo ERP API corresponds to Odoo 17.0, which is the latest major release. However, for Odoo Online users, there may be more recent SaaS versions available with the latest features.

How to get a Odoo ERP developer account and API Keys?

Here are the key steps to get a developer account for Odoo ERP to create an API integration:

  1. Sign up for an Odoo account:
  • Go to odoo.com and sign up for an account if you don't already have one.
  1. Choose a paid plan:
  • Access to the external API is only available on Custom Odoo pricing plans. It is not available on the free or Standard plans.
  1. Set up API access:
  • Log into your Odoo instance as an administrator
  • Go to Settings > Users & Companies > Users
  • Select the user you want to use for API access
  • Click "Action" and select "Change Password"
  • Set a password for the user (this will be used for API authentication)
  1. Generate an API key:
  • Go to your user preferences/profile
  • Open the "Account Security" tab
  • Click "New API Key"
  • Enter a description for the key
  • Click "Generate Key" and copy the key provided
  1. Use the API key for authentication:
  • Use the API key as the password when making API requests
  • The username remains the same as your login
  1. Make API requests:
  • Use the instance URL, database name, username, and API key to authenticate requests
  • You can now make XML-RPC or JSON-RPC API calls to interact with your Odoo data

What can you do with the Odoo ERP API?

Here are the key data models you can interact with using the Odoo ERP API, along with what is possible for each:

ir.model

  • Query the system for installed models
  • Get information about specific models (e.g. listing associated fields)
  • Create new custom models dynamically over RPC
  • Custom models must start with "x_" and have state set to "manual"
  • Cannot add methods to custom models, only fields

ir.model.fields

  • Get information about fields of Odoo models
  • Add custom fields to existing models without Python code
  • Custom fields must have state set to "manual" to be activated
  • Cannot add computed fields or set certain meta-information like defaults

Basic CRUD Operations

For any model:

  • Create new records
  • Read existing records
  • Update record values
  • Delete records
  • Search for records matching criteria

Search and Read

  • Combines search and read operations in one call
  • Can specify fields to return and limit number of results

Record Cache and Prefetching

  • Odoo maintains a cache of field values to improve performance
  • Prefetches related records and fields based on heuristics

Computed Fields

  • Define fields whose values are computed dynamically
  • Specify dependencies that trigger recomputation
  • Reference fields from related models
  • Automatically updated when related record is modified

Constraints

  • Add validation rules to models
  • Triggered on create/write operations

Onchange Methods

  • Define methods triggered when field values change in UI
  • Update other fields or return warning messages

Inheritance

  • Extend existing models to add/modify fields and methods

The API allows interacting with both built-in Odoo models as well as custom models and fields added to the system. The core operations revolve around querying and manipulating model data through the ORM layer.