Metabase.Embed (metabase v0.1.0)

Embeds allow you to fetch dashboards and cards from Metabase that can be embedded in other applications.

jwt

JWT

This module is responsible for building the URL path used to fetch the embeds. A token will automatically be generated for each endpoint that will authenticate the request with Metabase.

options

Options

Each function that builds an embed path can defined the following options:

  • :expire_in (required) - number of minutes the embed is valid for
  • :secret_key (required) - embedding secret key provided by Metabase

Metabase also allows you to provide additional options that can be used to modify the look and feel of an embed.

  • :bordered - adds a visible border to the embed. Can be true or false.
  • :theme - shows the embed in dark mode. Can be null or "night".
  • :titled - adds a title to the embed. Can be true or false.

example

Example

iex> Metabase.Embed.dashboard(999, %{account: "999"}, expire_in: 10, secret_key: "fakesecret", bordered: false)
"/embed/dashboard/eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE2NTQ2MjE4OTQsInBhcmFtcyI6eyJhY2NvdW50IjoiOTk5In0sInJlc291cmNlIjp7ImRhc2hib2FyZCI6OTk5fX0.gb4XlMdP6dFLAlVh3BLxjGL3ig96HlmtZ-EhyPbtSGU#bordered=false"

Link to this section Summary

Functions

Path to pull a dashboard.

Creates a token used to authenticate an embed URL.

Link to this section Types

Link to this type

embed_opts_t()

@type embed_opts_t() :: [expire_in: pos_integer(), secret_key: String.t()]
Link to this type

url_opts_t()

@type url_opts_t() :: [bordered: boolean(), theme: String.t(), titled: boolean()]

Link to this section Functions

Link to this function

dashboard(dashboard_id, params, opts)

@spec dashboard(non_neg_integer(), map(), embed_opts_t() | url_opts_t()) :: String.t()

Path to pull a dashboard.

Link to this function

token(claims, opts)

@spec token(Joken.claims(), Keyword.t()) :: String.t()

Creates a token used to authenticate an embed URL.