Skip to main content

Data plugins

Data plugins post-process result data after an API finishes executing and before the response is returned. They do not change the SQL or the API logic, only "what is returned". Common uses: masking sensitive fields, renaming fields, converting codes into text, turning lists into trees, and picking a single record from multiple results.

Entry point​

Click "Data plugins" on the right side of the workbench in any development mode. Plugins are organized into three groups:

CategoryPlugins
Data processingFilter and clean, value formatting, value replacement, field merge
Data mappingField renaming, dictionary conversion
Result transformationTree structure, multi-level nesting, single object

Each plugin has its own switch; the configuration takes effect only after the plugin is enabled. Click "Save configuration" to write it into the API definition, then you still need to save and release the API.

Result transformation plugins are mutually exclusive

Only one of tree structure, multi-level nesting and single object can be enabled. Switching prompts you to disable the currently enabled plugin.

Execution order​

When multiple plugins are enabled at the same time, they execute in a fixed order:

OrderPlugin
1Field renaming (fieldMapping)
2Filter and clean (dataProcess)
3Dictionary conversion (dictTransform)
4Value formatting (fieldFormat)
5Value replacement (fieldReplace)
6Field merge (dataMerge)
7Tree structure (treeTransform)
8Single object (singleObject)
9Multi-level nesting (nestedStructure)

This means later plugins see the field names and values produced by earlier ones, so design configurations according to the actual order.

Filter and clean​

Runs rules against the result list; multiple rules can be added and run in the order they were added:

Rule typeConfigurationDescription
Data filterField, operator, valueKeep only records that satisfy the condition
Data sortField, ascending/descendingSort by field
Data maskingFields (multiple allowed), masking typeMask field values
Field calculationSource field, operator, operand, new field nameCompute or concatenate and write into a new field

Operators: equals, not equals, greater than, less than, greater than or equal to, less than or equal to, contains, not contains, is empty, is not empty. Calculation operators: +, -, *, /, concat.

Masking types:

TypeApplies to
Generic maskingAny string
Phone numberMobile phone numbers
ID card numberID cards
EmailEmail addresses
Bank cardCard numbers
NamePersonal names
AddressAddress text

For calculation rules, the "new field name" can be the same as the old field to overwrite the original value.

Field renaming​

Maps source fields to new field names:

ConfigurationDescription
Source fieldSelected from the current response parameter tree
Target fieldNew field name
Default valueFallback when the source field is empty
Delete source fieldWhen checked, the original field is removed once the mapping completes

Multiple mappings run in list order. If target field names duplicate, later mappings overwrite earlier values.

Dictionary conversion​

Converts coded values into readable text:

  • Select the source field and target field (if the target is left empty, the source field is overwritten).
  • Maintain "original value → display value" mappings one by one.
  • The default value is used when no mapping matches.
  • If "Keep original field" is checked, the source field is preserved; otherwise it is replaced with the converted result.

Suitable for status codes, type codes, region codes and similar cases.

Value formatting​

FormatDescriptionExample template
Date and timeFormats dates by templateyyyy-MM-dd HH:mm:ss
AmountAmount with thousands separators#,##0.00
PercentagePercentage displayAs prompted on the page
NumberNumber format#,##0.00
To uppercaseUppercase string—
To lowercaseLowercase string—
Trim spacesRemoves leading and trailing spaces—

Dates, amounts and numbers require a format template.

Value replacement​

Replaces field values by condition:

Match typeDescription
EqualsThe value is exactly equal
ContainsContains the target text
Starts withBegins with the target text
Ends withEnds with the target text
Regex matchMatches the regular expression
Replace when emptyThe field is null
Replace when empty stringThe field is an empty string

When a rule matches, the replacement value is written. Useful for turning null into - consistently, converting abnormal values into fixed text, and similar cases.

Field merge​

Concatenates multiple fields into a new field:

  • Select multiple source fields.
  • Set the target field name.
  • Optionally set a separator (such as - or a space).
  • Optionally delete the source fields after merging.

Source fields are concatenated in selection order, and empty values are treated as empty strings.

Tree structure​

Converts a flat parent-child list into a tree:

ConfigurationDescription
Node ID fieldUnique identifier field
Parent node ID fieldPoints to the parent node ID
Child node field nameField name that holds children; defaults to children
Root node IDThe value used as the root starting point; if left empty, nodes whose parent ID is missing or self-referencing are treated as roots

Suitable for hierarchical data such as menus, departments and regions. Cycles in the data may cause nodes to be lost, so make sure parent-child relationships are valid before configuring.

Multi-level nesting​

Collapses a list into multiple levels of children by one or more grouping fields:

  • For each level, configure the grouping field, the children field name, the label field and the display field.
  • Levels are nested in configuration order.
  • Optionally keep the original fields of leaf nodes; if not kept, only the specified leaf display fields are output.

Difference from tree structure: tree restores hierarchy from parent-child IDs, while multi-level nesting regroups records by grouping fields.

Single object​

Converts a result set into a single object:

ModeDescription
First recordReturns the first record of the list directly
Conditional matchFilters by field, operator and target value, then returns the first record

Returns null when the result set is empty. Suitable for APIs such as "detail queries" that should return a single record.

Field paths and nested results​

Plugin fields come from the "Response parameters" tree and support full paths such as data.user.phone. The platform locates the actual list or object, runs the plugin at that level and then writes the result back into the original response structure. So when masking or mapping fields inside nested objects, simply select the full path.

Failures and troubleshooting​

  • If a plugin throws internally, the platform logs the error and returns the unprocessed original data rather than failing the API. Always verify results with a test or a real call after configuring.
  • Plugins process only the data part of the execution result; wrapper fields such as pagination and total counts are maintained by the platform.
  • After you change response parameters, previously selected fields in plugins may become invalid and must be reselected.
  • Plugin configuration is stored in the API definition and takes effect with version releases and migrations.

FAQ​

SymptomCauseResolution
The plugin does not take effectThe switch is off or the configuration was not savedTurn on the switch, save the configuration, then save the API
A masked field disappearsField renaming or replacement is also enabledCheck the execution order and field names
Dictionary conversion does not matchThe original value type or letter case differsConfigure mappings for the actual values or set a default value
The list is not converted into a treeParent-child fields are misconfigured or the data contains cyclesVerify the ID and parent ID, and clean up invalid data
The single object returns nullNo condition matches or the result is emptyCheck the filter conditions
Enabling a second result transformation plugin is blockedResult transformation plugins are mutually exclusiveDisable the current plugin before enabling another