The current search options for APIs are complex and cover only limited scenarios.
The query string can quickly become complex for simple operations like checking conditions or checking for a value between two dates.
Along with the search parameters, there are also other commands we generally use to alter the behaviour of the API execution. These commands could be related to, for example, sorting the data, returning a maximum number of records or pagination.
We also thought about other capabilities, like debugging the API execution in real-time or, in specific scenarios, being able to skip the cache and hit the backend database directly.
Along the same lines, it would be nice to bring in some information related to the child and other linked records (TRIRIGA being Object Oriented, we have numerous linked objects). This capability helps immensely in scenarios when we only must display limited information from the related records.
While designing the search and data control feature, ease of use was the primary concern. Therefore, we were looking to in-built a wide range of operators to help extract the data simply and consistently. Furthermore, these operators are extendible as per the usage requirements in future.
Query Parameter: (represented by "q")
We created a "Query Parameter" option to seamlessly handle the complex search options.
The Query Parameter consists of the following Operators:
Logical Operators - allows logical commands, for example, "Contains", "Starts with", "Equals", "Not Equals", and "In". We can combine these operators with the "And" or "Or" conditions to create complex logical commands.
Conditional Operators - allows conditional commands, for example, "Greater than", "Greater than or Equals", "Less than", "Less Than or Equals", and "Between".
Date Operators - allows date-related commands, for example, "Between two dates", "Start of the day", "Start of next day", "Start of the day before", "Start of this week", "Start of next week", Start of previous month", to name a few. The date operator utilises conditional and additional date operators along with the shortcut keywords to achieve the desired results.
We can combine the individual operators under the "Query Parameter" grouping to cater to more complex search scenarios.
Fig 1: Query Parameter
For further technical information, please click on the arrows below to expand the required list:
How do these Operators work?
Main Query Operators:
Logical Operators:
Conditional Operators:
Date Operators:
Query Parameters result
This post is part of a series detailing the ExpressAPI Features and Capabilities.
If you need to discuss anything, don't hesitate to contact us through this link.
Please read our Privacy policy here.
Comments