$ 9.95
Availability |
Odoo Online
Odoo.sh
On Premise
|
Lines of code | 651 |
Technical Name |
restful_api_odoo |
License | LGPL-3 |
Versions | 16.0 15.0 17.0 14.0 |
Restful API & Webhook
(Create, Update, Delete )
Manage Your Webhooks
This page provides you with an organized view of all your webhook records, making it easy to manage your webhook endpoints. Here, you can explore, update, and delete existing webhook configurations. Whether you need to monitor updates from external services or fine-tune your integration, this page is your hub for efficient management and control of webhook endpoints.
Create Webhook Endpoint
Here you can easily set up multiple webhook endpoints to receive real-time updates and notifications from external services and applications. Follow the simple steps to create and manage your webhook endpoints effortlessly.
Webhook Response Data
This page provides detailed information about a specific webhook response data entry. You can view and edit response data associated with a webhook endpoint, including response names, header data, and response content.
Manage Webhook Response
This section allows you to oversee and control the response data generated by your webhook endpoints. You can view, modify, and maintain the data generated as responses to your webhook requests.
API Examples
Get Access-Token import requests #url = " { base_url }/api/auth/token?login={user_name}&password={user_password}&db={db_name}" url = " { base_url }/api/auth/token?login=admin&password=admin&db=odoo16-1" payload = "" headers = {} response = requests.request("GET", url, headers=headers, data=payload) print(response.text) Response: { "uid": 2, "access_token": "access_token_a4e76f91d369acfd97dd71dfd2c4bxxxxxxxxxxxxx" }
Get Records (Filter, limit, offset, sort_order, fields)
import requests import json #url = "{ base url }/api/z3/ { model_name }" fields = "name,id,partner_id,date_order,tax_totals,order_line" # Fields list to fetch domain = "id:!=:1,date_order:=:2023-10-18" # Domain filter ****** Format ***** field_name : operator : value offset=3 limit = 2 # Number of records to fetch order="id desc" # Records sort by url = f"http://localhost:8069/api/z3/sale.order?fields={fields}&order={order}&offset={offset}&limit={limit}&domain={domain}" data = { "fields":["name"] } payload = json.dumps(data) headers = { 'Access-Token': 'access_token_6b9273e2c047d2a2113bc0862d14334d022b0200', 'Content-Type': 'application/json' } response = requests.request("GET", url, headers=headers, data=payload) print(response.text) # Response: # { # "count": 2, # "data": [ # { # "id": 5, # "name": "S00005", # "partner_id": [ # 10, # "Deco Addict" # ], # "date_order": "2023-10-18T15:04:00", # "tax_totals": { # "amount_untaxed": 405, # "amount_total": 465.75, # "formatted_amount_total": "$Â 465.75", # "formatted_amount_untaxed": "$Â 405.00", # "groups_by_subtotal": { # "Untaxed Amount": [ # { # "group_key": 1, # "tax_group_id": 1, # "tax_group_name": "Tax 15%", # "tax_group_amount": 60.75, # "tax_group_base_amount": 405, # "formatted_tax_group_amount": "$Â 60.75", # "formatted_tax_group_base_amount": "$Â 405.00" # } # ] # }, # "subtotals": [ # { # "name": "Untaxed Amount", # "amount": 405, # "formatted_amount": "$Â 405.00" # } # ], # "subtotals_order": [ # "Untaxed Amount" # ], # "display_tax_base": false # }, # "order_line": [ # 12 # ] # }, # { # "id": 2, # "name": "S00002", # "partner_id": [ # 12, # "Ready Mat" # ], # "date_order": "2023-10-18T15:04:00", # "tax_totals": { # "amount_untaxed": 2947.5, # "amount_total": 3389.63, # "formatted_amount_total": "$Â 3,389.63", # "formatted_amount_untaxed": "$Â 2,947.50", # "groups_by_subtotal": { # "Untaxed Amount": [ # { # "group_key": 1, # "tax_group_id": 1, # "tax_group_name": "Tax 15%", # "tax_group_amount": 442.13, # "tax_group_base_amount": 2947.5, # "formatted_tax_group_amount": "$Â 442.13", # "formatted_tax_group_base_amount": "$Â 2,947.50" # } # ] # }, # "subtotals": [ # { # "name": "Untaxed Amount", # "amount": 2947.5, # "formatted_amount": "$Â 2,947.50" # } # ], # "subtotals_order": [ # "Untaxed Amount" # ], # "display_tax_base": false # }, # "order_line": [ # 4, # 5 # ] # } # ] # }
Create a new record with child records. Basic sage: import requests import json #url = "{ base url }/api/z3/ { model_name }" url = "http://localhost:8069/api/z3/odoo.api.webhook" data = { "name": "Webhook New Name", "webhook_url": "test123450", "description": "Test Description data", "webhook_response_ids": [(0, 0, { "name": "Test Name Response", "header_data": "Header Data", "response_data": "Response Data" }), (0, 0, { "name": "Test Name Response 2", "header_data": "Header Data", "response_data": "Response Data" })] } payload = json.dumps(data) headers = { 'Access-Token': 'access_token_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', 'Content-Type': 'application/json' } response = requests.request("POST", url, headers=headers, data=payload)
import requests import json #url = "{ base_url }/api/z3/{ model }/{ recored_id }" url = "http://localhost:8069/api/z3/odoo.api.webhook/4" data = { "name": "Webhook Updated Name ", "webhook_url": "test12345012", } payload = json.dumps(data) headers = { 'Access-Token': 'access_token_a4e76f91d369acfd97dd71dfd2c4ba6d8d9763c9', 'Content-Type': 'application/json' } response = requests.request("PUT", url, headers=headers, data=payload)
import requests import json #url = "{ base_url }/api/z3/{ model }/{ recored_id }" url = "http://localhost:8069/api/z3/odoo.api.webhook/4" data = {} headers = { 'Access-Token': 'access_token_a4e76f91d369acfd97dd71dfd2c4ba6d8d9763c9', 'Content-Type': 'application/json' } response = requests.request("DELETE", url, headers=headers, data=data)
import requests import json #url = "{ base_url }/api/z3/{ model }/{ recored_id }/{ method_name }" url = "http://localhost:8069/api/z3/odoo.api.webhook/6/test_api_method" data = {} headers = { 'Access-Token': 'access_token_a4e76f91d369acfd97dd71dfd2c4ba6d8d9763c9', 'Content-Type': 'application/json' } payload = json.dumps(data) response = requests.request("PATCH", url, headers=headers, data=payload)
For Support
Please log in to comment on this module