forked from elastic/kibana
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[data views] Swap references API docs (elastic#175183)
## Summary Docs for the swap references api - elastic#163225 The docs are on the terse side - I think this makes sense since this is a tool that should be used infrequently and only by people who use saved object references. --------- Co-authored-by: amyjtechwriter <[email protected]> Co-authored-by: Davis McPhee <[email protected]>
- Loading branch information
1 parent
6d03e72
commit eefda43
Showing
3 changed files
with
162 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
[[data-views-api-swap-references]] | ||
=== Swap references data view API | ||
++++ | ||
<titleabbrev>Swap references</titleabbrev> | ||
++++ | ||
|
||
Swap saved object references | ||
|
||
[WARNING] | ||
==== | ||
Misuse can break large numbers of saved objects! Practicing with a backup is recommended. | ||
==== | ||
|
||
[NOTE] | ||
==== | ||
For the most up-to-date API details, refer to the | ||
{kib-repo}/tree/{branch}/src/plugins/data_views/docs/openapi[open API specification]. | ||
==== | ||
|
||
[[data-views-api-swap-references-request]] | ||
==== Request | ||
|
||
`POST <kibana host>:<port>/api/data_views/swap_references` | ||
|
||
`POST <kibana host>:<port>/s/<space_id>/api/data_views/swap_references` | ||
|
||
|
||
[[data-views-api-swap-references-request-body]] | ||
==== Request body | ||
|
||
`fromId`:: | ||
(Required, string) Saved object reference to change. | ||
|
||
`toId`:: | ||
(Required, string) New saved object reference value to replace the old. | ||
|
||
`delete`:: | ||
(Optional, boolean) Deletes referenced saved object if all references are removed. | ||
|
||
`fromType`:: | ||
(Optional, string) Specify the type of the saved object reference to alter. Default is `index-pattern` for data view. | ||
|
||
`forId`:: | ||
(Optional, string or string[]) Limit the affected saved objects to one or more by IDs. | ||
|
||
`forType`:: | ||
(Optional, string) Limit the affected saved objects by type. | ||
|
||
[[data-views-api-swap-references-errors-codes]] | ||
==== Response code | ||
|
||
`200`:: | ||
Indicates a successful call. | ||
|
||
[[data-views-api-swap-references-example]] | ||
==== Examples | ||
|
||
Swap references to data view id "abcd-efg" with "xyz-123": | ||
|
||
[source,sh] | ||
-------------------------------------------------- | ||
$ curl -X api/data_views/swap_references | ||
{ | ||
"fromId" : "abcd-efg", | ||
"toId" : "xyz-123", | ||
"delete" : true // optional, removes data view which is no longer referenced | ||
} | ||
-------------------------------------------------- | ||
// KIBANA | ||
|
||
The API returns a list of affected saved objects: | ||
|
||
[source,sh] | ||
-------------------------------------------------- | ||
{ | ||
result: [{ id: "123", type: "visualization" }], | ||
deleteStatus: { | ||
remainingRefs: 0, | ||
deletePerformed: true | ||
} | ||
} | ||
-------------------------------------------------- | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
[[data-views-api-swap-references-preview]] | ||
=== Swap references preview data view API | ||
++++ | ||
<titleabbrev>Swap references preview</titleabbrev> | ||
++++ | ||
|
||
Swap saved object references preview | ||
|
||
[NOTE] | ||
==== | ||
For the most up-to-date API details, refer to the | ||
{kib-repo}/tree/{branch}/src/plugins/data_views/docs/openapi[open API specification]. | ||
==== | ||
|
||
[[data-views-api-swap-references-preview-request]] | ||
==== Request | ||
|
||
`POST <kibana host>:<port>/api/data_views/swap_references/_preview` | ||
|
||
`POST <kibana host>:<port>/s/<space_id>/api/data_views/swap_references/_preview` | ||
|
||
|
||
[[data-views-api-swap-references-preview-request-body]] | ||
==== Request body | ||
|
||
`fromId`:: | ||
(Required, string) Saved object reference to change. | ||
|
||
`toId`:: | ||
(Required, string) New saved object reference value to replace the old. | ||
|
||
`delete`:: | ||
(Optional, boolean) Deletes referenced saved object if all references are removed. | ||
|
||
`fromType`:: | ||
(Optional, string) Specify the type of the saved object reference to alter. Default is `index-pattern` for data view. | ||
|
||
`forId`:: | ||
(Optional, string or string[]) Limit the affected saved objects to one or more by IDs. | ||
|
||
`forType`:: | ||
(Optional, string) Limit the affected saved objects by type. | ||
|
||
[[data-views-api-swap-references-preview-errors-codes]] | ||
==== Response code | ||
|
||
`200`:: | ||
Indicates a successful call. | ||
|
||
[[data-views-api-swap-references-preview-example]] | ||
==== Examples | ||
|
||
Preview swapping references to data view id "abcd-efg" with "xyz-123": | ||
|
||
[source,sh] | ||
-------------------------------------------------- | ||
$ curl -X api/data_views/swap_references/_preview | ||
{ | ||
"fromId" : "abcd-efg", | ||
"toId" : "xyz-123" | ||
} | ||
-------------------------------------------------- | ||
// KIBANA | ||
|
||
The API returns a list of affected saved objects: | ||
|
||
[source,sh] | ||
-------------------------------------------------- | ||
{ | ||
result: [{ id: "123", type: "visualization" }], | ||
} | ||
-------------------------------------------------- | ||
|