API Response Explore
API Return by Field Type
This section describes model API return values (/getById, /getByIds, /searchList, /searchPage) by field type.
By default, ModelController uses ConvertType.REFERENCE.
Option / MultiOption
Default API return (OptionReference):
Option->OptionReferenceobject:
{ "itemCode": "ACTIVE", "itemName": "Active", "itemColor": "green" }MultiOption->List<OptionReference>:
[
{ "itemCode": "A", "itemName": "Tag A", "itemColor": "" },
{ "itemCode": "B", "itemName": "Tag B", "itemColor": "" }
]OptionReferenceFields:
itemCode: option item code.itemName: option item display name.itemColor: optional color string.
File / MultiFile
Default API return (FileInfo):
File->FileInfoobject.MultiFile->List<FileInfo>.
Typical FileInfo fields include:
fileIdfileNamesizeurl
Example:
{
"avatar": { "fileId": 1001, "fileName": "a.png", "url": "..." },
"attachments": [
{ "fileId": 2001, "fileName": "doc.pdf", "url": "..." },
{ "fileId": 2002, "fileName": "spec.docx", "url": "..." }
]
}ManyToOne / OneToOne
Default API return (ModelReference, no SubQuery):
ManyToOne/OneToOne->ModelReferenceobject:
{ "id": 3001, "displayName": "Engineering" }With SubQuery:
- Return value becomes a row map of the related model (not
ModelReference). - Returned map includes related model
id, displayName fields, andSubQuery.fields.
ModelReference fields:
id: related row id.displayName: related row display name.
ManyToMany / OneToMany
Default API return (ModelReference, no SubQuery):
OneToMany/ManyToMany->List<ModelReference>, default behavior insearchPageAPI. The summary data of ManyToMany/OneToMany fields can be displayed in the data list.
Examples:
{
"projects": [
{ "id": 5001, "displayName": "Project Alpha" },
{ "id": 5002, "displayName": "Project Beta" }
],
"orderLines": [
{ "id": 7001, "displayName": "Line A" },
{ "id": 7002, "displayName": "Line B" }
]
}With SubQuery:
ManyToMany/OneToManyboth returnList<Map>of related rows.- If
count=true, return integer count instead of rows.
ConvertType Reference
ConvertType controls how field values are formatted when reading data (search/get/copy and fetch APIs). It affects boolean/option fields and relational fields, and it also controls whether the relations are expanded or represented as references.
Notes:
QueryParamsdoes not exposeconvertType. The web layer setsConvertType.REFERENCEby default. To use otherConvertTypevalues, call the service layer withFlexQuerydirectly.- Filters and orders follow the same formats as top-level
filtersandorders(Filterslist format andOrderslist or string format).
ConvertType Values
ORIGINAL- returns the raw database value without formatting. Typical use cases: diagnostics or retrieving original ciphertext before decryption.TYPE_CAST(default inFlexQuery) - standard conversion based on fieldFype (for example, numeric/string/boolean/json type casting). Computed fields and dynamic cascaded fields are evaluated. Relational fields are not expanded to display values by default.DISPLAY- converts Boolean/Option/MultiOption and ManyToOne/OneToOne fields into display values (human-readable strings). OneToMany/ManyToMany default expansion (when no SubQuery is provided) returns display values.REFERENCE- converts Option/MultiOption and ManyToOne/OneToOne fields into reference objects (OptionReferencefor option fields andModelReferencefor relational fields). OneToMany/ManyToMany default expansion (when no SubQuery is provided) returns a list ofModelReferenceobjects.
Defaults backend & API behavior
FlexQuerydefaults toTYPE_CASTif not explicitly set.- Web APIs (
/searchList,/searchPage,/getById,/getByIds, etc.) typically setConvertType.REFERENCEto return references for relational fields. - For OneToMany/ManyToMany fields:
- If a SubQuery is provided, related rows are expanded according to SubQuery fields/filters.
- If no SubQuery is provided and
convertTypeisDISPLAY, OneToMany/ManyToMany returns a list of display strings. - If no SubQuery is provided and
convertTypeisREFERENCE, OneToMany/ManyToMany returns a list ofModelReferenceobjects.
Boolean
| ConvertType | Return value |
|---|---|
ORIGINAL | Raw stored value (no formatting). |
TYPE_CAST | Boolean true/false. |
DISPLAY | Boolean display name from the boolean option set (if configured); otherwise same as TYPE_CAST. |
REFERENCE | Boolean true/false (no reference object for boolean). |
Option / MultiOption
| ConvertType | Option (single) | MultiOption |
|---|---|---|
ORIGINAL | Raw stored item code. | Raw stored string (comma-separated). |
TYPE_CAST | Item code string. | List<String> of item codes. |
DISPLAY | Item display name. | Comma-joined display names (string). |
REFERENCE | OptionReference (itemCode, itemName, itemColor). | List<OptionReference>. |
ManyToOne / OneToOne
-
No SubQuery: | ConvertType | Return value | | --- | --- | |
ORIGINAL| Raw related id (no expansion). | |TYPE_CAST| Related id (formatted by type). | |DISPLAY| Related display name (string). | |REFERENCE|ModelReference(id,displayName). | -
With SubQuery: Return value is always a related row map instead of a display name or
ModelReference. The map is built using the sameconvertType(so nested option/relational fields follow thatconvertType). The returned fields include the related modelid, all display-name fields, and any fields specified inSubQuery.fields.
OneToMany / ManyToMany
-
Not in
QueryParams.fieldsand no SubQuery For OneToMany/ManyToMany fields, they would not be appear in the response if not specified inQueryParams.fieldsnor insubQueries. -
In
QueryParams.fields, no SubQuery: | ConvertType | OneToMany | ManyToMany | | --- | --- | --- | |TYPE_CAST|List<Map>of related model rows (all stored fields). |List<Map>of related model rows (all stored fields). | |DISPLAY|List<Map>containingdisplayNameplus display fields and id (and the related field used for grouping). |List<String>of display names. | |REFERENCE|List<Map>containingdisplayNameplus display fields and id (and the related field used for grouping). |List<ModelReference>. | -
With SubQuery:
-
If
count = true, return an integer count per parent row. SubQueryfiltersare applied to the count. -
Otherwise return related rows as
List<Map>. -
If
SubQuery.fieldsis empty, all stored fields of the related model are returned by default. -
If
SubQuery.fieldsis specified, those fields are returned, andidis automatically included. For OneToMany, the related field used for grouping is also present. -
Nested
subQueriesare applied recursively to the related model.