REST API for Webhook
Project description
REST API for Webhook
This module is base webhooks standard and keep all log that interface
Step to see logs:
Go to Settings > Technical > API Configuration > API Logs
this table will keep all log that interface ‘/api/create_data’ or ‘/api/create_update_data’
Users can used this table for test API by click ‘Update API’
Table of contents
Usage
Before sending a REST API request to Odoo, an initial call to authenticate the API is necessary. You can achieve this by calling the /web/session/authenticate route.
The authentication format requires a header with Content-type set to application/json, and the body should include:
{
"jsonrpc": "2.0",
"method": "call",
"params": {
"db": "<db_name>",
"login": "<username>",
"password": "<password>"
}
}
Following successful authentication, you can proceed with five API routes:
/api/create_data: This route allows the creation of new data only. The format for creating data should be in the following structure:
{ "params": { "model": "<model name>", "vals": { "payload": { "field1": "value1", ... }, "result_field": ["field1", ...] # optional } } }/api/create_update_data: This route facilitates updating data. If the data does not exist, it will automatically create it. The format follows that of create_data, but it requires a unique key in the field to update the values.
{ "params": { "model": "<model name>", "vals": { "search_key": { "<key_field>": "value", # can be ID or name search string }, "payload": { "field1": "value1", ... }, "result_field": ["field1", ...] # optional } } }/api/update_data: This route allows updating existing data, using a unique key in the field to find the desired data and update values in that recordset.
{ "params": { "model": "<model name>", "vals": { "search_key": { "<key_field>": "value", # can be ID or name search string }, "payload": { "field1": "value1", ... } } } }/api/search_data: This route allows you to search for the value of a desired field in a model by using a search domain to find the desired recordset. You can also limit and order the resulting data.
{ "params": { "model": "<model name>", "vals": { "payload": { "search_field": ["field1", "field2", "field3{subfield1, subfield2}", ...], "search_domain": "[('field', 'operator', 'value')]", "limit": 1, "order": "field1 , field2 desc, ..." } } } }/api/call_function: This route allows you to call a function on a model object based on the provided input.
- Parameters:
name (str): The name of the model to perform the function on.
method (str): The name of the function to call.
parameter (dict): A dictionary containing the arguments to pass to the function (if any).
{ "params": { "model": "<model name>", "vals": { "search_key": { "<key_field>": "value", # can be ID or name search string }, "payload": { "method": "<method>", "parameter": {"<key>": "<value>", ...} } } } }
Note: If you want to attach a file to a record, you can add the key “attachment_ids” at any level of the payload.
Example Request with Attachment:
{ "params": { "model": "<model name>", "vals": { "search_key": { "<key_field>": "value", # can be ID or name search string }, "payload": { "attachment_ids": [ { "name": "<file_name>", "datas": "<base64_encoded_data>" } ], ... } } } }
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
Kitti Upariphutthiphong <kittiu@ecosoft.co.th>
Saran Lim. <saranl@ecosoft.co.th>
Maintainers
This module is part of the ecosoft-odoo/ecosoft-addons 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_usability_webhooks-15.0.1.1.0-py3-none-any.whl.
File metadata
- Download URL: odoo_addon_usability_webhooks-15.0.1.1.0-py3-none-any.whl
- Upload date:
- Size: 38.2 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 |
d78dbfb072cdd771bb25821944fc9e00ec70e1fe9aada6204aecf75c7714b455
|
|
| MD5 |
5760c35d1b09a10c64c0ba1cb8e89e75
|
|
| BLAKE2b-256 |
9d22bf08e606e047fe729b511e1a0736ac6d25f584772ac51045900f7f0de96f
|