Query APIs
Query APIs are a more free-form and type-unsafe way of exposing data using virtual tables based on user inputs and stored procedures. Please make sure to take a look at record APIs first. Views and generated columns may be a better fit for transforming data if no explicit user input is required.
Example
Using migrations and sqlean’s define
we can define a table query with unbound
inputs (see placeholder $1):
Subsequently, an API can be configured to query the newly created VIRTUAL TABLE
, also binding URL query parameters as inputs to above placeholders.
Finally, we can query the API, e.g. using curl: