API Guidance to tailor a Question 4000 times

Greetings,

I just can't like this product enough. Thank you for existing.
Now that I found you good folks have an API the value you provide is untold.
I don't think anyone here realized yet what you can do with the API.

I need some general guidance on a pressing use case I need to solve.

I have a Question I need to run about 4000 times.
For each I need to change one Filter, export the csv, add a SUM, capture the result.
Bonus point for a screenshot.

Is this doable via API and where can I learn the relevant bits?
Is there an API guide tutorial? Can Questions be modified on the fly?
Can we export the answer/csv of a Question via API?
Can a screenshot of the visualization be taken via API? (can these be programmatically generated?)

Thank you for your guidance, it is much appreciated.

Antoine

Hi @Antoine

Everything you can do in the interface can be done via the API, since that's how Metabase functions.

The best way to learn the API, is to just use Metabase while having your browser developer Network-tab open and looking at the request, and what data is being send/received.

There is no browser engine, so you need to use another tool to take screenshots.

Hi Flamber, okay that's great we're doing the same around here anyway.
May I ask though, how about auth? It's the same two step process? Any headers to pass in?
url to get the token? I'll look to see if there's a KB on that part.

Cheers,

@Antoine Try searching the forum, or have a look in this article: https://www.metabase.com/learn/administration/metabase-api.html

You can also use the wrappers that have been built for Metabase API. E.g. this is a Python wrapper for Metabase API. The function get_card_data can give you a head start.