Create a new Webhook¶
Webhooks of a model are created by mapping of fields to values.
-
POST
/restapi/1.0/webhooks?vals={values_for_the_object's_fields}
¶ Request:
POST /restapi/1.0/webhooks?vals={'name':'Delivery Order Updation','model':'stock.picking','kind':'on_write','address':'https://requestbin.net/152eq5l1','format':'json','language':'en_US','condition':[('state', '=', 'done'), ('picking_type_id.code', '=', 'outgoing')]} HTTP/1.1 Host: <your Odoo server url>
Response:
HTTP/1.1 200 OK { 'webhook': { 'id': 20, 'name': 'Delivery Order Updation', 'model': 'stock.picking', 'kind': 'on_write', 'address': 'https://requestbin.net/152eq5l1', 'format': 'json', 'language': 'en_US', 'fields': [], 'condition': [('state', '=', 'done'), ('picking_type_id.code', '=', 'outgoing')], 'create_date': '2017-11-28 15:10:36', 'write_date': '2017-11-28 15:10:36' } }
Query Parameters: - vals – values for the object’s fields, as a dictionary::
{'field_name': field_value, ...}
see write() for details.
Request Headers: - Accept – the response content type depends on Accept header
- Authorization – The OAuth protocol parameters to authenticate.
Response Headers: - Content-Type – this depends on Accept header of request
Status Codes: - 200 OK – no error
- 404 Not Found – there’s no resource
- 401 Unauthorized – authentication failed
- 403 Forbidden – if any error raise
- vals – values for the object’s fields, as a dictionary::