Repository
OCA/rest-framework · module folder · Try on Runboat
Module version
1.1.0
Category
Uncategorized
Folder size
0.43 MB
License
LGPL-3
Application
No
Auto-installable
No
Website
https://github.com/OCA/rest-framework
Last tracking update
2026-08-11 17:30:52
Authors
ACSONE SA/NV, Odoo Community Association (OCA)
Maintainers
ACSONE SA/NV, Odoo Community Association (OCA)
Committers
Stéphane Bidoul, Laurent Mignon (ACSONE), Enric Tobella, Lois Rilo, Weblate, OCA-git-bot, Raf Ven, oca-ci
Odoo dependencies
OCA/web-api:
odoo/odoo:
Python dependencies
a2wsgi>=1.10.6, fastapi>=0.110.0, parse-accept-language, python-multipart, ujson
System dependencies
None
Required by
None
Description
This addon provides the basis to smoothly integrate the
[FastAPI](https://fastapi.tiangolo.com/) framework into Odoo.

This integration allows you to use all the goodies from
[FastAPI](https://fastapi.tiangolo.com/) to build custom APIs for your
Odoo server based on standard Python type hints.

**What is building an API?**

An API is a set of functions that can be called from the outside world.
The goal of an API is to provide a way to interact with your application
from the outside world without having to know how it works internally. A
common mistake when you are building an API is to expose all the
internal functions of your application and therefore create a tight
coupling between the outside world and your internal datamodel and
business logic. This is not a good idea because it makes it very hard to
change your internal datamodel and business logic without breaking the
outside world.

When you are building an API, you define a contract between the outside
world and your application. This contract is defined by the functions
that you expose and the parameters that you accept. This contract is the
API. When you change your internal datamodel and business logic, you can
still keep the same API contract and therefore you don't break the
outside world. Even if you change your implementation, as long as you
keep the same API contract, the outside world will still work. This is
the beauty of an API and this is why it is so important to design a good
API.

A good API is designed to be stable and to be easy to use. It's designed
to provide high-level functions related to a specific use case. It's
designed to be easy to use by hiding the complexity of the internal
datamodel and business logic. A common mistake when you are building an
API is to expose all the internal functions of your application and let
the oustide world deal with the complexity of your internal datamodel
and business logic. Don't forget that on a transactional point of view,
each call to an API function is a transaction. This means that if a
specific use case requires multiple calls to your API, you should
provide a single function that does all the work in a single
transaction. This why APIs methods are called high-level and atomic
functions.

Code Analysis

Views touched (4)
XML IDNameModelTypeStatus
fastapi_endpoint_demo_form_view fastapi.endpoint.demo.form (in fastapi) fastapi.endpoint form Inherits fastapi_endpoint_form_view
fastapi_endpoint_form_view fastapi.endpoint.form (in fastapi) fastapi.endpoint form New
fastapi_endpoint_search_view fastapi.endpoint.search (in fastapi) fastapi.endpoint search New
fastapi_endpoint_tree_view fastapi.endpoint.tree (in fastapi) fastapi.endpoint list New
HTTP endpoints (0)

No HTTP endpoints found for this module.

Models touched (4)

New fields (4)
  • company_id Many2one → res.company
    compute='_compute_company_id' domain="[('user_ids', 'in', user_id)]" readonly=False store=True args: 'res.company'
  • route_group Char
    help='Use this to classify routes together' size=32
  • save_http_session Boolean
    default=True help="Whether session should be saved into the session store. This is required if for example you use the Odoo's authentication mechanism. Oherwise chance are high that you don't need it and could turn off this behaviour. Additionaly turning off this option will prevent useless IO operation when storing and reading the session on the disk and prevent unexpecteed disk space consumption." string='Save HTTP Session'
  • user_id Many2one → res.users
    comodel_name='res.users' default=<expr> help='The user to use to execute the API calls.' string='User'
Public methods (5)
  • action_sync_registry(self)
  • get_app(self, path)
    @api.model
  • get_uid(self, path)
    @api.model@tools.ormcache('path')
  • has_demo_data(self)
    @api.model
  • write(self, vals)

New fields (1)
  • demo_auth_method Selection
    selection=[('api_key', 'Api Key'), ('http_basic', 'HTTP Basic')] string='Authenciation method'
Public methods (0)

No public methods.

New fields (0)

No new fields.

Public methods (0)

No public methods.

New fields (0)

No new fields.

Public methods (0)

No public methods.

Loading…

Loading…

Loading…

Loading…