Tools to manage external api connections.
Project description
Base External API
This module provides tools for other modules to use the requests library for making external API calls.
With this module, you can:
Create an external API record and configure its URL and authentication_method parameters
Log every API call
Make asynchronous calls
Table of contents
Usage
To use this module, you need to create a new module with:
A data file that creates an External API Config with an external ID.
A python file with code that gets the External API Config and uses it to make an external call with the call() or queued_call() methods.
Some use cases of this module would be sending every new res partner record to, or sending every update in the price of the products, to a remote API.
The code of the first example would look like this:
<odoo noupdate="1">
<record id="your_external_api_external_id" model="external.api.config">
<field name="name">Your API Name</field>
<field name="base_url">https://www.test.com</field>
</record>
</odoo>
class ResPartner(models.Model):
_inherit = "res.partner"
def create(self, vals):
recs = super().write(vals)
if SYNCED_FIELDS.intersection(vals):
for rec in recs:
partner_json = rec.json() # Custom function to complete
self.env.ref(
'your_module.your_external_api_external_id'
).queued_call(
method="post",
url="/partner/create",
data=partner_json
)
return res
Known issues / Roadmap
This module could be extended to add the external_api_endpoint model, with the purpose to store in the database the diferent urls of the same API we can call, and some configuration data or extra information.
Bug Tracker
Bugs are tracked on GitHub 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.
Do not contact contributors directly about support or help with technical issues.
Credits
Contributors
-
Alberto Martínez
Valentin Vinagre
Harald Panten
Maintainers
This module is part of the sygel-technology/sy-server-backend project on GitHub.
You are welcome to contribute.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file odoo_addon_base_external_api-17.0.1.2.1-py3-none-any.whl.
File metadata
- Download URL: odoo_addon_base_external_api-17.0.1.2.1-py3-none-any.whl
- Upload date:
- Size: 49.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e135c7aede9260f45c0037ce87d55a4c7dcefff79805a563ccec48c293baa1d3
|
|
| MD5 |
5dfafe04cd7b1c08b184ab1ed79fd360
|
|
| BLAKE2b-256 |
548cf4fed6ea13f97d93149f640d0867dafb07817eda45dcfc7d4859fae31765
|