From 12e97574ca9ea040714e4fc1f7806c625deedd69 Mon Sep 17 00:00:00 2001 From: Mike Cote Date: Tue, 4 Jun 2019 09:39:15 -0400 Subject: [PATCH 1/2] Remove copy as curl --- docs/api/saved-objects/import.asciidoc | 3 --- docs/api/saved-objects/resolve_import_errors.asciidoc | 3 --- 2 files changed, 6 deletions(-) diff --git a/docs/api/saved-objects/import.asciidoc b/docs/api/saved-objects/import.asciidoc index ed90625e95508..1703e2365c004 100644 --- a/docs/api/saved-objects/import.asciidoc +++ b/docs/api/saved-objects/import.asciidoc @@ -45,7 +45,6 @@ Content-Type: application/ndjson {"type":"dashboard","id":"my-dashboard","attributes":{"title":"Look at my dashboard"}} --EXAMPLE-- -------------------------------------------------- -// KIBANA A successful call returns a response code of `200` and a response body containing a JSON structure similar to the following example: @@ -72,7 +71,6 @@ Content-Type: application/ndjson {"type":"dashboard","id":"my-dashboard","attributes":{"title":"Look at my dashboard"}} --EXAMPLE-- -------------------------------------------------- -// KIBANA The call returns a response code of `200` and a response body containing a JSON structure similar to the following example: @@ -109,7 +107,6 @@ Content-Type: application/ndjson {"type":"dashboard","id":"my-dashboard","attributes":{"title":"Look at my dashboard"},"references":[{"name":"ref_0","type":"visualization","id":"my-vis"}]} --EXAMPLE-- -------------------------------------------------- -// KIBANA The call returns a response code of `200` and a response body containing a JSON structure similar to the following example: diff --git a/docs/api/saved-objects/resolve_import_errors.asciidoc b/docs/api/saved-objects/resolve_import_errors.asciidoc index 6221229c4d559..110f4806dd6ef 100644 --- a/docs/api/saved-objects/resolve_import_errors.asciidoc +++ b/docs/api/saved-objects/resolve_import_errors.asciidoc @@ -46,7 +46,6 @@ Content-Disposition: form-data; name="retries" [{"type":"dashboard","id":"my-dashboard"}] --EXAMPLE-- -------------------------------------------------- -// KIBANA A successful call returns a response code of `200` and a response body containing a JSON structure similar to the following example: @@ -77,7 +76,6 @@ Content-Disposition: form-data; name="retries" [{"type":"dashboard","id":"my-dashboard","overwrite":true}] --EXAMPLE-- -------------------------------------------------- -// KIBANA A successful call returns a response code of `200` and a response body containing a JSON structure similar to the following example: @@ -107,7 +105,6 @@ Content-Disposition: form-data; name="retries" [{"type":"visualization","id":"my-vis","replaceReferences":[{"type":"index-pattern","from":"missing","to":"existing"}]}] --EXAMPLE-- -------------------------------------------------- -// KIBANA A successful call returns a response code of `200` and a response body containing a JSON structure similar to the following example: From 90b5f0b97122dca457dd795ee4db219fbb600ee1 Mon Sep 17 00:00:00 2001 From: Mike Cote Date: Tue, 4 Jun 2019 10:27:09 -0400 Subject: [PATCH 2/2] Update import docs to use curl examples --- docs/api/saved-objects/import.asciidoc | 36 +++++++------- .../resolve_import_errors.asciidoc | 48 +++++++------------ 2 files changed, 36 insertions(+), 48 deletions(-) diff --git a/docs/api/saved-objects/import.asciidoc b/docs/api/saved-objects/import.asciidoc index 1703e2365c004..f5bc9d184bea4 100644 --- a/docs/api/saved-objects/import.asciidoc +++ b/docs/api/saved-objects/import.asciidoc @@ -35,15 +35,15 @@ The following example imports an index pattern and dashboard. [source,js] -------------------------------------------------- -POST api/saved_objects/_import -Content-Type: multipart/form-data; boundary=EXAMPLE ---EXAMPLE -Content-Disposition: form-data; name="file"; filename="export.ndjson" -Content-Type: application/ndjson +$ curl -X POST "localhost:5601/api/saved_objects/_import" -H "kbn-xsrf: true" --form file=@file.ndjson +-------------------------------------------------- + +The `file.ndjson` file would contain the following. +[source,js] +-------------------------------------------------- {"type":"index-pattern","id":"my-pattern","attributes":{"title":"my-pattern-*"}} {"type":"dashboard","id":"my-dashboard","attributes":{"title":"Look at my dashboard"}} ---EXAMPLE-- -------------------------------------------------- A successful call returns a response code of `200` and a response body @@ -61,15 +61,15 @@ The following example imports an index pattern and dashboard but has a conflict [source,js] -------------------------------------------------- -POST api/saved_objects/_import -Content-Type: multipart/form-data; boundary=EXAMPLE ---EXAMPLE -Content-Disposition: form-data; name="file"; filename="export.ndjson" -Content-Type: application/ndjson +$ curl -X POST "localhost:5601/api/saved_objects/_import" -H "kbn-xsrf: true" --form file=@file.ndjson +-------------------------------------------------- + +The `file.ndjson` file would contain the following. +[source,js] +-------------------------------------------------- {"type":"index-pattern","id":"my-pattern","attributes":{"title":"my-pattern-*"}} {"type":"dashboard","id":"my-dashboard","attributes":{"title":"Look at my dashboard"}} ---EXAMPLE-- -------------------------------------------------- The call returns a response code of `200` and a response body @@ -97,15 +97,15 @@ The following example imports a visualization and dashboard but the index patter [source,js] -------------------------------------------------- -POST api/saved_objects/_import -Content-Type: multipart/form-data; boundary=EXAMPLE ---EXAMPLE -Content-Disposition: form-data; name="file"; filename="export.ndjson" -Content-Type: application/ndjson +$ curl -X POST "localhost:5601/api/saved_objects/_import" -H "kbn-xsrf: true" --form file=@file.ndjson +-------------------------------------------------- +The `file.ndjson` file would contain the following. + +[source,js] +-------------------------------------------------- {"type":"visualization","id":"my-vis","attributes":{"title":"my-vis"},"references":[{"name":"ref_0","type":"index-pattern","id":"my-pattern-*"}]} {"type":"dashboard","id":"my-dashboard","attributes":{"title":"Look at my dashboard"},"references":[{"name":"ref_0","type":"visualization","id":"my-vis"}]} ---EXAMPLE-- -------------------------------------------------- The call returns a response code of `200` and a response body diff --git a/docs/api/saved-objects/resolve_import_errors.asciidoc b/docs/api/saved-objects/resolve_import_errors.asciidoc index 110f4806dd6ef..ab376e97aa25d 100644 --- a/docs/api/saved-objects/resolve_import_errors.asciidoc +++ b/docs/api/saved-objects/resolve_import_errors.asciidoc @@ -33,18 +33,14 @@ The following example retries importing a dashboard. [source,js] -------------------------------------------------- -POST api/saved_objects/_resolve_import_errors -Content-Type: multipart/form-data; boundary=EXAMPLE ---EXAMPLE -Content-Disposition: form-data; name="file"; filename="export.ndjson" -Content-Type: application/ndjson +$ curl -X POST "localhost:5601/api/saved_objects/_resolve_import_errors" -H "kbn-xsrf: true" --form file=@file.ndjson --form retries='[{"type":"dashboard","id":"my-dashboard"}]' +-------------------------------------------------- -{"type":"dashboard","id":"my-dashboard","attributes":{"title":"Look at my dashboard"}} ---EXAMPLE -Content-Disposition: form-data; name="retries" +The `file.ndjson` file would contain the following. -[{"type":"dashboard","id":"my-dashboard"}] ---EXAMPLE-- +[source,js] +-------------------------------------------------- +{"type":"dashboard","id":"my-dashboard","attributes":{"title":"Look at my dashboard"}} -------------------------------------------------- A successful call returns a response code of `200` and a response body @@ -62,19 +58,15 @@ The following example resolves errors for a dashboard. This will cause the dashb [source,js] -------------------------------------------------- -POST api/saved_objects/_resolve_import_errors -Content-Type: multipart/form-data; boundary=EXAMPLE ---EXAMPLE -Content-Disposition: form-data; name="file"; filename="export.ndjson" -Content-Type: application/ndjson +$ curl -X POST "localhost:5601/api/saved_objects/_resolve_import_errors" -H "kbn-xsrf: true" --form file=@file.ndjson --form retries='[{"type":"dashboard","id":"my-dashboard","overwrite":true}]' +-------------------------------------------------- +The `file.ndjson` file would contain the following. + +[source,js] +-------------------------------------------------- {"type":"index-pattern","id":"my-pattern","attributes":{"title":"my-pattern-*"}} {"type":"dashboard","id":"my-dashboard","attributes":{"title":"Look at my dashboard"}} ---EXAMPLE -Content-Disposition: form-data; name="retries" - -[{"type":"dashboard","id":"my-dashboard","overwrite":true}] ---EXAMPLE-- -------------------------------------------------- A successful call returns a response code of `200` and a response body @@ -92,18 +84,14 @@ The following example resolves errors for a visualization by replacing the index [source,js] -------------------------------------------------- -POST api/saved_objects/_resolve_import_errors -Content-Type: multipart/form-data; boundary=EXAMPLE ---EXAMPLE -Content-Disposition: form-data; name="file"; filename="export.ndjson" -Content-Type: application/ndjson +$ curl -X POST "localhost:5601/api/saved_objects/_resolve_import_errors" -H "kbn-xsrf: true" --form file=@file.ndjson --form retries='[{"type":"visualization","id":"my-vis","replaceReferences":[{"type":"index-pattern","from":"missing","to":"existing"}]}]' +-------------------------------------------------- -{"type":"visualization","id":"my-vis","attributes":{"title":"Look at my visualization"},"references":[{"name":"ref_0","type":"index-pattern","id":"missing"}]} ---EXAMPLE -Content-Disposition: form-data; name="retries" +The `file.ndjson` file would contain the following. -[{"type":"visualization","id":"my-vis","replaceReferences":[{"type":"index-pattern","from":"missing","to":"existing"}]}] ---EXAMPLE-- +[source,js] +-------------------------------------------------- +{"type":"visualization","id":"my-vis","attributes":{"title":"Look at my visualization"},"references":[{"name":"ref_0","type":"index-pattern","id":"missing"}]} -------------------------------------------------- A successful call returns a response code of `200` and a response body