Skip to content
Snippets Groups Projects
Commit cf624f0f authored by Tom Robinson's avatar Tom Robinson
Browse files

Fix params for saved card csv downloading

parent 034693a4
Branches
Tags
No related merge requests found
(ns metabase.api.card
(:require [clojure.data :as data]
[cheshire.core :as json]
[compojure.core :refer [GET POST DELETE PUT]]
[schema.core :as s]
(metabase.api [common :refer :all]
......@@ -273,9 +274,11 @@
(run-query-for-card card-id parameters))
(defendpoint POST "/:card-id/query/csv"
"Run the query associated with a Card, and return its results as CSV."
[card-id :as {{:keys [parameters]} :body}]
(dataset-api/as-csv (run-query-for-card card-id parameters)))
"Run the query associated with a Card, and return its results as CSV. Note that this expects the query as serialized JSON in the 'query' parameters."
[card-id query]
{query (s/maybe su/JSONString)}
(dataset-api/as-csv (run-query-for-card card-id (when query
(:parameters (json/parse-string query keyword))))))
(defendpoint GET "/:card-id/json"
"Fetch the results of a Card as JSON."
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment