1

I've extracted ordered cards from a Metabase dashboard and would like to copy them into a new empty dashboard through Python.

I don't find the Metabase API documentation: Add Card to Dashboard particularly clear:

POST /api/dashboard/:id/cards

with the following parameters:

  • id,
  • cardId value may be nil, or if non-nil, value must be an integer greater than zero
  • parameter_mappings value must be an array. Each value must be a map.
  • series
  • dashboard-card

I have no idea what goes in each of these parameters and the documentation doesn't seem to explain it.

Any ideas?

hc_dev
  • 8,389
  • 1
  • 26
  • 38
NicolasRx
  • 29
  • 5

1 Answers1

0

To post a card by a given card id (for example card with id 201) I am using the following payload:

payload_to_post = {
    "cardId": 201,
    "sizeX": 4,
    "sizeY": 4,
    "col": 8,
    "row": 0,
    "dashboard-card": {"card_id": 201},
}

This will add a 4x4 card with id 201 on dashboard with id :id on row 0 and column 8.