Skip to Content

47.73

15.0 0
Live Preview
Required Apps 3323
Technical Name odoo_rest
License OPL-1
Also available in version 17.0 16.0 15.0
You bought this module and need support ? Click here!
Technical Name odoo_rest
License OPL-1
Also available in version v 17.0 v 16.0 v 15.0
odoo-rest-api
Odoo REST API | Secure & Flexible Odoo Integration
Enable a powerful REST API for your Odoo server. This module allows you to perform CRUD operations on any Odoo model using secure, token-based authentication.
Odoo, REST API, JSON, Odoo Integration, Web Services, CRUD, API Connector, Odoo Development, Secure API

Introduction

The Odoo REST API module provides a comprehensive and secure interface for connecting your Odoo server with external applications and services. This powerful tool enables developers to interact with Odoo data using standard HTTP requests and JSON data formats, making it easy to integrate with mobile apps, custom web frontends, and third-party systems. With support for full CRUD (Create, Read, Update, Delete) operations and a robust, token-based authentication system, this module is the ideal solution for building scalable, secure, and flexible integrations.

Key Features

  • Provides a complete RESTful API for all Odoo models, supporting both JSON and XML formats.

  • Enables full CRUD (Create, Read, Update, Delete) operations using standard HTTP methods.

  • Secures API access with user-specific API keys and token-based authentication.

  • Allows for advanced data querying with filters, sorting, and pagination.

  • Supports the execution of custom Odoo methods and workflows via API calls.

  • Provides options to fetch the schema of any Odoo table for easy reference.

  • Offers granular control over API access rights for different users and models.

  • Includes endpoints for triggering standard Odoo actions and workflows.

Benefits

  • Simplify and accelerate the integration of Odoo with external applications.

  • Enhance data security with a robust and flexible authentication system.

  • Improve developer productivity with a standardized and well-documented API.

  • Automate business processes by enabling seamless data exchange between systems.

  • Build high-performance and scalable integrations with a lightweight and efficient API.

  • Increase the flexibility of your Odoo system by making it accessible to a wide range of technologies.

  • Reduce the complexity of Odoo integrations with a straightforward and developer-friendly approach.

Compatibility & Technical Details

  • License: OPL-1

  • Technical Name: odoo_rest

  • Installation Steps:

    1. Place the module folder into your Odoo addons directory.

    2. Install any required Python libraries as specified in the module's documentation.

    3. Restart the Odoo server.

    4. Navigate to the 'Apps' menu in your Odoo instance.

    5. Click on 'Update Apps List'.

    6. Search for the 'Odoo REST API' module and click 'Install'.

    7. Configure API keys and access rights for your users from the module's settings to begin using the API.

Odoo REST API

"Smarter Search, Faster Results — Odoo REST API Just Got Sharper!"

Odoo REST API module allows users to connect to Odoo using simple web requests. You can easily add, update, delete, or retrieve data in JSON or XML format. The user authentication option ensures your data remains secure.

Information

user-guide User Guide
https://webkul.com/blog/user-manual-of-odoo-rest-api/


Why Use Odoo Rest API?

Odoo REST API connects with external apps to manage data such as products, customers, and orders through simple web requests. It saves time, enhances automation, and ensures secure, real-time data synchronization across platforms.


Purpose of REST API in Odoo

Odoo REST API integrates Odoo with other apps, automating tasks such as sending emails and creating invoices. Easily add, update, or delete data to reduce manual work. Streamline workflows, save time, and improve efficiency across your business.

Search Optimization

The new update enhances search speed and accuracy in Odoo. It allows you to quickly find the right data with improved filters and advanced search options. This update ensures a more efficient and streamlined search experience, saving you time and effort.

OpenAPI Support Added

This module now supports OpenAPI (Swagger), offering a simple and interactive layout to view, test, and use APIs. Developers can easily explore endpoints, accelerating development and boosting efficienc. It's designed to help you work faster and smarter.

