Odoo REST API - DEMO
Visit API website. This demo is based on Odoo v14 CE, all API features are identical in all Odoo versions.
>>> Endpoints DOCUMENTATION, online TESTS & EXAMPLES
>>> Simple REST Client example (Python)
>>> Custom API route/endpoint example
Quick 'Curl' tests:
1. Login in Odoo and get access token:
curl -i -H "Content-Type: text/html" -X GET "https://rest-api-demo.root.sx/api/auth/get_tokens" -d '{"username":"demo", "password":"demo"}'
- this will return 'access_token' (besides other data), it should be used in all other API calls.
4. res.partner - Read all (without filters):
curl -i -H "Content-Type: text/html" -X GET "https://rest-api-demo.root.sx/api/res.partner" -H "Access-Token: 4ffd0e156d4f8042d1ec0dabb1ed7c5946514131"
5. res.partner - Read all (with two filters):
curl -i -H "Content-Type: text/html" -X GET "https://rest-api-demo.root.sx/api/res.partner" -H "Access-Token: 4ffd0e156d4f8042d1ec0dabb1ed7c5946514131" -d '{"filters": [["name", "like", "don"], ["id", "<=", 50]]}'
6. sale.order - Read one:
curl -i -H "Content-Type: text/html" -X GET "https://rest-api-demo.root.sx/api/sale.order/21" -H "Access-Token: 4ffd0e156d4f8042d1ec0dabb1ed7c5946514131"
7. res.partner - Create one:
curl -i -H "Content-Type: text/html" -X POST "https://rest-api-demo.root.sx/api/res.partner" -H "Access-Token: 4ffd0e156d4f8042d1ec0dabb1ed7c5946514131" -d '{"name": "TEST Name", "street": "TEST Street", "city": "TEST City"}'
8. res.partner - Update one:
curl -i -H "Content-Type: text/html" -X PUT "https://rest-api-demo.root.sx/api/res.partner/55" -H "Access-Token: 4ffd0e156d4f8042d1ec0dabb1ed7c5946514131" -d '{"name": "TEST Name~~", "street": "TEST Street~~", "city": "TEST City~~"}'
9. res.partner - Delete multi:
curl -i -H "Content-Type: text/html" -X DELETE "https://rest-api-demo.root.sx/api/res.partner/57,58,59" -H "Access-Token: 4ffd0e156d4f8042d1ec0dabb1ed7c5946514131"
10. res.partner - Call method 'address_get' (without parameters):
curl -i -H "Content-Type: text/html" -X PUT "https://rest-api-demo.root.sx/api/res.partner/7/address_get" -H "Access-Token: 4ffd0e156d4f8042d1ec0dabb1ed7c5946514131"
11. res.partner - Call method '_email_send' (with parameters and context):
curl -i -H "Content-Type: text/html" -X PUT "https://rest-api-demo.root.sx/api/res.partner/7/_email_send" -H "Access-Token: 4ffd0e156d4f8042d1ec0dabb1ed7c5946514131" -d '{"email_from": "test@test.com", "subject": "TEST Subject", "body": "TEST Body", "__context__": {"lang": "en_US"}}'
12. report - Call method 'get_pdf' (with parameters):
curl -i -H "Content-Type: text/html" -X GET "https://rest-api-demo.root.sx/api/report/get_pdf" -H "Access-Token: 4ffd0e156d4f8042d1ec0dabb1ed7c5946514131" -d '{"report_name": "account.report_invoice", "ids": [3]}'