diff --git a/docs/api/saved-objects/import.asciidoc b/docs/api/saved-objects/import.asciidoc index ed90625e95508..f5bc9d184bea4 100644 --- a/docs/api/saved-objects/import.asciidoc +++ b/docs/api/saved-objects/import.asciidoc @@ -35,17 +35,16 @@ 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-- -------------------------------------------------- -// KIBANA A successful call returns a response code of `200` and a response body containing a JSON structure similar to the following example: @@ -62,17 +61,16 @@ 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-- -------------------------------------------------- -// KIBANA The call returns a response code of `200` and a response body containing a JSON structure similar to the following example: @@ -99,17 +97,16 @@ 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-- -------------------------------------------------- -// 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..ab376e97aa25d 100644 --- a/docs/api/saved-objects/resolve_import_errors.asciidoc +++ b/docs/api/saved-objects/resolve_import_errors.asciidoc @@ -33,20 +33,15 @@ 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"}} -------------------------------------------------- -// KIBANA A successful call returns a response code of `200` and a response body containing a JSON structure similar to the following example: @@ -63,21 +58,16 @@ 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-- -------------------------------------------------- -// KIBANA A successful call returns a response code of `200` and a response body containing a JSON structure similar to the following example: @@ -94,20 +84,15 @@ 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"}]} -------------------------------------------------- -// KIBANA A successful call returns a response code of `200` and a response body containing a JSON structure similar to the following example: