Resolve copy saved objects to space conflicts API

edit

Resolve copy saved objects to space conflicts API

edit

Overwrites specific saved objects that were returned as errors from the Copy Saved Objects to Space API.

The underlying Spaces concepts are stable, but the APIs for managing Spaces are experimental.

Request

edit

POST /api/spaces/_resolve_copy_saved_objects_errors

POST /s/<space_id>/api/spaces/_resolve_copy_saved_objects_errors

Prerequisites

edit

Path parameters

edit
space_id
(Optional, string) Identifies the source space from which saved objects will be copied. If space_id is not specified in the URL, the default space is used. Must be the same value that was used during the failed Copy Saved Objects to Space operation.

Request body

edit
objects

(Required, object array) The saved objects to copy. Must be the same value that was used during the failed Copy Saved Objects to Space operation.

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 will also be copied into the target spaces. You must set this to the same value that you used when executing the Copy Saved Objects to Space API. The default value is false.
retries

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

<space_id>

(Required, array) The the conflicts to resolve for the indicated <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) will overwrite the the conflicting object in the destination space. When false, this does nothing.

Response body

edit
<space_id>

(object) Specifies the dynamic keys that are included in the response. An object describing the result of the copy operation for this particular space.

success
(boolean) Indicates if the copy operation was successful. Note that some objects may have been copied even if this is set to false. Consult the successCount and errors properties of the response for additional information.
successCount
(number) The number of objects that were successfully copied.
errors

(Optional, array) Collection of any errors that were encountered during the copy operation. If any errors are reported, then the success flag will be set to false.

id
(string) The saved object id which failed to copy.
type
(string) The type of saved object which failed to copy.
error

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

type:
(string) Indicates the type of error. May be one of: unsupported_type, missing_references, unknown.

Examples

edit

The following example overwrites an index pattern in the marketing space, and a visualization in the sales space.

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 result:

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