Highlighted-features
Secure Access with User Authentication
Manage API keys with validity and throttling
Optimized Search
OpenAPI Integration
Get table schema
Trigger Odoo actions
Manage access rights for API keys
CRUD Operations
Get postman collection in doc

Create an API with user authentication



Generate User Authentication Token Token



Encode credentials using base64 list with the token



Generate user authetication token using API





OpenAPI integration with REST API DOCUMENTATION



Detailed Features List

Better Security with User Login

  • Users with access can use the API.
  • This keeps your business data safe from hackers and fake users.
  • It prevents problems like data theft, fraud, and misuse." for clarity and parallelism.
  • Adds a safety layer before anyone can read or change your data.

OpenAPI support integration

  • OpenAPI lets you easily see and try out your API in a web browser.
  • You can see all available API routes with details and try them out directly.
  • It helps to understand how each API call works without writing extra code.
  • Saves time for developers by giving a ready-to-use guide for the API.

Generate User Token

  • You can generate a login token directly from the User Profile in Odoo under the "User Authentication" section.
  • Choose or create an API key to generate a unique token for secure API access.
  • Each API key can have its token, allowing for multiple tokens per user.
  • Users can also create token from API Generate Token Endpoint.
  • For Generating User Token with endpoint, encode the login credentials
    {'login ': ' admin','password ': ' admin'} using Base64 encoder and pass it in Headers.

Manage API keys and their Access Rights

  • This lets you create API keys for different purposes.
  • You can set different permissions for each API.
  • You can choose whether a key can access all or only specific resources. For each resource, you can define what the key is allowed to do: CRUD Operations.

JSON representaion of Odoo Rest API

Example 1: Search record from product.product
Request Type : GET
End Point : {{base_url}}/api/product.template/search?domain=[('id','in',[13,10,11,12,14])]&fields=['name','description','product_variant_ids']
Header : {"api_key":"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"}

                                {
                                    "object_name": "product.template",
                                    "responseCode": 200,
                                    "fields": "['name','description','product_variant_ids']",
                                    "model_id": 145,
                                    "permisssions": {
                                        "read": true,
                                        "create": true,
                                        "delete": true,
                                        "write": true
                                    },
                                    "message": "Allowed all Models Permission: all",
                                    "success": true,
                                    "domain": "[('id','in',[13,10,11,12,14])]",
                                    "data": [
                                        {
                                            "id": 11,
                                            "name": "Bose Mini Bluetooth Speaker",
                                            "description": false,
                                            "product_variant_ids": [
                                                {
                                                    "id": 14,
                                                    "name": "Bose Mini Bluetooth Speaker"
                                                }
                                            ]
                                        },
                                        {
                                            "id": 14,
                                            "name": "iPad Mini",
                                            "description": false,
                                            "product_variant_ids": [
                                                {
                                                    "id": 17,
                                                    "name": "iPad Mini"
                                                }
                                            ]
                                        },
                                        {
                                            "id": 10,
                                            "name": "iPad Retina Display",
                                            "description": false,
                                            "product_variant_ids": [
                                                {
                                                    "id": 10,
                                                    "name": "iPad Retina Display"
                                                },
                                                {
                                                    "id": 11,
                                                    "name": "iPad Retina Display"
                                                },
                                                {
                                                    "id": 12,
                                                    "name": "iPad Retina Display"
                                                }
                                            ]
                                        },
                                        {
                                            "id": 12,
                                            "name": "Custom Computer (kit)",
                                            "description": "Custom computer shipped in kit.",
                                            "product_variant_ids": [
                                                {
                                                    "id": 15,
                                                    "name": "Custom Computer (kit)"
                                                }
                                            ]
                                        },
                                        {
                                            "id": 13,
                                            "name": "Parts Replacement",
                                            "description": false,
                                            "product_variant_ids": [
                                                {
                                                    "id": 16,
                                                    "name": "Parts Replacement"
                                                }
                                            ]
                                        }
                                    ]
                                }
                        

