Liking cljdoc? Tell your friends :D

metabase.api.embed

Various endpoints that use JSON web tokens to fetch Cards and Dashboards. The endpoints are the same as the ones in api/public/, and differ only in the way they are authorized.

To use these endpoints:

  1. Set the embedding-secret-key Setting to a hexadecimal-encoded 32-byte sequence (i.e., a 64-character string). You can use /api/util/random_token to get a cryptographically-secure value for this.
  2. Sign/base-64 encode a JSON Web Token using the secret key and pass it as the relevant part of the URL path to the various endpoints here.

Tokens can have the following fields:

{:resource {:question <card-id> :dashboard <dashboard-id>} :params <params>}

Various endpoints that use [JSON web tokens](https://jwt.io/introduction/) to fetch Cards and Dashboards.
The endpoints are the same as the ones in `api/public/`, and differ only in the way they are authorized.

To use these endpoints:

 1.  Set the `embedding-secret-key` Setting to a hexadecimal-encoded 32-byte sequence (i.e., a 64-character string).
     You can use `/api/util/random_token` to get a cryptographically-secure value for this.
 2.  Sign/base-64 encode a JSON Web Token using the secret key and pass it as the relevant part of the URL path
     to the various endpoints here.

Tokens can have the following fields:

   {:resource {:question  <card-id>
               :dashboard <dashboard-id>}
    :params   <params>}
raw docstring

card-for-unsigned-tokenclj

(card-for-unsigned-token unsigned-token
                         &
                         {:keys [embedding-params constraints]})

Return the info needed for embedding about Card specified in TOKEN. Additional CONSTRAINTS can be passed to the public-card function that fetches the Card.

Return the info needed for embedding about Card specified in TOKEN.
Additional CONSTRAINTS can be passed to the `public-card` function that fetches the Card.
sourceraw docstring

dashboard-for-unsigned-tokenclj

(dashboard-for-unsigned-token unsigned-token
                              &
                              {:keys [embedding-params constraints]})

Return the info needed for embedding about Dashboard specified in token. Additional constraints can be passed to the public-dashboard function that fetches the Dashboard.

Return the info needed for embedding about Dashboard specified in `token`. Additional `constraints` can be passed to
the `public-dashboard` function that fetches the Dashboard.
sourceraw docstring

dashcard-results-asyncclj

(dashcard-results-async &
                        {:keys [dashboard-id dashcard-id card-id
                                embedding-params token-params query-params]})

Return results for running the query belonging to a DashboardCard.

Return results for running the query belonging to a DashboardCard.
sourceraw docstring

GET_card_:tokenclj

GET /api/embed/card/:token

Fetch a Card via a JSON Web Token signed with the embedding-secret-key.

Token should have the following format:

 {:resource {:question <card-id>}}
PARAMS:
  • token
## `GET /api/embed/card/:token`

Fetch a Card via a JSON Web Token signed with the `embedding-secret-key`.

   Token should have the following format:

     {:resource {:question <card-id>}}

##### PARAMS:

*  **`token`** 
sourceraw docstring

GET_card_:token_field_:field-id_remapping_:remapped-idclj

GET /api/embed/card/:token/field/:field-id/remapping/:remapped-id

Fetch remapped Field values. This is the same as GET /api/field/:id/remapping/:remapped-id, but for use with embedded Cards.

PARAMS:
  • token

  • field-id

  • remapped-id

  • value value must be a non-blank string.

## `GET /api/embed/card/:token/field/:field-id/remapping/:remapped-id`

Fetch remapped Field values. This is the same as `GET /api/field/:id/remapping/:remapped-id`, but for use with
  embedded Cards.

##### PARAMS:

*  **`token`** 

*  **`field-id`** 

*  **`remapped-id`** 

*  **`value`** value must be a non-blank string.
sourceraw docstring

GET_card_:token_field_:field-id_search_:search-field-idclj

GET /api/embed/card/:token/field/:field-id/search/:search-field-id

Search for values of a Field that is referenced by an embedded Card.

PARAMS:
  • token

  • field-id

  • search-field-id

  • value value must be a non-blank string.

  • limit value may be nil, or if non-nil, value must be a valid integer greater than zero.

## `GET /api/embed/card/:token/field/:field-id/search/:search-field-id`

Search for values of a Field that is referenced by an embedded Card.

##### PARAMS:

*  **`token`** 

*  **`field-id`** 

*  **`search-field-id`** 

*  **`value`** value must be a non-blank string.

*  **`limit`** value may be nil, or if non-nil, value must be a valid integer greater than zero.
sourceraw docstring

GET_card_:token_field_:field-id_valuesclj

GET /api/embed/card/:token/field/:field-id/values

Fetch FieldValues for a Field that is referenced by an embedded Card.

PARAMS:
  • token

  • field-id

## `GET /api/embed/card/:token/field/:field-id/values`

Fetch FieldValues for a Field that is referenced by an embedded Card.

##### PARAMS:

*  **`token`** 

*  **`field-id`** 
sourceraw docstring

GET_card_:token_queryclj

GET /api/embed/card/:token/query

Fetch the results of running a Card using a JSON Web Token signed with the embedding-secret-key.

Token should have the following format:

 {:resource {:question <card-id>}
  :params   <parameters>}
PARAMS:
  • token

  • &

  • query-params

## `GET /api/embed/card/:token/query`

Fetch the results of running a Card using a JSON Web Token signed with the `embedding-secret-key`.

   Token should have the following format:

     {:resource {:question <card-id>}
      :params   <parameters>}

##### PARAMS:

*  **`token`** 

*  **`&`** 

*  **`query-params`** 
sourceraw docstring

GET_card_:token_query_:export-formatclj

GET /api/embed/card/:token/query/:export-format

Like GET /api/embed/card/query, but returns the results as a file in the specified format.

PARAMS:
  • token

  • export-format value must be one of: csv, json, xlsx.

  • query-params

  • respond

  • raise

## `GET /api/embed/card/:token/query/:export-format`

Like `GET /api/embed/card/query`, but returns the results as a file in the specified format.

##### PARAMS:

*  **`token`** 

*  **`export-format`** value must be one of: `csv`, `json`, `xlsx`.

*  **`query-params`** 

*  **`respond`** 

*  **`raise`** 
sourceraw docstring

GET_dashboard_:tokenclj

GET /api/embed/dashboard/:token

Fetch a Dashboard via a JSON Web Token signed with the embedding-secret-key.

Token should have the following format:

 {:resource {:dashboard <dashboard-id>}}
PARAMS:
  • token
## `GET /api/embed/dashboard/:token`

Fetch a Dashboard via a JSON Web Token signed with the `embedding-secret-key`.

   Token should have the following format:

     {:resource {:dashboard <dashboard-id>}}

##### PARAMS:

*  **`token`** 
sourceraw docstring

GET_dashboard_:token_dashcard_:dashcard-id_card_:card-idclj

GET /api/embed/dashboard/:token/dashcard/:dashcard-id/card/:card-id

Fetch the results of running a Card belonging to a Dashboard using a JSON Web Token signed with the embedding-secret-key

PARAMS:
  • token

  • dashcard-id

  • card-id

  • &

  • query-params

## `GET /api/embed/dashboard/:token/dashcard/:dashcard-id/card/:card-id`

Fetch the results of running a Card belonging to a Dashboard using a JSON Web Token signed with the
  `embedding-secret-key`

##### PARAMS:

*  **`token`** 

*  **`dashcard-id`** 

*  **`card-id`** 

*  **`&`** 

*  **`query-params`** 
sourceraw docstring

GET_dashboard_:token_dashcard_:dashcard-id_card_:card-id_:export-formatclj

GET /api/embed/dashboard/:token/dashcard/:dashcard-id/card/:card-id/:export-format

Fetch the results of running a Card belonging to a Dashboard using a JSON Web Token signed with the embedding-secret-key return the data in one of the export formats

PARAMS:
  • token

  • export-format value must be one of: csv, json, xlsx.

  • dashcard-id

  • card-id

  • query-params

  • respond

  • raise

## `GET /api/embed/dashboard/:token/dashcard/:dashcard-id/card/:card-id/:export-format`

Fetch the results of running a Card belonging to a Dashboard using a JSON Web Token signed with the
  `embedding-secret-key` return the data in one of the export formats

##### PARAMS:

*  **`token`** 

*  **`export-format`** value must be one of: `csv`, `json`, `xlsx`.

*  **`dashcard-id`** 

*  **`card-id`** 

*  **`query-params`** 

*  **`respond`** 

*  **`raise`** 
sourceraw docstring

GET_dashboard_:token_field_:field-id_remapping_:remapped-idclj

GET /api/embed/dashboard/:token/field/:field-id/remapping/:remapped-id

Fetch remapped Field values. This is the same as GET /api/field/:id/remapping/:remapped-id, but for use with embedded Dashboards.

PARAMS:
  • token

  • field-id

  • remapped-id

  • value value must be a non-blank string.

## `GET /api/embed/dashboard/:token/field/:field-id/remapping/:remapped-id`

Fetch remapped Field values. This is the same as `GET /api/field/:id/remapping/:remapped-id`, but for use with
  embedded Dashboards.

##### PARAMS:

*  **`token`** 

*  **`field-id`** 

*  **`remapped-id`** 

*  **`value`** value must be a non-blank string.
sourceraw docstring

GET_dashboard_:token_field_:field-id_search_:search-field-idclj

GET /api/embed/dashboard/:token/field/:field-id/search/:search-field-id

Search for values of a Field that is referenced by a Card in an embedded Dashboard.

PARAMS:
  • token

  • field-id

  • search-field-id

  • value value must be a non-blank string.

  • limit value may be nil, or if non-nil, value must be a valid integer greater than zero.

## `GET /api/embed/dashboard/:token/field/:field-id/search/:search-field-id`

Search for values of a Field that is referenced by a Card in an embedded Dashboard.

##### PARAMS:

*  **`token`** 

*  **`field-id`** 

*  **`search-field-id`** 

*  **`value`** value must be a non-blank string.

*  **`limit`** value may be nil, or if non-nil, value must be a valid integer greater than zero.
sourceraw docstring

GET_dashboard_:token_field_:field-id_valuesclj

GET /api/embed/dashboard/:token/field/:field-id/values

Fetch FieldValues for a Field that is used as a param in an embedded Dashboard.

PARAMS:
  • token

  • field-id

## `GET /api/embed/dashboard/:token/field/:field-id/values`

Fetch FieldValues for a Field that is used as a param in an embedded Dashboard.

##### PARAMS:

*  **`token`** 

*  **`field-id`** 
sourceraw docstring

routesclj

Ring routes for api/embed: (GET_dashboard_:token_field_:field-id_values GET_dashboard_:token GET_dashboard_:token_field_:field-id_search_:search-field-id GET_card_:token_field_:field-id_values GET_dashboard_:token_dashcard_:dashcard-id_card_:card-id GET_card_:token_query GET_card_:token_field_:field-id_remapping_:remapped-id GET_card_:token_field_:field-id_search_:search-field-id GET_card_:token GET_dashboard_:token_dashcard_:dashcard-id_card_:card-id_:export-format GET_card_:token_query_:export-format GET_dashboard_:token_field_:field-id_remapping_:remapped-id)

Ring routes for api/embed:
(GET_dashboard_:token_field_:field-id_values
 GET_dashboard_:token
 GET_dashboard_:token_field_:field-id_search_:search-field-id
 GET_card_:token_field_:field-id_values
 GET_dashboard_:token_dashcard_:dashcard-id_card_:card-id
 GET_card_:token_query
 GET_card_:token_field_:field-id_remapping_:remapped-id
 GET_card_:token_field_:field-id_search_:search-field-id
 GET_card_:token
 GET_dashboard_:token_dashcard_:dashcard-id_card_:card-id_:export-format
 GET_card_:token_query_:export-format
 GET_dashboard_:token_field_:field-id_remapping_:remapped-id)
sourceraw docstring

run-query-for-card-with-params-asyncclj

(run-query-for-card-with-params-async
  &
  {:keys [card-id embedding-params token-params query-params options]})

Run the query associated with Card with card-id using JWT token-params, user-supplied URL query-params, an embedding-params whitelist, and additional query options. Returns channel for fetching the results.

Run the query associated with Card with `card-id` using JWT `token-params`, user-supplied URL `query-params`,
an `embedding-params` whitelist, and additional query `options`. Returns channel for fetching the results.
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close