Update saved objects in spaces

POST /api/spaces/_update_objects_spaces

Update one or more saved objects to add or remove them from some spaces.

Headers

  • The version of the API to use

    Value is 2023-10-31. Default value is 2023-10-31.

  • kbn-xsrf string Required

    A required header to protect against CSRF attacks

application/json; Elastic-Api-Version=2023-10-31

Body

  • objects array[object] Required
    Hide objects attributes Show objects attributes object
    • id string Required

      The identifier of the saved object to update.

    • type string Required

      The type of the saved object to update.

  • spacesToAdd array[string] Required

    The identifiers of the spaces the saved objects should be added to or removed from.

  • spacesToRemove array[string] Required

    The identifiers of the spaces the saved objects should be added to or removed from.

Responses

  • 200 application/json; Elastic-Api-Version=2023-10-31
POST /api/spaces/_update_objects_spaces
curl \
 -X POST https://localhost:5601/api/spaces/_update_objects_spaces \
 -H "Content-Type: application/json; Elastic-Api-Version=2023-10-31" \
 -H "elastic-api-version: 2023-10-31" \
 -H "kbn-xsrf: true"
Request example
Update the spaces of each saved object and all its references.
{
  "objects": [
    {
      "id": "90943e30-9a47-11e8-b64d-95841ca0b247",
      "type": "index-pattern"
    }
  ],
  "spacesToAdd": [
    "test"
  ],
  "spacesToRemove": []
}
Response examples (200)
The response from updating the spaces of saved objects.
{
  "objects": [
    {
      "id": "90943e30-9a47-11e8-b64d-95841ca0b247",
      "type": "index-pattern",
      "spaces": [
        "default",
        "test"
      ]
    }
  ]
}