Example 2: Get schema for table product.product
Request Type : GET
End Point : {{base_url}}/api/res.lang/schema
Header : {"api_key":"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"}

                                {
                                    "responseCode": 200,
                                    "model_id": 73,
                                    "permisssions": {
                                        "read": true,
                                        "create": true,
                                        "delete": true,
                                        "write": true
                                    },
                                    "message": "Allowed all Models Permission: all",
                                    "object_name": "res.lang",
                                    "success": true,
                                    "data": [
                                        {
                                            "field_type": "char",
                                            "label": "Name",
                                            "readonly": false,
                                            "required": true,
                                            "field_name": "name"
                                        },
                                        {
                                            "field_type": "char",
                                            "label": "Locale Code",
                                            "readonly": false,
                                            "required": true,
                                            "field_name": "code"
                                        },
                                        {
                                            "field_type": "char",
                                            "label": "ISO code",
                                            "readonly": false,
                                            "required": false,
                                            "field_name": "iso_code"
                                        },
                                        {
                                            "field_type": "boolean",
                                            "label": "Translatable",
                                            "readonly": false,
                                            "required": false,
                                            "field_name": "translatable"
                                        },
                                        {
                                            "field_type": "boolean",
                                            "label": "Active",
                                            "readonly": false,
                                            "required": false,
                                            "field_name": "active"
                                        },
                                        {
                                            "readonly": false,
                                            "field_name": "direction",
                                            "field_type": "selection",
                                            "label": "Direction",
                                            "required": true,
                                            "selection": [
                                                [
                                                    "ltr",
                                                    "Left-to-Right"
                                                ],
                                                [
                                                    "rtl",
                                                    "Right-to-Left"
                                                ]
                                            ]
                                        },
                                        {
                                            "field_type": "char",
                                            "label": "Date Format",
                                            "readonly": false,
                                            "required": true,
                                            "field_name": "date_format"
                                        },
                                        {
                                            "field_type": "char",
                                            "label": "Time Format",
                                            "readonly": false,
                                            "required": true,
                                            "field_name": "time_format"
                                        },
                                        {
                                            "field_type": "char",
                                            "label": "Separator Format",
                                            "readonly": false,
                                            "required": true,
                                            "field_name": "grouping"
                                        },
                                        {
                                            "field_type": "char",
                                            "label": "Decimal Separator",
                                            "readonly": false,
                                            "required": true,
                                            "field_name": "decimal_point"
                                        },
                                        {
                                            "field_type": "char",
                                            "label": "Thousands Separator",
                                            "readonly": false,
                                            "required": false,
                                            "field_name": "thousands_sep"
                                        },
                                        {
                                            "field_type": "integer",
                                            "label": "ID",
                                            "readonly": true,
                                            "required": false,
                                            "field_name": "id"
                                        },
                                        {
                                            "field_type": "char",
                                            "label": "Display Name",
                                            "readonly": true,
                                            "required": false,
                                            "field_name": "display_name"
                                        },
                                        {
                                            "field_type": "many2one",
                                            "label": "Created by",
                                            "readonly": false,
                                            "required": false,
                                            "field_name": "create_uid"
                                        },
                                        {
                                            "field_type": "datetime",
                                            "label": "Created on",
                                            "readonly": false,
                                            "required": false,
                                            "field_name": "create_date"
                                        },
                                        {
                                            "field_type": "many2one",
                                            "label": "Last Updated by",
                                            "readonly": false,
                                            "required": false,
                                            "field_name": "write_uid"
                                        },
                                        {
                                            "field_type": "datetime",
                                            "label": "Last Updated on",
                                            "readonly": false,
                                            "required": false,
                                            "field_name": "write_date"
                                        },
                                        {
                                            "field_type": "datetime",
                                            "label": "Last Modified on",
                                            "readonly": true,
                                            "required": false,
                                            "field_name": "__last_update"
                                        }
                                    ]
                                }
                        

Example 3: Create a record of product.template
Request Type : POST
End Point : {{base_url}}/api/product.template/create
Header : {"api_key":"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"}

                                response : {
                                  "responseCode": 200,
                                  "model_id": 145,
                                  "permisssions": {
                                      "read": true,
                                      "create": true,
                                      "delete": true,
                                      "write": true
                                  },
                                  "message": "Allowed all Models Permission: all",
                                  "create_id": 75,
                                  "object_name": "product.template",
                                  "success": true
                                }
                        

