Custom API
Rill allows you to create custom APIs to pull data out in a flexible manner. You can write custom SQL queries and expose them as an API endpoint.
Create a custom API
To create a custom API, create a new yaml file under apis
directory in your Rill project. Currently,
we support two types of custom APIs:
-
SQL API: You can write a SQL query and expose it as an API endpoint. This is useful when you want to directly write queries against a model that you have created. It should have the following structure:
type: api
sql: SELECT abc FROM my_tablewhere
my_table
is your model name. Read more details about SQL apis. -
Metrics SQL API: You can write a SQL query referring to metrics definition and dimensions defined in the metrics view. It should have the following structure:
type: api
metrics_sql: SELECT dimension, measure FROM my_metricswhere
my_metrics
is your metrics view name,measure
is a custom metrics that you have defined. Read more details about Metrics SQL API.
How to use custom APIs
Refer to the integration docs here to learn how to use custom APIs in your application.