6

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

Grokify
  • 15,092
  • 6
  • 60
  • 81

1 Answers1

9

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
Grokify
  • 15,092
  • 6
  • 60
  • 81