Example 4: Get a record of sale.order.line
Request Type :GET
End Point : {{base_url}}/api/sale.order.line/<int: record_id>
Header : {"api_key":"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"}

                                GET
                              {
                                  "object_name": "sale.order.line",
                                  "responseCode": 200,
                                  "model_id": 241,
                                  "record_id": 2,
                                  "message": "Allowed all Models Permission: all",
                                  "success": true,
                                  "permisssions": {
                                      "read": true,
                                      "create": true,
                                      "delete": true,
                                      "write": true
                                  },
                                  "data": [
                                      {
                                          "sequence": 10,
                                          "__last_update": "2017-10-04 11:28:01",
                                          "is_downpayment": false,
                                          "price_tax": 0,
                                          "customer_lead": 0,
                                          "create_uid": [
                                              {
                                                  "id": 1,
                                                  "name": "Administrator"
                                              }
                                          ],
                                          "price_unit": 145,
                                          "product_qty": 5,
                                          "salesman_id": [
                                              {
                                                  "id": 5,
                                                  "name": "Demo User"
                                              }
                                          ],
                                          "amt_invoiced": 0,
                                          "id": 2,
                                          "product_packaging": [],
                                          "qty_delivered": 0,
                                          "price_reduce_taxinc": 145,
                                          "price_reduce": 145,
                                          "price_total": 725,
                                          "move_ids": [],
                                          "layout_category_id": [],
                                          "route_id": [],
                                          "create_date": "2017-10-04 11:28:01",
                                          "currency_id": [
                                              {
                                                  "id": 1,
                                                  "name": "EUR"
                                              }
                                          ],
                                          "product_id": [
                                              {
                                                  "id": 5,
                                                  "name": "Datacard"
                                              }
                                          ],
                                          "write_date": "2017-10-04 11:28:01",
                                          "warning_stock": false,
                                          "amt_to_invoice": 725,
                                          "price_reduce_taxexcl": 145,
                                          "write_uid": [
                                              {
                                                  "id": 1,
                                                  "name": "Administrator"
                                              }
                                          ],
                                          "company_id": [
                                              {
                                                  "id": 1,
                                                  "name": "YourCompany"
                                              }
                                          ],
                                          "name": "Pen drive, 16GB",
                                          "product_uom_qty": 5,
                                          "qty_to_invoice": 0,
                                          "price_subtotal": 725,
                                          "is_delivery": false,
                                          "invoice_status": "no",
                                          "product_uom": [
                                              {
                                                  "id": 1,
                                                  "name": "Unit(s)"
                                              }
                                          ],
                                          "qty_invoiced": 0,
                                          "state": "draft",
                                          "order_id": [
                                              {
                                                  "id": 1,
                                                  "name": "SO001"
                                              }
                                          ],
                                          "display_name": "Pen drive, 16GB",
                                          "order_partner_id": [
                                              {
                                                  "id": 9,
                                                  "name": "Agrolait"
                                              }
                                          ],
                                          "product_image":""
                                          "layout_category_sequence": 0,
                                          "discount": 0,
                                          "qty_delivered_updateable": false
                                      }
                                  ]
                              }
                        

Example 5: Update a record of product.template
Type : PUT
End Point : {{base_url}}/api/product.template/<int: record_id>
Header : {"api_key":"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"}

                              PUT Body:
                            {
                                "name" : "test product"
                            }
                          
                            response : {
                              "responseCode": 200,
                              "model_id": 145,
                              "permisssions": {
                                  "read": true,
                                  "create": true,
                                  "delete": true,
                                  "write": true
                              },
                              "message": "Allowed all Models Permission: all",
                              "create_id": 75,
                              "object_name": "product.template",
                              "success": true
                            }
                        

