This is a proof-of-concept HTTP "driver" for Metabase.
Previous discussion: metabase/metabase#7047
Currently the simplest "native" query for this driver is simply an object with a url
property:
{ "url": "https://api.coinmarketcap.com/v1/ticker/" }
The driver will make a GET
request and parse the resulting JSON array into rows. Currently it only supports JSON.
You can provide a different method
as well as headers
and a JSON body
:
{
"url": "https://api.coinmarketcap.com/v1/ticker/",
"method": "POST",
"headers": {
"Authentication": "SOMETOKEN"
},
"body": {
"foo": "bar"
}
}
Additionally, you can provide a result
object with a JSONPath to the "root" in the response, and/or a list of fields
:
{
"url" : "https://blockchain.info/blocks?format=json",
"result" : {
"path" : "blocks",
"fields": ["height", "time"]
}
}
You can also predefine "tables" in the database configuration's Table Definitions
setting. These tables will appear in the graphical query builder:
{
"tables" : [
{
"name" : "Blocks",
"url" : "https://blockchain.info/blocks?format=json",
"fields" : [
{ "name" : "height", "type" : "number" },
{ "name" : "hash", "type" : "string" },
{ "name" : "time", "type" : "number" },
{ "type" : "boolean", "name" : "main_chain" }
],
"result" : {
"path" : "blocks"
}
}
]
}
There is limited support for aggregations and breakouts, but this is very experimental and may be removed in future versions.
Clone the Metabase repo first if you haven't already done so.
cd /path/to/metabase_source
lein install-for-building-drivers
# (In the HTTP driver directory)
lein clean
DEBUG=1 LEIN_SNAPSHOTS_IN_RELEASE=true lein uberjar
mkdir -p /path/to/metabase/plugins/
cp target/uberjar/http.metabase-driver.jar /path/to/metabase/plugins/
jar -jar /path/to/metabase/metabase.jar
or:
mkdir -p /path/to/metabase_source/plugins
cp target/uberjar/http.metabase-driver.jar /path/to/metabase_source/plugins/
cd /path/to/metabase_source
lein run