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:
HTTP/1.1 200 OK
<fields type="dict">
<ean13 type="dict">
<type type="str">char</type>
<help type="str">Barcode</type>
<string type="str">EAN13</type>
</ean13>
<property_account_position_id type="dict">
<type type="str">many2one</type>
<help type="str">The fiscal position will determine taxes and accounts used for the partner.</type>
<string type="str">Fiscal Position</type>
</property_account_position_id>
<signup_valid type="dict">
<type type="str">boolean</type>
<help type="str"></type>
<string type="str">Signup Token is Valid</type>
</signup_valid>
<date_localization type="dict">
<type type="str">date</type>
<help type="str"></type>
<string type="str">Geo Localization Date</type>
</date_localization>
<ref_company_ids type="dict">
<type type="str">one2many</type>
<help type="str"></type>
<string type="str">Companies that refers to partner</type>
</ref_company_ids>
<sale_order_count type="dict">
<type type="str">integer</type>
<help type="str"></type>
<string type="str"># of Sales Order</type>
</sale_order_count>
<purchase_order_count type="dict">
<type type="str">integer</type>
<help type="str"></type>
<string type="str"># of Purchase Order</type>
</purchase_order_count>
</fields>
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