Example 6: Delete a record of product.template
Request Type : DELETE
End Point : {{base_url}}/api/product.template/<int: record_id>
Header : {"api_key":"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"}

                          response : {
                            "responseCode": 200,
                            "model_id": 145,
                            "permisssions": {
                                "read": true,
                                "create": true,
                                "delete": true,
                                "write": true
                            },
                            "message": "Allowed all Models Permission: all",
                            "object_name": "product.template",
                            "success": true
                          }
                        

Example 7: Trigger your odoo actions.
Request Type : POST
End Point : {{base_url}}/api/res.partner/execute_kw
Header : {"api_key":"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"}
Body : {"method":"name_get","args":[[2]],"kw":{}}

                      response : {
                                  "model_id": 74,
                                  "success": true,
                                  "message": "Method Successfully Called",
                                  "result": [
                                      [
                                          2,
                                          "OdooBot"
                                      ]
                                  ],
                                  "responseCode": 200,
                                  "permisssions": {
                                      "read": true,
                                      "write": true,
                                      "delete": true,
                                      "create": true
                                  },
                                  "object_name": "res.partner"
                            }
                        

Example 8: Generate Login Token.
Request Type : POST
End Point : {{base_url}}/api/generate_token
Header : {"api_key":"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx","login":"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"}

                            {
                                "success": true,
                                "message": "Token Successfully Generated",
                                "responseCode": 200,
                                "user_id": 2,
                                "Token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJsb2dpbiI..........."
                            }
                        

Example 9: Search record from product.product with user authentication
Request Type : GET
End Point : {{base_url}}/api/product.template/search?domain=[('id','in',[13,10,11,12,14])]&fields=['name','description','product_variant_ids']
Header : {"api_key":"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx","token":"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"}

                            {
                                "success": true,
                                "message": "Allowed all Models Permission: all",
                                "responseCode": 200,
                                "domain": "[('id','in',[13,10,11,12,14])]",
                                "fields": "['name','description','product_variant_ids']",
                                "object_name": "product.template",
                                "user_id": 2,
                                "permisssions": {
                                    "read": true,
                                    "write": true,
                                    "delete": true,
                                    "create": true
                                },
                                "model_id": 381,
                                "data": [
                                    {
                                        "name": "Corner Desk Right Sit",
                                        "description": false,
                                        "product_variant_ids": [
                                            {
                                                "id": 16,
                                                "name": "Corner Desk Right Sit"
                                            }
                                        ],
                                        "id": 10
                                    },
                                    {
                                        "name": "Large Cabinet",
                                        "description": false,
                                        "product_variant_ids": [
                                            {
                                                "id": 17,
                                                "name": "Large Cabinet"
                                            }
                                        ],
                                        "id": 11
                                    },
                                    {
                                        "name": "Large Desk",
                                        "description": false,
                                        "product_variant_ids": [
                                            {
                                                "id": 19,
                                                "name": "Large Desk"
                                            }
                                        ],
                                        "id": 13
                                    },
                                    {
                                        "name": "Pedal Bin",
                                        "description": false,
                                        "product_variant_ids": [
                                            {
                                                "id": 20,
                                                "name": "Pedal Bin"
                                            }
                                        ],
                                        "id": 14
                                    },
                                    {
                                        "name": "Storage Box",
                                        "description": false,
                                        "product_variant_ids": [
                                            {
                                                "id": 18,
                                                "name": "Storage Box"
                                            }
                                        ],
                                        "id": 12
                                    }
                                ]
                            }
                        

Postman Collection

1 - Download Postman Collection
2 - Select "Import" in Postman
3 - Choose the Postman collection JSON file

Rest Api Response Codes

Support

Get Immediate support for any of your query

You will get 90 days free support for any doubt, queries, and bug fixing (excluding data recovery) or any type of issue related to this module.



mail

Write To Us At

[email protected]

For any help and doubt or issue regarding the module, Drop a mail to our technical team.

support-icon

Raise A Ticket At:

https://webkul.uvdesk.com/en/customer/create-ticket/

For support or to request customization, Create A Support Ticket by copying the link and opening it in a new tab.

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.