Availability |
Odoo Online
Odoo.sh
On Premise
|
Lines of code | 410 |
Technical Name |
odoo_restful |
License | OPL-1 |
Empower Your Odoo with RESTful APIs
Access and manage your Odoo models programmatically with ease.

Seamless Integration with Odoo
Create, Read, Update, and Delete your Odoo models via REST API.
Easily manage your Odoo records with simple RESTful calls. CRUD operations are just a few requests away.
Authenticate using secure JWT tokens to ensure safe and authorized access to your Odoo models.
Refresh and update your data with custom API requests, and integrate seamlessly with your existing applications.

Simplified Authentication
Access your Odoo data securely with JWT tokens

Use JWT tokens for secure access to your Odoo system, enabling easy API authentication and session management, eliminating JSON-RPC's user ID and password requirements. Integrate with external identity providers for Single Sign-On (SSO), simplifying user access across platforms without needing traditional username and password login.
Real-time Data Access
Perform live CRUD operations on your Odoo records
Execute model operations in real-time to access and manipulate your Odoo data at any moment. The API empowers you with flexibility and control.

Comprehensive API Documentation
Detailed guides to help you integrate with Odoo

Our module comes with detailed documentation to help you integrate the API seamlessly into your workflow. No matter your use case, weâve got you covered!
Check out our API documentation to get started.
Odoo RESTful API
Odoo RESTful API provides an innovative RESTful interface designed to streamline interactions with Odoo, offering a user-friendly and efficient alternative to the traditional built-in JSON-RPC method. By adhering to RESTful principles and leveraging modern authentication mechanisms, this API empowers developers to seamlessly integrate Odoo into their applications.
About
By leveraging this powerful API, developers can unlock the full potential of Odoo and build innovative applications that seamlessly integrate with Odoo's rich data and functionality.
- Contact Info: khalil.galalem@gmail.com
- Version: 1.0
- License: Odoo Proprietary License v1.0
Key Features
- RESTful Architecture: A clean and intuitive interface for easy consumption and understanding.
- BREAD Operations: Perform Browse, Read, Edit, Add, and Delete operations on Odoo models.
- JWT Authentication: Secure and efficient authentication using JSON Web Tokens.
- OAuth Integration: Seamlessly integrate with popular OAuth providers.
- Search, Filter, and Pagination: Powerful tools for data retrieval and manipulation.
- Error Handling: Comprehensive error handling and informative error messages respecting Http Status Codes.
Getting Started
All you need to explore the full potential of this interface is:
- Have a running Odoo instance
- Install the JWT python library pip install pyjwt
- Add the jwt_secret_key entry to the odoo.conf and give it a secure value. We recommend a 128 bytes alphanumeric string
- Install the Odoo RESTful API (odoo_restful) by Galalem
Usage
- Obtain API Credentials: Acquire necessary token, and don't forget to regenerate it before it expires.
- Make API Requests: Utilize HTTP methods (GET, POST, PATCH, DELETE) to interact with the API endpoints.
- Handle Responses: Parse API responses to extract relevant data.
- Implement Error Handling: Handle potential errors gracefully and take appropriate actions.
API Documentation
This is a REST API reference for the endpoints exposed by this module.
Here are main considerations
- URI Scheme: {baseUrl} - odoo base url, example http://localhost:8069
- Content-Type: application/json - all endpoints consume and produce json content
- Authorization: Bearer - all endpoints require an Authorization header with Bearer token, except for the token generation endpoint of course
Generate a Json Web Token
POST /rest/auth
Authenticate user using one of the available methods and generate a token to allow access for the rest of the APIs
Request Body
Name | Type | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
method | enum:
|
The authentication method to use for signing in the user. By default, the available methods are as the following:
|
||||||||||||
database | string | The name of the database to fetch for user data | ||||||||||||
token | string | Required if the method is set to token or oauth | ||||||||||||
username | string | Required if the method is set to credentials | ||||||||||||
password | string | Required if the method is set to credentials | ||||||||||||
provider | integer | Required if the method is set to oauth |
Examples
Example using credentials | Example using token | Example using oauth |
---|---|---|
{ "method": "credentials", "database": "my_database", "username": "user@example.com", "password": "user123" } |
{ "method": "token", "database": "my_database", "token": "my-super-secret-token" } |
{ "method": "oauth", "database": "my_database", "provider": 3, "token": "my-super-secret-token-from-oauth-provider" } |
Responses
Code | Message | Scheme | Example |
---|---|---|---|
200 | OK | { "token": "string" } |
{ "token": "my-super-secret-token" } |
400 | Bad Request | { "error": "string" } |
{ "error": "Method 'foo' not allowed" } |
500 | Internal Server Error | { "error": "string" } |
{ "error": "Something went wrong and here is the stack trace" } |
Browse the list of records
GET /rest/models/{model}
Browse the list of records using filtering, sorting and pagination
Path Parameters
Name | Type | Description | Example |
---|---|---|---|
model | string | The model name | res.users |
Query Parameters
Name | Type | Default Value | Description |
---|---|---|---|
_page | integer | 1 | The page number to show |
_size | integer | 80 | Number of item per page |
_order | string | id desc | Sorting rules |
_fields | string | 'id,display_name' | Comma separated list of fields to include in response |
<field> | any | undefined | [EQUALS] - The value to filter with. this matches the exact equality of the given value to the fields value. Examples:
|
<field>_ne | any | undefined | [NOT EQUALS] - The value to NOT filter with (exclude). this matches the inequality of the given value to the fields value. Example:
|
<field>_in | any | undefined | [IN] - The list of comma , separated values to filter with. this matches the equality of at least one of the given values to the field's value. Example:
|
<field>_nin | any | undefined | [NOT IN] - The list of comma , separated values to NOT filter with (exclude). this matches the inequality of all the given values to the field's value. Example:
|
<field>_gt | any | undefined | [GREATER THAN] - The value the field should be strictly greater than the given value. Example
|
<field>_gte | any | undefined | [GREATER THAN OR EQUALS] - The value the field should be greater than or equal to the given value. Example:
|
<field>_lt | any | undefined | [LESS THAN] - The value the field should be strictly greater than the given value. Example:
|
<field>_lte | any | undefined | [LESS THAN OR EQUALS] - The value the field should be less than or equal to the given value. Example:
|
<field>_like | string | undefined | [IS LIKE] - The keyword a field should contain, case insensitive. Example:
|
<field>_nlike | string | undefined | [IS NOT LIKE] - The keyword a field should NOT contain, case insensitive. Example:
|
Responses
Code | Message | Scheme | Example |
---|---|---|---|
200 | OK | The JSON Object that represents the page of records or objects containing the requested fields { "content": [ { ... }, ], "totalElements": "integer", "totalPages": "integer", "last": "boolean", "first": "boolean", "numberOfElements": "integer", "size": "integer", "number": "integer", "sort": "string", "empty": "boolean" } |
{ "content": [ { "display_name": "Foo Bar", "id": 123 } ], "totalElements": 46, "totalPages": 4, "last": true, "first": false, "numberOfElements": 1, "size": 15, "number": 4, "sort": "name asc,id desc", "empty": false } |
400 | Bad Request | { "error": "string" } |
{ "error": "Invalid page number '-1'" } |
401 | Unauthorized | { "error": "string" } |
{ "error": "Access Denied" } |
403 | Forbidden | { "error": "string" } |
{ "error": "You are not allowed to access the model 'res.users'" } |
404 | Not Found | { "error": "string" } |
{ "error": "Model 'foo.bar' not found" } |
500 | Internal Server Error | { "error": "string" } |
{ "error": "Something went wrong and here is the stack trace" } |
Create a new record
POST /rest/models/{model}
Create a new record of the given model and get its id
Path Parameters
Name | Type | Description | Example |
---|---|---|---|
model | string | The model name | res.users |
Request Body
The payload and required data varies depending on the model being created.
To verify the data you need to pass, you can enable developer mode on your Odoo instance, then go to settings > Technical > Models, then search and click on the model you're using and inspect the table of fields.
You can also double check the syntax for special cases like relational fields and binary fields on the odoo official documentation as this module uses the same mechanisms as in the built-in JSON-RPC APIs
Example
{ "active": true, "name": "Foo", "code": "bar", "category_id": 123 }
Responses
Code | Message | Scheme | Example |
---|---|---|---|
201 | Created | { "id": "integer", "message": "string" } |
{ "id": 123 "message": "OK" } |
400 | Bad Request | { "error": "string" } |
{ "error": "Missing required fields: 'foo', 'bar'" } |
401 | Unauthorized | { "error": "string" } |
{ "error": "Access Denied" } |
403 | Forbidden | { "error": "string" } |
{ "error": "You are not allowed to access the model 'res.users'" } |
404 | Not Found | { "error": "string" } |
{ "error": "Model 'foo.bar' not found" } |
500 | Internal Server Error | { "error": "string" } |
{ "error": "Something went wrong and here is the stack trace" } |
Read a record
GET /rest/models/{model}/{id}
Fetch a specific record by id and retrieve its data
Path Parameters
Name | Type | Description | Example |
---|---|---|---|
model | string | The model name | res.users |
id | integer | The id of the record | 123 |
Query Parameters
Name | Type | Default Value | Description |
---|---|---|---|
fields | string | [ all ] | Comma separated list of fields to include in response |
Responses
Code | Message | Scheme | Example |
---|---|---|---|
200 | OK | The JSON Object that represents the record or object containing the requested fields | { "id": 123 "display_name": "Foo Bar" } |
400 | Bad Request | { "error": "string" } |
{ "error": "Invalid field 'foo' in model 'bar'" } |
401 | Unauthorized | { "error": "string" } |
{ "error": "Access Denied" } |
403 | Forbidden | { "error": "string" } |
{ "error": "You are not allowed to access the model 'res.users'" } |
404 | Not Found | { "error": "string" } |
{ "error": "Model 'foo.bar' not found" } |
500 | Internal Server Error | { "error": "string" } |
{ "error": "Something went wrong and here is the stack trace" } |
Update a record
PATCH /rest/models/{model}/{id}
Update a record of the given model by id
Path Parameters
Name | Type | Description | Example |
---|---|---|---|
model | string | The model name | res.users |
id | integer | The id of the record | 123 |
Request Body
The payload and required data varies depending on the model being updated.
To verify the data you need to pass, you can enable developer mode on your Odoo instance, then go to settings > Technical > Models, then search and click on the model you're using and inspect the table of fields.
You can also double check the syntax for special cases like relational fields and binary fields on the odoo official documentation as this module uses the same mechanisms as in the built-in JSON-RPC APIs
Example
{ "active": true, "name": "Foo", "code": "bar", "category_id": 123 }
Responses
Code | Message | Scheme | Example |
---|---|---|---|
200 | OK | { "message": "string" } |
{ "message": "OK" } |
400 | Bad Request | { "error": "string" } |
{ "error": "Missing required fields: 'foo', 'bar'" } |
401 | Unauthorized | { "error": "string" } |
{ "error": "Access Denied" } |
403 | Forbidden | { "error": "string" } |
{ "error": "You are not allowed to access the model 'res.users'" } |
404 | Not Found | { "error": "string" } |
{ "error": "Model 'foo.bar' not found" } |
500 | Internal Server Error | { "error": "string" } |
{ "error": "Something went wrong and here is the stack trace" } |
Delete a record
DELETE /rest/models/{model}/{id}
Delete a record of the given model by id
Path Parameters
Name | Type | Description | Example |
---|---|---|---|
model | string | The model name | res.users |
id | integer | The id of the record | 123 |
Responses
Code | Message | Scheme | Example |
---|---|---|---|
200 | OK | { "message": "string" } |
{ "message": "OK" } |
401 | Unauthorized | { "error": "string" } |
{ "error": "Access Denied" } |
403 | Forbidden | { "error": "string" } |
{ "error": "You are not allowed to access the model 'res.users'" } |
404 | Not Found | { "error": "string" } |
{ "error": "Model 'foo.bar' not found" } |
500 | Internal Server Error | { "error": "string" } |
{ "error": "Something went wrong and here is the stack trace" } |
Odoo Proprietary License v1.0 This software and associated files (the "Software") may only be used (executed, modified, executed after modifications) if you have purchased a valid license from the authors, typically via Odoo Apps, or if you have received a written agreement from the authors of the Software (see the COPYRIGHT file). You may develop Odoo modules that use the Software as a library (typically by depending on it, importing it and using its resources), but without copying any source code or material from the Software. You may distribute those modules under the license of your choice, provided that this license is compatible with the terms of the Odoo Proprietary License (For example: LGPL, MIT, or proprietary licenses similar to this one). It is forbidden to publish, distribute, sublicense, or sell copies of the Software or modified copies of the Software. The above copyright notice and this permission notice must be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Please log in to comment on this module