136 lines
4.2 KiB
Text
136 lines
4.2 KiB
Text
[[saved-objects-api-resolve-import-errors]]
|
|
=== Resolve import errors API
|
|
++++
|
|
<titleabbrev>Resolve import errors</titleabbrev>
|
|
++++
|
|
|
|
experimental[] Resolve errors from the import API.
|
|
|
|
To resolve errors, you can:
|
|
|
|
* Retry certain saved objects
|
|
|
|
* Overwrite specific saved objects
|
|
|
|
* Change references to different saved objects
|
|
|
|
[[saved-objects-api-resolve-import-errors-request]]
|
|
==== Request
|
|
|
|
`POST <kibana host>:<port>/api/saved_objects/_resolve_import_errors`
|
|
|
|
`POST <kibana host>:<port>/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.
|
|
|
|
[[saved-objects-api-resolve-import-errors-request-body]]
|
|
==== Request body
|
|
|
|
The request body must include the multipart/form-data type.
|
|
|
|
`file`::
|
|
The same file given to the import API.
|
|
|
|
`retries`::
|
|
(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.
|
|
|
|
[[saved-objects-api-resolve-import-errors-response-body]]
|
|
==== Response body
|
|
|
|
`success`::
|
|
Top-level property that indicates if the errors successfully resolved.
|
|
|
|
`successCount`::
|
|
Indicates the number of successfully resolved records.
|
|
|
|
`errors`::
|
|
(array) Specifies the objects that failed to resolve.
|
|
|
|
[[saved-objects-api-resolve-import-errors-codes]]
|
|
==== Response code
|
|
|
|
`200`::
|
|
Indicates a successful call.
|
|
|
|
[[saved-objects-api-resolve-import-errors-example]]
|
|
==== Examples
|
|
|
|
Retry a dashboard import:
|
|
|
|
[source,sh]
|
|
--------------------------------------------------
|
|
$ curl -X POST api/saved_objects/_resolve_import_errors -H "kbn-xsrf: true" --form file=@file.ndjson --form retries='[{"type":"dashboard","id":"my-dashboard"}]'
|
|
--------------------------------------------------
|
|
// KIBANA
|
|
|
|
The `file.ndjson` file contains the following:
|
|
|
|
[source,sh]
|
|
--------------------------------------------------
|
|
{"type":"dashboard","id":"my-dashboard","attributes":{"title":"Look at my dashboard"}}
|
|
--------------------------------------------------
|
|
|
|
The API returns the following:
|
|
|
|
[source,sh]
|
|
--------------------------------------------------
|
|
{
|
|
"success": true,
|
|
"successCount": 1
|
|
}
|
|
--------------------------------------------------
|
|
|
|
Resolve errors for a dashboard and overwrite the existing saved object:
|
|
|
|
[source,sh]
|
|
--------------------------------------------------
|
|
$ curl -X POST api/saved_objects/_resolve_import_errors -H "kbn-xsrf: true" --form file=@file.ndjson --form retries='[{"type":"dashboard","id":"my-dashboard","overwrite":true}]'
|
|
--------------------------------------------------
|
|
// KIBANA
|
|
|
|
The `file.ndjson` file contains the following:
|
|
|
|
[source,sh]
|
|
--------------------------------------------------
|
|
{"type":"index-pattern","id":"my-pattern","attributes":{"title":"my-pattern-*"}}
|
|
{"type":"dashboard","id":"my-dashboard","attributes":{"title":"Look at my dashboard"}}
|
|
--------------------------------------------------
|
|
|
|
The API returns the following:
|
|
|
|
[source,sh]
|
|
--------------------------------------------------
|
|
{
|
|
"success": true,
|
|
"successCount": 1
|
|
}
|
|
--------------------------------------------------
|
|
|
|
Resolve errors for a visualization by replacing the index pattern with another:
|
|
|
|
[source,sh]
|
|
--------------------------------------------------
|
|
$ curl -X POST 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"}]}]'
|
|
--------------------------------------------------
|
|
// KIBANA
|
|
|
|
The `file.ndjson` file contains the following:
|
|
|
|
[source,sh]
|
|
--------------------------------------------------
|
|
{"type":"visualization","id":"my-vis","attributes":{"title":"Look at my visualization"},"references":[{"name":"ref_0","type":"index-pattern","id":"missing"}]}
|
|
--------------------------------------------------
|
|
|
|
The API returns the following:
|
|
|
|
[source,sh]
|
|
--------------------------------------------------
|
|
{
|
|
"success": true,
|
|
"successCount": 1
|
|
}
|
|
--------------------------------------------------
|