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

  • kbn-xsrf string Required

    A required header to protect against CSRF attacks

application/json

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
POST /api/spaces/_update_objects_spaces
curl \ --request POST 'https://localhost:5601/api/spaces/_update_objects_spaces' \ --header "Authorization: $API_KEY" \ --header "Content-Type: application/json" \ --header "kbn-xsrf: true" \ --data '{"objects":[{"id":"90943e30-9a47-11e8-b64d-95841ca0b247","type":"index-pattern"}],"spacesToAdd":["test"],"spacesToRemove":[]}'
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" ] } ] }