WebService Core
webservice_core · OCA/web-api
-
Security25/25No findings
-
Activity25/25Human commit this month
-
Required by20/252 modules depend on it
-
Maturity5/25In 1 Odoo series since 18.0
Heuristic over the facts below, not an audit · How it's computed
Migration considerations
WebserviceBackend— Migrating to 19.0: `_sql_constraints` is ignored and its constraints are silently not created: declare `models.Constraint` attributes instead. migration-sql-constraints · sourceWebserviceEndpoint— Migrating to 19.0: `_sql_constraints` is ignored and its constraints are silently not created: declare `models.Constraint` attributes instead. migration-sql-constraints · source
Migration review checklist, not a compatibility verdict. "Migrating to X.0" applies once you upgrade to that version; "Since X.0" means this version already ignores or rejects that code. Methodology
Description
This module provides the webservice.backend model with its authentication
(public, username/password, API key) and HTTP call features (get/post/put/delete).
It has no dependency on component or server_environment, so it can be used
as a lightweight building block by any module needing to configure and call
an outbound webservice, without pulling in extra frameworks.
On top of a backend, you can configure specific, named webservice.endpoint
records via the UI, instead of only building calls in Python via
webservice.backend.call(method, url_args, ...). Each endpoint bundles a
required description, a fixed HTTP method and relative path (appended to the
backend URL), static headers, and an optional authentication override, fully
independent from the backend's. Endpoints are called with endpoint.call(...);
calling the backend directly with backend.call(method, ...) remains fully
supported.
Dependencies
- Odoo dependencies
-
odoo/odoo:- base
- Python dependencies
- openupgradelib, requests
- System dependencies
- None
- Required by
- edi_webservice_core_oca, webservice
Code analysis
Extracted from the source by best-effort static analysis (no code is executed); details may be incomplete.
Views touched 6
| XML ID | Name | Model | Type | Status |
|---|---|---|---|---|
webservice_backend_form_view |
webservice.backend.form (in webservice_core) | webservice.backend | form | New |
webservice_backend_search_view |
webservice.backend.search (in webservice_core) | webservice.backend | search | New |
webservice_backend_tree_view |
webservice.backend.tree (in webservice_core) | webservice.backend | list | New |
webservice_endpoint_form_view |
webservice.endpoint.form (in webservice_core) | webservice.endpoint | form | New |
webservice_endpoint_search_view |
webservice.endpoint.search (in webservice_core) | webservice.endpoint | search | New |
webservice_endpoint_tree_view |
webservice.endpoint.tree (in webservice_core) | webservice.endpoint | list | New |
HTTP endpoints 0
No HTTP endpoints found for this module.
Models touched 5
-
company_idMany2one → res.companystring='Company' args: 'res.company' -
endpoint_countIntegercompute='_compute_endpoint_count' -
endpoint_idsOne2many → webservice.endpointstring='Endpoints' args: 'webservice.endpoint', 'backend_id' -
nameCharrequired=True -
urlCharrequired=True
-
action_view_endpoints(self)
-
activeBooleandefault=True -
auth_typeSelectionrequired=False -
backend_idMany2one → webservice.backendindex=Trueondelete='cascade'required=True args: 'webservice.backend' -
company_idMany2onereadonly=Truerelated='backend_id.company_id'store=True -
descriptionTextrequired=True -
http_methodSelectiondefault='get'required=True args: [('get', 'GET'), ('post', 'POST'), ('put', 'PUT'), ('delete', 'DELETE')] -
nameCharrequired=True -
override_authBooleanhelp="Use this endpoint's own authentication instead of the backend's."string='Override Authentication' -
pathCharhelp="Relative path appended to the backend URL. Supports the same '{placeholder}' syntax as the backend URL." -
protocolSelectiondefault='http' -
tech_nameCharrequired=True
-
call(self, url_params=None, **kwargs)
-
nameCharrequired=True -
res_idMany2oneReferenceindex=Truemodel_field='res_model'required=Truestring='Record' -
res_modelCharindex=Truerequired=True -
secretBooleanhelp='The value is a secret (e.g. a token or a key): it is hidden in the UI and dropped when the database is neutralized.' -
valueCharrequired=True
No public methods.
-
nameCharrequired=True -
res_idMany2oneReferenceindex=Truemodel_field='res_model'required=Truestring='Record' -
res_modelCharindex=Truerequired=True -
secretBooleanhelp='The value is a secret (e.g. a token or a key): it is hidden in the UI and dropped when the database is neutralized.' -
valueCharrequired=True
No public methods.
-
api_keyCharauth_type='api_key'string='API Key' -
api_key_headerCharauth_type='api_key'string='API Key header' -
auth_typeSelectionrequired=Trueselection=[('none', 'Public'), ('user_pwd', 'Username & password'), ('api_key', 'API Key')] -
content_typeSelectionargs: [('application/json', 'JSON'), ('application/xml', 'XML'), ('application/x-www-form-urlencoded', 'Form')] -
full_url_displayCharcompute='_compute_full_url_display'help="Best-effort absolute URL, ready to copy/paste. Any '{placeholder}' token is left unresolved: fill it in before use." -
header_idsOne2many → webservice.headerdomain=<expr>help='Static default headers, merged into every call. An explicit `headers` kwarg passed to `call()` wins over these.'string='Headers' args: 'webservice.header', 'res_id' -
passwordCharauth_type='user_pwd' -
protocolSelectionrequired=True args: [('http', 'HTTP Request')] -
querystring_param_idsOne2many → webservice.querystring.paramdomain=<expr>help="Static default querystring params, merged into every call. An explicit `params` kwarg passed to `call()` wins over these. A value may contain a '{placeholder}' resolved against the same values used to fill the URL path (the `url_params` kwarg)."string='Querystring Params' args: 'webservice.querystring.param', 'res_id' -
tech_nameCharcopy=Falsehelp='Unique name for technical purposes. Automatically generated from the name if left empty.'required=True -
timeoutFloathelp='Timeout in seconds for the whole request (connect + read). An explicit `timeout` kwarg passed to `call()` wins over this. Left empty, the call waits indefinitely.' -
usernameCharauth_type='user_pwd'
-
call(self, method, *args, **kwargs) -
call_delete(self, **kwargs) -
call_get(self, **kwargs) -
call_post(self, **kwargs) -
call_put(self, **kwargs) -
create(self, vals_list)@api.model_create_multi -
write(self, vals)
Loading…