Skip to content
Snippets Groups Projects
Unverified Commit 4735d3bb authored by Jeff Bruemmer's avatar Jeff Bruemmer Committed by GitHub
Browse files

docs - update api docs script (#38194)

parent bf6d1e57
Branches
Tags
No related merge requests found
......@@ -68,6 +68,7 @@ _* indicates endpoints used for features available on [paid plans](https://www.m
- [Sandbox user*](api/ee/sandbox-user.md)
- [Search](api/search.md)
- [Segment](api/segment.md)
- [Serialization*](api/ee/serialization.md)
- [Session](api/session.md)
- [Setting](api/setting.md)
- [Setup](api/setup.md)
......
......@@ -25,6 +25,8 @@ Fetch a list of all Collections that the current user has read permissions for (
By default, admin users will see all collections. To hide other user's collections pass in
`?exclude-other-user-collections=true`.
If personal-only is `true`, then return only personal collections where `personal_owner_id` is not `nil`.
### PARAMS:
* **`archived`** nullable value must be a valid boolean string ('true' or 'false').
......@@ -33,6 +35,8 @@ Fetch a list of all Collections that the current user has read permissions for (
* **`namespace`** nullable value must be a non-blank string.
* **`personal-only`** nullable value must be a valid boolean string ('true' or 'false').
## `GET /api/collection/:id`
Fetch a specific Collection with standard details added.
......
---
title: "Serialization"
summary: |
API endpoints for Serialization.
---
# Serialization
API endpoints for Serialization.
## `POST /api/ee/serialization/export`
Serialize and retrieve Metabase instance.
Parameters:
- `dirname`: str, name of directory and archive file (default: `<instance-name>-<YYYY-MM-dd_HH-mm>`)
- `all_collections`: bool, serialize all collections (default: true, unless you specify `collection`)
- `collection`: array of int, db id of a collection to serialize
- `settings`: bool, if Metabase settings should be serialized (default: `true`)
- `data_model`: bool, if Metabase data model should be serialized (default: `true`)
- `field_values`: bool, if cached field values should be serialized (default: `false`)
- `database_secrets`: bool, if details how to connect to each db should be serialized (default: `false`)
Outputs .tar.gz file with serialization results and an `export.log` file.
On error just returns serialization logs.
You must be a superuser to do this.
### PARAMS:
* **`all_collections`** nullable value must be a valid boolean string ('true' or 'false').
* **`collection`** nullable vector of value must be an integer greater than zero.
* **`settings`** nullable value must be a valid boolean string ('true' or 'false').
* **`data_model`** nullable value must be a valid boolean string ('true' or 'false').
* **`field_values`** nullable value must be a valid boolean string ('true' or 'false').
* **`database_secrets`** nullable value must be a valid boolean string ('true' or 'false').
* **`dirname`**
## `POST /api/ee/serialization/import`
Deserialize Metabase instance from an archive generated by /export.
Parameters:
- `file`: archive encoded as `multipart/form-data` (required).
Returns logs of deserialization.
You must be a superuser to do this.
### PARAMS:
* **`raw-params`**
---
[<< Back to API index](../../api-documentation.md)
\ No newline at end of file
......@@ -49,6 +49,7 @@
;; /api/ee/sso/sso/ -> /auth/sso
(str/replace #"^metabase-enterprise\.sso\.api\." "/auth/")
;; this should be only the replace for enterprise once we resolved #22687
(str/replace #"^metabase-enterprise\.serialization\.api" "/api/ee/serialization")
(str/replace #"^metabase-enterprise\.([^\.]+)\.api\." "/api/ee/$1/"))
(if (vector? route)
(first route)
......
......@@ -48,6 +48,7 @@
last
u/capitalize-first-char
(str/replace #"(.api.|-)" " ")
(str/replace ".api" "") ; account for `serialization.api` namespace
(capitalize-initialisms initialisms)
(str/replace "SSO SSO" "SSO")))
......@@ -117,13 +118,20 @@
:endpoint-str (endpoint-str endpoint)
:ns-name (endpoint-ns-name endpoint)))
(def api-ns
"Regular expression to match endpoints. Needs to match namespaces like:
- metabase.api.search
- metabase-enterprise.serialization.api
- metabase.api.api-key"
(re-pattern "^metabase(?:-enterprise\\.[\\w-]+)?\\.api(?:\\.[\\w-]+)?$"))
(defn- api-namespaces []
(for [ns-symb (ns.find/find-namespaces (classpath/system-classpath))
:when (and (re-find #"^metabase(?:-enterprise\.[\w-]+)?\.api\." (name ns-symb))
:when (and (re-find api-ns (name ns-symb))
(not (str/includes? (name ns-symb) "test")))]
ns-symb))
(defn- collect-endpoints
(defn collect-endpoints
"Gets a list of all API endpoints."
[]
(for [ns-symb (api-namespaces)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment