Resolve copy saved objects to space conflicts API

edit

Resolve copy saved objects to space conflicts API

edit

[preview] This functionality is in technical preview and may be changed or removed in a future release. Elastic will work to fix any issues, but features in technical preview are not subject to the support SLA of official GA features. Overwrite saved objects that are returned as errors from the copy saved objects to space API.

Request

edit

POST <kibana host>:<port>/api/spaces/_resolve_copy_saved_objects_errors

POST <kibana host>:<port>/s/<space_id>/api/spaces/_resolve_copy_saved_objects_errors

Prerequisites

edit

Execute the copy saved objects to space API, which returns the errors for you to resolve.

Path parameters

edit
space_id
(Optional, string) The ID of the space that contains the saved objects you want to copy. When space_id is unspecified in the URL, the default space is used. The space_id must be the same value used during the failed copy saved objects to space API operation.

Request body

edit
objects

(Required, object array) The saved objects to copy. The objects must be the same values used during the failed copy saved objects to space API operation.

Properties of objects
type
(Required, string) The saved object type.
id
(Required, string) The saved object ID.
includeReferences
(Optional, boolean) When set to true, all saved objects related to the specified saved objects are copied into the target spaces. The includeReferences must be the same values used during the failed copy saved objects to space API operation. The default value is false.
retries

(Required, object) The retry operations to attempt. Object keys represent the target space IDs.

Properties of retries
<space_id>

(Required, array) The errors to resolve for the specified <space_id>.

Properties of <space_id>
type
(Required, string) The saved object type.
id
(Required, string) The saved object ID.
overwrite
(Required, boolean) When set to true, the saved object from the source space (desigated by the space_id path parameter) overwrites the conflicting object in the destination space. When set to false, this does nothing.

Response body

edit
<space_id>

(object) An object that describes the result of the copy operation for the space. Includes the dynamic keys in the response.

Properties of <space_id>
success
(boolean) The copy operation was successful. When set to false, some objects may have been copied. For additional information, refer to the successCount and errors properties.
successCount
(number) The number of objects that successfully copied.
errors

(Optional, array) The errors that occurred during the copy operation. When errors are reported, the success flag is set to false.

Properties of errors
id
(string) The saved object ID that failed to copy.
type
(string) The type of saved object that failed to copy.
error

(object) The error that caused the copy operation to fail.

Properties of error
type
(string) The type of error. For example, unsupported_type, missing_references, or unknown.

Examples

edit

Overwrite an index pattern in the marketing space, and a visualization in the sales space:

$ curl -X POST api/spaces/_resolve_copy_saved_objects_errors
{
  "objects": [{
    "type": "dashboard",
    "id": "my-dashboard"
  }],
  "includeReferences": true,
  "retries": {
    "marketing": [{
      "type": "index-pattern",
      "id": "my-pattern",
      "overwrite": true
    }],
    "sales": [{
      "type": "visualization",
      "id": "my-viz",
      "overwrite": true
    }]
  }
}

The API returns the following:

{
  "marketing": {
    "success": true,
    "successCount": 1
  },
  "sales": {
    "success": true,
    "successCount": 1
  }
}