| Availability |
Odoo Online
Odoo.sh
On Premise
|
| Lines of code | 126 |
| Technical Name |
mrm_rest_api |
| License | LGPL-3 |
Rest API All System Full Access
REST API Documentation
Logged-in session
## Authentication
'''URL
/web/session/authenticate
```json
{
"jsonrpc": "2.0",
"params": {
"db": "odoo",
"login": "",
"password": ""
}
}
## Current Session info
'''URL
/web/session/get_session_info
## Logout
'''URL
/web/session/destroy
Use Odoo API keys.
**Header**
```
Authorization: Bearer (API_KEY)
Content-Type: application/json
```
Odoo applies normal access rights and record rules of the authenticated user.
## Endpoints
Base URL:
```
/api/(slug)
```
### Health
- **GET** `/api/health` → `{ "status": "ok" }`
### List
- **GET** `/api/(slug)?domain=(py-list)&fields=a,b,c&limit=80&offset=0&order=create_date desc`
- **Response**
```json
{
"count": 2,
"total": 125,
"limit": 80,
"offset": 0,
"results": [ { /* record with M2O expanded */ }, ... ]
}
```
**Notes**
- `domain` is a Python-style list, e.g. `[("state", "=", "sale")]` URL-encoded.
- `fields` is optional; if omitted, all readable fields are returned.
### Retrieve
- **GET** `/api/(slug)/(id)
- **Response**: a single record dict with many2one expanded.
### Create
- **POST** `/api/(slug)`
- **Body**: JSON of field values.
- **Response** `201`:
```json
{"id": 42, "record": { /* created record */ }}
```
### Update
- **PUT/PATCH** `/api/(slug)/(id)`
- **Body**: JSON of field values to update.
- **Response** `200`:
```json
{"id": 42, "record": { /* updated record */ }}
```
### Delete
- **DELETE** `/api/(slug)/(id)` → `{ "ok": true }`
## Examples
### 1) List confirmed sale orders (id, name, partner)
```
GET /api/sale_order?domain=[("state","=","sale")]&fields=id,name,partner_id
Authorization: Bearer (API_KEY)
```
**Response**
```json
{
"count": 1,
"total": 1,
"limit": 80,
"offset": 0,
"results": [
{"id": 5, "name": "SO005", "partner_id": {"id": 12, "name": "Azure Interior"}}
]
}
```
### 2) Create a CRM lead
```
POST /api/crm_lead
Authorization: Bearer (API_KEY)
Content-Type: application/json
{
"name": "New Opportunity",
"partner_id": {"id": 12},
"contact_name": "John Doe",
"email_from": "john@example.com",
"expected_revenue": 15000
}
```
### 3) Update a picking's scheduled date
```
PUT /api/stock_picking/77
Authorization: Bearer (API_KEY)
Content-Type: application/json
{"scheduled_date": "2025-09-05 10:00:00"}
```
### 4) Delete a purchase order draft
```
DELETE /api/purchase_order/31
Authorization: Bearer (API_KEY)
```
## Error format
```json
{"error": "message"}
```
Please log in to comment on this module