Metabase REST API: Programmatically add cards (questions) to dashboard


#1

I would like to programmatically add a card (question) to a dashboard

I am able to create cards (questions) but I dont see how to add them to the dashboard programmatically.

In the documentation it it says the following:

POST /api/dashboard/
Create a new Dashboard.

PARAMS:
name value must be a non-blank string.

description value may be nil, or if non-nil, value must be a string.

parameters value must be an array. Each value must be a map.

dashboard

Dashboard seems to not have a description. Is this how you add cards?

Also when calling GET /api/dashboards it seems that ordered_cards is where the location and size information is stored for the card (question) visualisation on the dashboard.

How can I add a question to a dashboard with the size and location parameters?
Are there other requirements?

Any minimal example would be extremely helpful.


#2

Howdy!,

No, it just says that the description for a dashboard is optional

Scroll a bit further down to POST /api/dashboard/:id/cards or maybe even
PUT /api/dashboard/:id/cards which seem to describe with a partial example.


#3

I re-read the documentation, and I was able to automatically create cards with the information you provided.

Thank you for your help