Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to retrieve Metabase Questions Table JSON output via API?

Tags:

metabase

The Metabase (https://metabase.com/) Data Explorer web UI has the ability to create queries they call questions with various filters. The query results can be visualized in a variety of ways including a table and charts. The table results can also be downloaded as JSON. Is there a way to retrieve the JSON via the Metabase REST API?

I've tried a few of the endpoints in the Metabase API Reference with the ID in the URL of the Data Explorer without success.

API Reference: https://github.com/metabase/.../api-documentation.md

like image 842
Grokify Avatar asked Dec 16 '17 01:12

Grokify


1 Answers

This can be done using the following endpoint where :card-id is the numeric "questionId" in the Data Explorer URL after /question/.

POST /api/card/:card-id/query/:export-format

As an example:

  • Web URL: https://metabase.example.com/question/1
  • API URL: https://metabase.example.com/api/card/1/query/json
like image 150
Grokify Avatar answered Dec 09 '22 17:12

Grokify