Webhooks(A user-defined HTTP callbacks) allow you to subscribe to certain events that happen in odoo. When one of these events are triggered odoo will send a HTTP POST payload to the webhook's configured URL.
It uses both the OAuth1 and OAuth2 protocols to authenticate 3rd party applications.
Webhooks are a useful tool for apps that want to execute code after a specific event happens on an Odoo, for example, after a warehouse manager creates a new product, updates a stock quantity for existing products or sales manager confirm the quotation.
Instead of telling your app to make an API call every X number of minutes to check if a specific event has occurred on an Odoo, you can register webhooks, which send an HTTP request from the Odoo telling your app that the event has occurred. This uses many less API requests overall, allowing you to build more robust apps, and update your app instantly after a webhook is received.
Webhook event data can be stored as JSON or XML, and is commonly used when:
- Placing an order
- Changing a product’s price
- Collecting data for data-warehousing
- Integrating your accounting software
- Filtering the order items and informing various shippers about the order
Another, less-obvious, case for using webhooks is when you’re dealing with data that isn’t easily searchable through the Odoo API. For example, re-requesting an entire product catalogue or order history would benefit from using webhooks since it requires a lot of API requests and takes a lot of time. Think of it this way, if you would otherwise have to poll for a substantial amount of data, you should be using webhooks.
POST /restapi/1.0/common/oauth1/request_token (Temporary Credential Request endpoint)
GET /restapi/1.0/common/oauth1/authorize (Resource Owner Authorization endpoint)
POST /restapi/1.0/common/oauth1/access_token (Token Credentials Request endpoint)
- OAuth2 Authentication
GET /restapi/1.0/common/oauth2/authorize (Resource Owner Authorization endpoint)
POST /restapi/1.0/common/oauth2/access_token (Token Credentials Request endpoint)