Data grids API
Customizer allows to configure reference data that can be referenced by configurator implementations. For example, data grids could provide a way of managing and loading data such as:
Personalization colors
Embroidery threads
Data mapping
Data grids are uploaded and edited using Customizer Admin, and specific values can be retrieved using the REST API.
The REST API corresponds to queryDataGrid Controller class method.
Target URL
The data grid query endpoint format is:
/api/v2/blueprint/query/datagrid
Method
Data grid API requests shall be done using POST HTTP method.
Inbound payload
The inbound payload to the data grid query shall describe the requested data grid; a set of data filters; and a set of desired returned data. The input shall be a JSON object that includes following parameters:
{
"from": "grid",
"filter": <filters>,
"selectFields": <array of field names>,
"take": <number of rows to return>,
"skip": <number of rows to skip>
}
The parameters include:
Parameter | Description |
|---|---|
from | Data grid ID |
filter | Filters to apply to the data grid table |
selectFields | An optional array of field names to return |
take | Paging parameters, maximum number of results to return |
skip | Paging parameters, number of rows to skip |
Filter specification
A filter can be one of two forms:
Composite filter
A filter that groups multiple sub-filters under a logical operator (and or or).
{
"and": [
/* array of sub-filters (each sub-filter can be Composite or Leaf) */
]
}
{
"or": [
/* array of sub-filters (each sub-filter can be Composite or Leaf) */
]
}
For example:
{
"and": [
{ "field": "Status", "op": "Equal", "value": "Active" },
{
"or": [
{ "field": "Category", "op": "BeginsWith", "value": "H" },
{ "field": "Priority", "op": "NotEqual", "value": "Low" }
]
}
]
}
Leaf filter
A single condition comparing a field to a value using an operator (op).
{
"field": "<string>",
"op": "<operator>",
"value": <any>
}
Where:
field: A string representing the field/property to filter on.
op: One of the supported operators (see Supported Operators below).
value: The value to compare against (type can vary depending on field and operator).
Supported Operators
Each leaf condition’s op (operator) must be one of:
Filter names are case-sensitive.
Equal
NotEqual
BeginsWith
NotBeginsWith
Contains
NotContains
EndsWith
NotEndsWith
IsEmpty
IsNotEmpty
Less
LessOrEqual
Greater
GreatOrEqual
Combining Filters
You can nest composite filters inside each other arbitrarily to create complex logical groupings:
A composite filter contains either an and property or an or property (not both), pointing to an array of sub-filters.
Each sub-filter in that array can itself be either a Leaf Filter or another Composite Filter.
Response payload
The response payload consists of a JSON array with a set of objects. Each object will contain properties corresponding to selected grid fields:
[
{
"field A": "value",
"field B": "value",
...
},
{
"field A": "value",
"field B": "value",
...
},
...
]