Rest API
  • Odoo REST API: Version 1.0 documentation
  • Connection
    • Configuration
    • Demo
    • Logging In
      • How you can do
        • Odoo Version Information
        • Oauth1 Authentication
        • OAuth2 Authentication
        • Basic Authentication
  • Calling Methods
    • Check Access Rights
    • List Records
      • Pagination
    • Count Records
    • Read Records
      • Read Single Record
      • Read List Records
      • Read Filter Records
    • Listing Record Fields
    • Create Records
    • Update Records
      • Update Single Record
      • Update List Records
    • Delete Records
      • Delete Single Record
      • Delete List Records
  • Report Printing
    • Print Single Report
    • Print List Reports
  • Inspection and Introspection
    • ir.model
    • ir.model.fields
Powered by GitBook
On this page
  1. Calling Methods

Listing Record Fields

PreviousRead Filter RecordsNextCreate Records

Last updated 1 year ago

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

Headers and Status Codes
Description

Request Headers

Response Headers

Status Codes

– the response content type depends on Accept header

– The OAuth protocol parameters to authenticate.

– this depends on Accept header of the request

– no error

– there’s no resource

– authentication failed

– if any error raise

fields_get()
Accept
Authorization
Content-Type
200 OK
404 Not Found
401 Unauthorized
403 Forbidden