The functionality described in this article is available in the meshIQ Platform versions 11.1.1 and later. For more information on the WGS REST API, see Performing REST API operations using the Swagger UI.
When using the GET method for a request that reads multiple records, the WGS REST API now supports filtering and sorting results by attributes, if applicable.
Filtering
For search filtering use the following "filter" query parameter:
filter=[any|all;]{attribute}:{eq|ne|lt|le|gt|ge|co|nc|mp|ha|nh}[:{value}][;{attribute}:{eq|ne|lt|le|gt|ge|co|nc|mp|ha|nh}[:{value}]]
- A search filter can have several attributes separated by ";"
- The first search filter attribute can be the operator “any” or “all”:
- Use "any" to indicate that any attribute can satisfy the condition
- Use "all" to indicate that all attributes must satisfy the condition.
- If this operator is not defined, "any" is used.
- Filter attributes must contain parts separated by ":"
- "attribute" is the full attribute name
- "operation" is the filter operation. See the list below.
- "value" is the filter value. This is optional.
- Operation can be:
- eq - 'equals' is used for text, boolean, numeric and custom properties values.
- ne - 'not equals' is used for text, boolean, numeric and custom properties values.
- lt - 'less than' is used for numeric values.
- le - 'less than or equal to' is used for numeric values.
- gt - 'greater than' is used for numeric values.
- ge - 'greater than or equal to’ is used for numeric values.
- co - 'contains' is used to filter text and custom properties values based on the text they contain, or to filter list and map values based on the values they contain.
- nc - 'does not contain' is used to filter text and custom properties values based on the text they do not contain, or to filter list and map values based on the values they do not contain.
- mp - 'match pattern' is used for text and custom properties values.
- Ha – ‘has custom property key’ is used for custom properties values.
- nh - 'does not have custom property key' is used for custom properties values.
- If a provided attribute cannot be filtered, it will be skipped (it is logged to log file as an informational message).
- If the operation provided is not supported by the attribute, the result will be negative.
- Search filter samples:
- all;extended.maxDepth:eq:5000;customProperties.Test:ha – search for results where extended.maxDepth equals 5000 and has custom property 'Test'
- any;extended.maxDepth:eq:5000;customProperties.Test:ha - search for results where extended.maxDepth equals 5000 or has custom property 'Test'
- extended.maxDepth:eq:5000;customProperties.Test:ha - the same as above, but without the operator. search for results where extended.maxDepth equals 5000 or has custom property 'Test'
Sort Order
For search order can be used "order" query parameter:
order= {attribute}:[asc|desc][,{attribute}:[asc|desc]]
- Order can have several attributes separated by ","
- Order attributes must contain parts separated by ":"
- "attribute" is the full attribute name.
- "type" is the order type. This is optional.
- Type can be:
- asc – ascending order type
- desc – descending order type