REST#

REST driver is bundled with Querona and is ready for use.

It allows you to query REST API using one of the options:

  • Model-first, where we detect models used by REST API and allow you to query using models mapped to virtual tables,

  • Operation-first, where we generate tabular functions wrapping REST operations, and allow you to query operations using parameterized functions.

Overview#

The built-in REST provider offers the easiest and most natural way to access REST data using SQL. It hides the complexity of accessing REST data, automatically maps the data models (schemas) presented to it by the given REST service and handles the communication, authentication, and authorization, thus allowing for a seamless experience of querying the data.

The key features of the provider:

  • Models REST schemas as virtual tables in a one-to-one relationship

  • Automatically finds the best available REST operation to call, based on an incoming query

  • Abstracts connecting to remote data as well as data processing: TLS/SSL, and authentication

  • Supports popular authentication schemes, including HTTP Basic, API Key, OAuth, and OAuth2.

The provider relies on an OpenAPI specification for automatic configuration. To learn more about OpenAPI please see the OpenAPI guide.

If the generic approach is not enough, the second option is to use functions that wrap around the rest operation, exposing it as an SQL function with parameters and a strongly typed result.

Connecting to REST#

An OpenAPI specification is essential for automatic provider configuration. The recommended way of getting the specification is to retrieve it from the REST service’s documentation.

Create a connection using the REST provider as a source, and configure the REST-specific options:

  • Paste the OpenAPI specification text into the required “OpenAPI configuration” field - either JSON or YAML format will do

  • Specify the “Base URL”

  • Select the desired authentication method and provide the required parameters specific to the selected method, eg. a username and password if the HTTP Basic is selected

  • Test the connection to verify that the OpenAPI configuration is valid and REST service is reachable

If the configuration checks out, SAVE it.

Now we can proceed to Create a virtual database on top of the REST connection we created.

See also#