Read Single Record
Record data is accessible via the read(), which takes a single record id and optionally a list of fields to fetch. By default, it will fetch all the fields the current user can read, which tends to be a huge amount.
GET /restapi/1.0/object/{object_name}/{id}
Request:
GET /restapi/1.0/object/res.partner/12 HTTP/1.1
Host: {your_Odoo_server_url}JSON Response:
HTTP/1.1 200 OK
{
'Partner': {
'id': 12,
'name': 'Think Big Systems',
'street': '89 Lingfield Tower',
'street2': false,
'city': 'London',
'state_id': false,
'zip': false,
'country_id': [486, 'United Kingdom'],
'create_date': '2017-07-10 11:02:57',
'create_uid': [1, 'Administrator'],
'write_date': '2017-07-11 15:08:45',
'write_uid': [1, 'Administrator'],
...
...
...
}
}XML Response:
Query Parameters:
fields – OPTIONAL. list of field names to return (default is all fields).
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 the request
Status Codes
200 OK – no error
404 Not Found – there’s no resource
401 Unauthorized – authentication failed
403 Forbidden – if any error raise
Conversely, picking only three fields deemed interesting.
Request:
JSON Response:
Note
even if the
idfield is not requested, it is always returned
Last updated