2019-03-13 14:17:18 +01:00
[[saved-objects-api-resolve-import-errors]]
2019-09-06 18:09:57 +02:00
=== Resolve import errors API
++++
<titleabbrev>Resolve import errors</titleabbrev>
++++
2019-03-08 19:18:36 +01:00
2019-10-18 19:17:54 +02:00
experimental[] Resolve errors from the import API.
2019-03-08 19:18:36 +01:00
2019-10-18 19:17:54 +02:00
To resolve errors, you can:
2019-03-08 19:18:36 +01:00
2019-09-06 18:09:57 +02:00
* Retry certain saved objects
2019-03-08 19:18:36 +01:00
2019-09-06 18:09:57 +02:00
* Overwrite specific saved objects
* Change references to different saved objects
[[saved-objects-api-resolve-import-errors-request]]
2019-03-08 19:18:36 +01:00
==== Request
2019-03-13 14:17:18 +01:00
`POST /api/saved_objects/_resolve_import_errors`
2019-03-08 19:18:36 +01:00
2019-10-18 19:17:54 +02:00
`POST /s/<space_id>/api/saved_objects/_resolve_import_errors`
[[saved-objects-api-resolve-import-errors-path-params]]
==== Path parameters
`space_id`::
(Optional, string) An identifier for the space. If `space_id` is not provided in the URL, the default space is used.
2019-09-06 18:09:57 +02:00
[[saved-objects-api-resolve-import-errors-request-body]]
2019-03-08 19:18:36 +01:00
==== Request body
2019-09-06 18:09:57 +02:00
The request body must include the multipart/form-data type.
2019-03-08 19:18:36 +01:00
`file`::
2019-04-04 15:10:54 +02:00
The same file given to the import API.
2019-03-08 19:18:36 +01:00
2019-04-04 15:10:54 +02:00
`retries`::
2019-09-06 18:09:57 +02:00
(array) A list of `type`, `id`, `replaceReferences`, and `overwrite` objects to retry. The property `replaceReferences` is a list of `type`, `from`, and `to` used to change the object references.
2019-03-08 19:18:36 +01:00
2019-09-06 18:09:57 +02:00
[[saved-objects-api-resolve-import-errors-response-body]]
2019-03-08 19:18:36 +01:00
==== Response body
2019-10-18 19:17:54 +02:00
`success`::
2019-09-06 18:09:57 +02:00
Top-level property that indicates if the errors successfully resolved.
2019-10-18 19:17:54 +02:00
`successCount`::
2019-09-06 18:09:57 +02:00
Indicates the number of successfully resolved records.
`errors`::
(array) Specifies the objects that failed to resolve.
2019-10-18 19:17:54 +02:00
2019-09-06 18:09:57 +02:00
[[saved-objects-api-resolve-import-errors-codes]]
==== Response code
2019-10-18 19:17:54 +02:00
`200`::
2019-09-06 18:09:57 +02:00
Indicates a successful call.
2019-03-08 19:18:36 +01:00
2019-09-06 18:09:57 +02:00
[[saved-objects-api-resolve-import-errors-example]]
2019-03-08 19:18:36 +01:00
==== Examples
2019-09-06 18:09:57 +02:00
Retry a dashboard import:
2019-03-08 19:18:36 +01:00
[source,js]
--------------------------------------------------
2019-06-05 13:49:47 +02:00
$ 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"}]'
--------------------------------------------------
2019-03-08 19:18:36 +01:00
2019-09-06 18:09:57 +02:00
The `file.ndjson` file contains the following:
2019-04-04 15:10:54 +02:00
2019-06-05 13:49:47 +02:00
[source,js]
--------------------------------------------------
{"type":"dashboard","id":"my-dashboard","attributes":{"title":"Look at my dashboard"}}
2019-04-04 15:10:54 +02:00
--------------------------------------------------
2019-03-08 19:18:36 +01:00
2019-09-06 18:09:57 +02:00
The API returns the following:
2019-04-04 15:10:54 +02:00
[source,js]
--------------------------------------------------
{
"success": true,
"successCount": 1
}
--------------------------------------------------
2019-09-06 18:09:57 +02:00
Resolve errors for a dashboard and overwrite the existing saved object:
2019-04-04 15:10:54 +02:00
[source,js]
--------------------------------------------------
2019-06-05 13:49:47 +02:00
$ 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}]'
--------------------------------------------------
2019-03-08 19:18:36 +01:00
2019-09-06 18:09:57 +02:00
The `file.ndjson` file contains the following:
2019-06-05 13:49:47 +02:00
[source,js]
--------------------------------------------------
2019-04-04 15:10:54 +02:00
{"type":"index-pattern","id":"my-pattern","attributes":{"title":"my-pattern-*"}}
{"type":"dashboard","id":"my-dashboard","attributes":{"title":"Look at my dashboard"}}
2019-03-08 19:18:36 +01:00
--------------------------------------------------
2019-09-06 18:09:57 +02:00
The API returns the following:
2019-03-08 19:18:36 +01:00
[source,js]
--------------------------------------------------
{
"success": true,
"successCount": 1
}
--------------------------------------------------
2019-09-06 18:09:57 +02:00
Resolve errors for a visualization by replacing the index pattern with another:
2019-03-08 19:18:36 +01:00
[source,js]
--------------------------------------------------
2019-06-05 13:49:47 +02:00
$ 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"}]}]'
--------------------------------------------------
2019-03-08 19:18:36 +01:00
2019-09-06 18:09:57 +02:00
The `file.ndjson` file contains the following:
2019-03-08 19:18:36 +01:00
2019-06-05 13:49:47 +02:00
[source,js]
--------------------------------------------------
{"type":"visualization","id":"my-vis","attributes":{"title":"Look at my visualization"},"references":[{"name":"ref_0","type":"index-pattern","id":"missing"}]}
2019-03-08 19:18:36 +01:00
--------------------------------------------------
2019-09-06 18:09:57 +02:00
The API returns the following:
2019-03-08 19:18:36 +01:00
[source,js]
--------------------------------------------------
{
"success": true,
"successCount": 1
}
--------------------------------------------------