Listing Record Fields
fields_get() can be used to inspect a model’s fields and check which ones seem to be of interest.
Because it returns a large amount of meta-information (it is also used by client programs) it should be filtered before printing, the most interesting items for a human user are string (the field’s label), help (a help text if available) and type (to know which values to expect, or to send when updating a record).
GET /restapi/1.0/object/{object_name}/fields_get
Request:
GET /restapi/1.0/object/res.partner/fields_get?allfields=[]&attributes=['string','help','type'] HTTP/1.1
Host: {your_Odoo_server_url}JSON Response:
HTTP/1.1 200 OK
{
'fields': {
'ean13': {
'type': 'char',
'help': 'BarCode',
'string': 'EAN13'
},
'property_account_position_id': {
'type': 'many2one',
'help': 'The fiscal position will determine taxes and accounts used for the partner.',
'string': 'Fiscal Position'
},
'signup_valid': {
'type': 'boolean',
'help': '',
'string': 'Signup Token is Valid'
},
'date_localization': {
'type": 'date',
'help": '',
'string': 'Geo Localization Date'
},
'ref_company_ids': {
'type': 'one2many',
'help': '',
'string': 'Companies that refers to partner'
},
'sale_order_count': {
'type': 'integer',
'help': '',
'string': '# of Sales Order'
},
'purchase_order_count': {
'type': 'integer',
'help': '',
'string': '# of Purchase Order'
}
}
}XML Response:
Query Parameters:
allfields – OPTIONAL. list of fields to document, all if empty or not provided
attributes – OPTIONAL. list of description attributes to return for each field, all if empty or not provided
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
Last updated