Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
70 commits
Select commit Hold shift + click to select a range
049a430
Add endpoint module
simahawk Sep 13, 2021
4703114
endpoint: add cross model constraint
simahawk Oct 14, 2021
7dc729a
endpoint: split out route handling
simahawk Oct 25, 2021
1e3a125
[FIX] endpoint: fix loading of demo data
sebalix Nov 9, 2021
c12fec4
endpoint 14.0.1.0.1
OCA-git-bot Nov 9, 2021
4e36fdc
endpoint: add tests for archive/unarchive
simahawk Dec 28, 2021
84b18b9
endpoint: update tests
simahawk Dec 29, 2021
56496e1
endpoint: improve search/tree views
simahawk Nov 12, 2021
f1c1ef7
endpoint 14.0.1.0.2
OCA-git-bot Jan 12, 2022
22f3866
endpoint 14.0.1.1.0
OCA-git-bot Jan 12, 2022
9ca09ef
Misc fix of authorship name
simahawk Jan 14, 2022
77be1a5
endpoint 14.0.1.1.1
OCA-git-bot Jan 14, 2022
c120ec4
endpoint: block all RPC calls
simahawk Feb 18, 2022
6ea5fd3
endpoint 14.0.1.3.0
OCA-git-bot Mar 11, 2022
cab87ae
endpoint: move to web-api
simahawk Jun 15, 2022
79fe319
[UPD] Update endpoint.pot
Jul 15, 2022
cfaf6d9
[UPD] README.rst
OCA-git-bot Jul 15, 2022
be8d62c
Added translation using Weblate (French)
klodr Sep 15, 2022
a5a5e77
endpoint: adapt to endpoint_route_handler
simahawk Jun 15, 2022
e138a03
endpoint: use registry_sync flag and improve tests
simahawk Jul 25, 2022
b8d2dc5
endpoint: adapt to new sync behavior
simahawk Jul 26, 2022
3f470f6
endpoint_route_handler: use sequence as version
simahawk Mar 1, 2023
cc37b26
endpoint: use model explicitly to find endpoints
simahawk Apr 21, 2023
82149ea
endpoint: 14.0.2.0.0
simahawk May 11, 2023
11a8ff6
[UPD] Update endpoint.pot
May 11, 2023
d33bfa0
[UPD] README.rst
OCA-git-bot May 11, 2023
4d4d8d6
Update translation files
weblate May 11, 2023
faea6f6
endpoint: update ROADMAP
simahawk May 12, 2023
37702fb
[UPD] README.rst
OCA-git-bot May 12, 2023
de3aea9
endpoint 14.0.2.0.1
OCA-git-bot May 12, 2023
66c8e5c
endpoint: fix duplicate
simahawk May 25, 2023
8f54ea3
endpoint 14.0.2.0.2
OCA-git-bot May 25, 2023
c8870c4
endpoint: Migration to 16.0
JordiBForgeFlow Jun 9, 2023
7b17d75
[UPD] Update endpoint.pot
Jul 25, 2023
5c62d3f
[UPD] README.rst
OCA-git-bot Jul 25, 2023
29238a5
Update translation files
weblate Jul 25, 2023
b1e9a79
[UPD] README.rst
OCA-git-bot Sep 3, 2023
3cba615
Added translation using Weblate (Italian)
mymage Nov 27, 2023
1ef7414
Translated using Weblate (Italian)
mymage Nov 27, 2023
0c75f6b
[IMP] endpoint: endpoint multi-company
JordiMForgeFlow Jun 5, 2024
76d4b1a
[UPD] Update endpoint.pot
Jul 4, 2024
a27930c
[BOT] post-merge updates
OCA-git-bot Jul 4, 2024
220fd84
Update translation files
weblate Jul 4, 2024
32f754a
endpoint: add log function
simahawk Jul 2, 2024
c4c5447
[BOT] post-merge updates
OCA-git-bot Jul 8, 2024
80d6ebf
Translated using Weblate (Italian)
mymage Jul 8, 2024
5571a52
endpoint: add basic mixin view
simahawk Jul 23, 2024
75dc543
[UPD] Update endpoint.pot
Jul 26, 2024
445acab
[BOT] post-merge updates
OCA-git-bot Jul 26, 2024
459ac8c
Update translation files
weblate Jul 26, 2024
ace60b0
[IMP] endpoint: pre-commit auto fixes
SilvioC2C Dec 3, 2024
1e1568d
[MIG] endpoint: Migration to 17.0
SilvioC2C Dec 3, 2024
1743065
[UPD] Update endpoint.pot
Dec 4, 2024
4e775c5
[BOT] post-merge updates
OCA-git-bot Dec 4, 2024
3c58d7c
[IMP] endpoint: pre-commit stuff
JordiMForgeFlow Dec 17, 2024
fed96b6
[MIG] endpoint: Migration to V18
JordiMForgeFlow Dec 17, 2024
8c97e24
endpoint: add mixin views for search and list
simahawk Jan 23, 2025
f3e05cb
[IMP] endpoint: don't filter for registry sync
JordiMForgeFlow Jan 31, 2025
e8e38da
[UPD] Update endpoint.pot
Jan 31, 2025
8fd4c55
[BOT] post-merge updates
OCA-git-bot Jan 31, 2025
91ae428
Update translation files
weblate Jan 31, 2025
59fcf2a
Translated using Weblate (Italian)
mymage Jan 31, 2025
e7a000e
[IMP] endpoint: add hmac and hashlib support
ivs-cetmix Mar 11, 2025
790e468
[BOT] post-merge updates
OCA-git-bot Mar 17, 2025
a65acc4
Added translation using Weblate (Chinese (Simplified) (zh_CN))
xtanuiha Apr 13, 2025
11d7eaf
Translated using Weblate (Chinese (Simplified) (zh_CN))
xtanuiha Apr 13, 2025
c48930b
endpoint: fix migration to v18
simahawk Jul 15, 2025
759e0ba
[BOT] post-merge updates
OCA-git-bot Jul 17, 2025
30ebe92
[MIG] endpoint: Migration to 19.0
Alexgars73 Mar 30, 2026
704d0e3
[DON'T MERGE] test-requirements.txt
Alexgars73 Mar 30, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
110 changes: 110 additions & 0 deletions endpoint/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
.. image:: https://odoo-community.org/readme-banner-image
:target: https://odoo-community.org/get-involved?utm_source=readme
:alt: Odoo Community Association

========
Endpoint
========

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:96cb1ce0681b1d235bbc6b73054c059b2bcc09b8966368052fe6773105665f6b
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
:target: https://odoo-community.org/page/development-status
:alt: Beta
.. |badge2| image:: https://img.shields.io/badge/license-LGPL--3-blue.png
:target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html
:alt: License: LGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fweb--api-lightgray.png?logo=github
:target: https://github.com/OCA/web-api/tree/19.0/endpoint
:alt: OCA/web-api
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/web-api-19-0/web-api-19-0-endpoint
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/builds?repo=OCA/web-api&target_branch=19.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|

Provide an endpoint framework allowing users to define their own custom
endpoint.

Thanks to endpoint mixin the endpoint records are automatically
registered as real Odoo routes.

You can easily code what you want in the code snippet.

NOTE: for security reasons any kind of RPC call is blocked on endpoint
records.

**Table of contents**

.. contents::
:local:

Configuration
=============

Go to "Technical -> Endpoints" and create a new endpoint.

Known issues / Roadmap
======================

- add validation of request data
- add api docs generation
- handle multiple routes per endpoint

Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/OCA/web-api/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed
`feedback <https://github.com/OCA/web-api/issues/new?body=module:%20endpoint%0Aversion:%2019.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

Do not contact contributors directly about support or help with technical issues.

Credits
=======

Authors
-------

* Camptocamp

Contributors
------------

- Simone Orsi <simone.orsi@camptocamp.com>
- Alex Garcia <alex@studio73.es>

Maintainers
-----------

This module is maintained by the OCA.

.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org

OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.

.. |maintainer-simahawk| image:: https://github.com/simahawk.png?size=40px
:target: https://github.com/simahawk
:alt: simahawk

Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:

|maintainer-simahawk|

This module is part of the `OCA/web-api <https://github.com/OCA/web-api/tree/19.0/endpoint>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
2 changes: 2 additions & 0 deletions endpoint/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from . import controllers
from . import models
20 changes: 20 additions & 0 deletions endpoint/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Copyright 2021 Camptocamp SA
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).

