2018-05-30 18:27:48 +02:00
[[saved-objects-api-update]]
2019-09-06 18:09:57 +02:00
=== Update object API
++++
<titleabbrev>Update object</titleabbrev>
++++
2018-05-30 18:27:48 +02:00
2019-10-16 22:10:40 +02:00
experimental[] Update the attributes for existing {kib} saved objects.
2018-12-05 22:20:58 +01:00
2019-09-06 18:09:57 +02:00
[[saved-objects-api-update-request]]
2018-05-30 18:27:48 +02:00
==== Request
`PUT /api/saved_objects/<type>/<id>`
2019-10-18 19:17:54 +02:00
`PUT /s/<space_id>/api/saved_objects/<type>/<id>`
2019-09-06 18:09:57 +02:00
[[saved-objects-api-update-path-params]]
2019-10-18 19:17:54 +02:00
==== 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.
2018-05-30 18:27:48 +02:00
2019-09-06 18:09:57 +02:00
`type`::
(Required, string) Valid options include `visualization`, `dashboard`, `search`, `index-pattern`, `config`, and `timelion-sheet`.
2018-05-30 18:27:48 +02:00
2019-09-06 18:09:57 +02:00
`id`::
(Required, string) The object ID to update.
2018-05-30 18:27:48 +02:00
2019-09-06 18:09:57 +02:00
[[saved-objects-api-update-request-body]]
2019-10-18 19:17:54 +02:00
==== Request body
2018-05-30 18:27:48 +02:00
2019-09-06 18:09:57 +02:00
`attributes`::
(Required, object) The data to persist.
+
WARNING: When you update, attributes are not validated, which allows you to pass arbitrary and ill-formed data into the API and break {kib}. Make sure any data that you send to the API is properly formed.
`references`::
(Optional, array) Objects with `name`, `id`, and `type` properties that describe the other saved objects this object references. To refer to the other saved object, use `name` in the attributes, but never the `id`, which automatically updates during migrations or import/export.
2019-10-18 19:17:54 +02:00
2019-09-06 18:09:57 +02:00
[[saved-objects-api-update-errors-codes]]
==== Response code
2018-05-30 18:27:48 +02:00
2019-10-18 19:17:54 +02:00
`200`::
2019-09-06 18:09:57 +02:00
Indicates a successful call.
2018-05-30 18:27:48 +02:00
2019-09-06 18:09:57 +02:00
[[saved-objects-api-update-example]]
==== Example
2018-05-30 18:27:48 +02:00
2019-09-06 18:09:57 +02:00
Update an existing index pattern object,`my-pattern`, with a different title:
2018-05-30 18:27:48 +02:00
[source,js]
--------------------------------------------------
PUT api/saved_objects/index-pattern/my-pattern
{
"attributes": {
"title": "some-other-pattern-*"
}
}
--------------------------------------------------
// KIBANA
2019-09-06 18:09:57 +02:00
The API returns the following:
2018-05-30 18:27:48 +02:00
[source,js]
--------------------------------------------------
{
"id": "my-pattern",
"type": "index-pattern",
"version": 2,
"attributes": {
"title": "some-other-pattern-*"
}
}
--------------------------------------------------