Delete Records¶
Note
API endpoints:
- DELETE {your_Odoo_server_url}/restapi/1.0/object/{object_name}/{id} (Delete Single Record)
- DELETE {your_Odoo_server_url}/restapi/1.0/object/{object_name}?ids={comma_separated_ids} (Delete Record Set)
Delete Single Record¶
Record can be deleted using unlink(), it takes a record id to delete.
-
DELETE
/restapi/1.0/object/{object_name}/{id}
¶ Request:
DELETE /restapi/1.0/object/res.partner/20 HTTP/1.1 Host: {your_Odoo_server_url}
Response:
HTTP/1.1 200 OK {}
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
Delete List Records¶
Records can be deleted using unlink(), it takes a list of records to delete.
-
DELETE
/restapi/1.0/object/{object_name}?ids={comma_separated_ids}
¶ Request:
DELETE /restapi/1.0/object/res.partner?ids=17,20 HTTP/1.1 Host: {your_Odoo_server_url}
Response:
HTTP/1.1 200 OK {}
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