{
"name": "Endpoint",
"summary": """Provide custom endpoint machinery.""",
"version": "19.0.1.0.0",
"license": "LGPL-3",
"development_status": "Beta",
"author": "Camptocamp,Odoo Community Association (OCA)",
"maintainers": ["simahawk"],
"website": "https://github.com/OCA/web-api",
"depends": ["endpoint_route_handler", "rpc_helper"],
"data": [
"data/server_action.xml",
"security/ir.model.access.csv",
"security/ir_rule.xml",
"views/endpoint_view.xml",
],
}
1 change: 1 addition & 0 deletions endpoint/controllers/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import main
54 changes: 54 additions & 0 deletions endpoint/controllers/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# Copyright 2021 Camptocamp SA
# @author: Simone Orsi <simone.orsi@camptocamp.com>
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).


import json

from werkzeug.exceptions import NotFound

from odoo import http
from odoo.http import Response, request


class EndpointControllerMixin:
def _handle_endpoint(self, env, model, endpoint_route, **params):
endpoint = self._find_endpoint(env, model, endpoint_route)
if not endpoint:
raise NotFound()
endpoint._validate_request(request)
result = endpoint._handle_request(request)
return self._handle_result(result)

def _handle_result(self, result):
response = result.get("response")
if isinstance(response, Response):
# Full response already provided
return response
payload = result.get("payload", "")
status = result.get("status_code", 200)
headers = result.get("headers", {})
return self._make_json_response(payload, headers=headers, status=status)

# TODO: probably not needed anymore as controllers are automatically registered
def _make_json_response(self, payload, headers=None, status=200, **kw):
# TODO: guess out type?
data = json.dumps(payload)
if headers is None:
headers = {}
headers["Content-Type"] = "application/json"
resp = request.make_response(data, headers=headers)
resp.status = str(status)
return resp

def _find_endpoint(self, env, model, endpoint_route):
return env[model]._find_endpoint(endpoint_route)

def auto_endpoint(self, model, endpoint_route, **params):
"""Default method to handle auto-generated endpoints"""
env = request.env
return self._handle_endpoint(env, model, endpoint_route, **params)


class EndpointController(http.Controller, EndpointControllerMixin):
pass
13 changes: 13 additions & 0 deletions endpoint/data/server_action.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo noupdate="1">
<record id="server_action_registry_sync" model="ir.actions.server">
<field name="name">Sync registry</field>
<field name="type">ir.actions.server</field>
<field name="model_id" ref="endpoint.model_endpoint_endpoint" />
<field name="binding_model_id" ref="endpoint.model_endpoint_endpoint" />
<field name="binding_type">action</field>
<field name="state">code</field>
<field name="code">records.write({"registry_sync": True})
</field>
</record>
</odoo>
Loading
Loading