The API is self describing in that it provides metadata about the various fields available at any given endpoint. External applications (such as the python interface) can introspect the API to determine information about the model fields.
The various forms implemented in the InvenTree web interface make heavy use of this metadata feature
To request metadata about a particular API endpoint, simply perform an
OPTIONS method request against the API URL.
For example, to view the metadata available for creating a new Part Category, an
OPTIONS request to
You can see here a detailed list of the various fields which are available for this API endpoint.
OPTIONS endpoint provides the following information:
|name||The human-readable name of the API endpoint|
|description||Descriptive detail for the endpoint, extracted from the python docstring|
|actions||Contains the available HTTP actions and field information (see below)|
Specific details are provided on the available attributes of each field:
Supported field types are:
|boolean||true / false value|
|float||Floating point numbers|
|related field||Primary key value for a foreign-key relationship in the database|
Each named field provides information on available attributes:
|type||Defines the field type|
|default||The default value for this field. Will be assumed if no value is supplied|
|required||Boolean value, whether this field must be supplied|
|read_only||Boolean value, whether this field is writeable|
|label||Human readable descriptive label for this field.|
|help_text||Long form descriptor for this field.|
|min_value||Minimum allowed value (for numeric fields)|
|max_value||Maximum allowed value (for numeric fields)|
|max_length||Maximum allowed length (for text fields)|
|model||Name of the database model, if this field represents a foreign-key relationship|
|api_url||API url for the related model, if this field represents a foreign-key relationship|
|filters||API filters for the field, if this field represents a foreign-key relationship|
The field name is the key used to define the field itself
Some attributes may not be made available for a particular field
Field label and help text values are localized using the community contributed translations. The required locale information is determined from the API request itself, meaning that the translated values are provided automatically.
For example, the same forms (in the web interface) are served via identical API requests, with the locale information determined "on the fly":