kibana/docs/api/saved-objects/export.asciidoc

122 lines
3 KiB
Plaintext
Raw Normal View History

Basic server side export API for saved objects (#30326) * Initial work for new server side export API * Revert UI changes, API only in this PR * Remove whitespace at top of export.asciidoc * Add tests around limitations * Add comment * Convert some files to typescript * Move Boom.boomify to where the errors are created * Use Boom.badRequest for now * Fix lint issue * Move files * Update tests * Add functional test * Export all documents by default * Update test assertions * Use ~10000 saved objects in export api integration test * Convert route to typescript, add content-type response header * Move some tests to api_integration * Use new sort and rename functions/variables * Move tests to API integration * Cleanup and finalize api integration tests * Make type or objects required but not both in the same call * Add spaces / security tests * Add noTypeOrObjects to security / spaces tests * Use json-stable-stringify and add tests for export ordering * Address self feedback, add without kibana index test * Only allow export API to export index-pattern, dashboard, visualization and search type objects * Make import export size configurable and fix broken tests * Fix broken tests * Move test config to mock server * Add more typescript types instead of using any * Convert request from GET to POST * Fix saved objects mixin test * Update src/legacy/server/saved_objects/lib/export.ts Co-Authored-By: mikecote <mikecote@users.noreply.github.com> * Apply PR feedback * Fix lint error * Update test snapshots due to jest upgrade * Add error handling for bulkGet * Split export API into two endpoints * Update src/legacy/server/saved_objects/routes/export_by_type.test.ts Co-Authored-By: mikecote <mikecote@users.noreply.github.com> * Update docs/api/saved-objects/export_by_type.asciidoc Co-Authored-By: mikecote <mikecote@users.noreply.github.com> * Update docs/api/saved-objects/export_by_type.asciidoc Co-Authored-By: mikecote <mikecote@users.noreply.github.com> * Update src/legacy/server/saved_objects/routes/export_objects.test.ts Co-Authored-By: mikecote <mikecote@users.noreply.github.com> * Apply PR feedback * MockServer -> createMockServer * Revert back to single API * Re-apply PR feedback
2019-03-05 21:42:02 +01:00
[[saved-objects-api-export]]
=== Export objects API
++++
<titleabbrev>Export objects</titleabbrev>
++++
Basic server side export API for saved objects (#30326) * Initial work for new server side export API * Revert UI changes, API only in this PR * Remove whitespace at top of export.asciidoc * Add tests around limitations * Add comment * Convert some files to typescript * Move Boom.boomify to where the errors are created * Use Boom.badRequest for now * Fix lint issue * Move files * Update tests * Add functional test * Export all documents by default * Update test assertions * Use ~10000 saved objects in export api integration test * Convert route to typescript, add content-type response header * Move some tests to api_integration * Use new sort and rename functions/variables * Move tests to API integration * Cleanup and finalize api integration tests * Make type or objects required but not both in the same call * Add spaces / security tests * Add noTypeOrObjects to security / spaces tests * Use json-stable-stringify and add tests for export ordering * Address self feedback, add without kibana index test * Only allow export API to export index-pattern, dashboard, visualization and search type objects * Make import export size configurable and fix broken tests * Fix broken tests * Move test config to mock server * Add more typescript types instead of using any * Convert request from GET to POST * Fix saved objects mixin test * Update src/legacy/server/saved_objects/lib/export.ts Co-Authored-By: mikecote <mikecote@users.noreply.github.com> * Apply PR feedback * Fix lint error * Update test snapshots due to jest upgrade * Add error handling for bulkGet * Split export API into two endpoints * Update src/legacy/server/saved_objects/routes/export_by_type.test.ts Co-Authored-By: mikecote <mikecote@users.noreply.github.com> * Update docs/api/saved-objects/export_by_type.asciidoc Co-Authored-By: mikecote <mikecote@users.noreply.github.com> * Update docs/api/saved-objects/export_by_type.asciidoc Co-Authored-By: mikecote <mikecote@users.noreply.github.com> * Update src/legacy/server/saved_objects/routes/export_objects.test.ts Co-Authored-By: mikecote <mikecote@users.noreply.github.com> * Apply PR feedback * MockServer -> createMockServer * Revert back to single API * Re-apply PR feedback
2019-03-05 21:42:02 +01:00
experimental[] Retrieve sets of saved objects that you want to import into {kib}.
Basic server side export API for saved objects (#30326) * Initial work for new server side export API * Revert UI changes, API only in this PR * Remove whitespace at top of export.asciidoc * Add tests around limitations * Add comment * Convert some files to typescript * Move Boom.boomify to where the errors are created * Use Boom.badRequest for now * Fix lint issue * Move files * Update tests * Add functional test * Export all documents by default * Update test assertions * Use ~10000 saved objects in export api integration test * Convert route to typescript, add content-type response header * Move some tests to api_integration * Use new sort and rename functions/variables * Move tests to API integration * Cleanup and finalize api integration tests * Make type or objects required but not both in the same call * Add spaces / security tests * Add noTypeOrObjects to security / spaces tests * Use json-stable-stringify and add tests for export ordering * Address self feedback, add without kibana index test * Only allow export API to export index-pattern, dashboard, visualization and search type objects * Make import export size configurable and fix broken tests * Fix broken tests * Move test config to mock server * Add more typescript types instead of using any * Convert request from GET to POST * Fix saved objects mixin test * Update src/legacy/server/saved_objects/lib/export.ts Co-Authored-By: mikecote <mikecote@users.noreply.github.com> * Apply PR feedback * Fix lint error * Update test snapshots due to jest upgrade * Add error handling for bulkGet * Split export API into two endpoints * Update src/legacy/server/saved_objects/routes/export_by_type.test.ts Co-Authored-By: mikecote <mikecote@users.noreply.github.com> * Update docs/api/saved-objects/export_by_type.asciidoc Co-Authored-By: mikecote <mikecote@users.noreply.github.com> * Update docs/api/saved-objects/export_by_type.asciidoc Co-Authored-By: mikecote <mikecote@users.noreply.github.com> * Update src/legacy/server/saved_objects/routes/export_objects.test.ts Co-Authored-By: mikecote <mikecote@users.noreply.github.com> * Apply PR feedback * MockServer -> createMockServer * Revert back to single API * Re-apply PR feedback
2019-03-05 21:42:02 +01:00
[[saved-objects-api-export-request]]
Basic server side export API for saved objects (#30326) * Initial work for new server side export API * Revert UI changes, API only in this PR * Remove whitespace at top of export.asciidoc * Add tests around limitations * Add comment * Convert some files to typescript * Move Boom.boomify to where the errors are created * Use Boom.badRequest for now * Fix lint issue * Move files * Update tests * Add functional test * Export all documents by default * Update test assertions * Use ~10000 saved objects in export api integration test * Convert route to typescript, add content-type response header * Move some tests to api_integration * Use new sort and rename functions/variables * Move tests to API integration * Cleanup and finalize api integration tests * Make type or objects required but not both in the same call * Add spaces / security tests * Add noTypeOrObjects to security / spaces tests * Use json-stable-stringify and add tests for export ordering * Address self feedback, add without kibana index test * Only allow export API to export index-pattern, dashboard, visualization and search type objects * Make import export size configurable and fix broken tests * Fix broken tests * Move test config to mock server * Add more typescript types instead of using any * Convert request from GET to POST * Fix saved objects mixin test * Update src/legacy/server/saved_objects/lib/export.ts Co-Authored-By: mikecote <mikecote@users.noreply.github.com> * Apply PR feedback * Fix lint error * Update test snapshots due to jest upgrade * Add error handling for bulkGet * Split export API into two endpoints * Update src/legacy/server/saved_objects/routes/export_by_type.test.ts Co-Authored-By: mikecote <mikecote@users.noreply.github.com> * Update docs/api/saved-objects/export_by_type.asciidoc Co-Authored-By: mikecote <mikecote@users.noreply.github.com> * Update docs/api/saved-objects/export_by_type.asciidoc Co-Authored-By: mikecote <mikecote@users.noreply.github.com> * Update src/legacy/server/saved_objects/routes/export_objects.test.ts Co-Authored-By: mikecote <mikecote@users.noreply.github.com> * Apply PR feedback * MockServer -> createMockServer * Revert back to single API * Re-apply PR feedback
2019-03-05 21:42:02 +01:00
==== Request
`POST /api/saved_objects/_export`
`POST /s/<space_id>/api/saved_objects/_export`
[[saved-objects-api-export-path-params]]
==== 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.
[[saved-objects-api-export-request-request-body]]
==== Request body
`type`::
(Optional, array|string) The saved object types to include in the export.
`objects`::
(Optional, array) A list of objects to export.
`includeReferencesDeep`::
(Optional, boolean) Includes all of the referenced objects in the exported objects.
Basic server side export API for saved objects (#30326) * Initial work for new server side export API * Revert UI changes, API only in this PR * Remove whitespace at top of export.asciidoc * Add tests around limitations * Add comment * Convert some files to typescript * Move Boom.boomify to where the errors are created * Use Boom.badRequest for now * Fix lint issue * Move files * Update tests * Add functional test * Export all documents by default * Update test assertions * Use ~10000 saved objects in export api integration test * Convert route to typescript, add content-type response header * Move some tests to api_integration * Use new sort and rename functions/variables * Move tests to API integration * Cleanup and finalize api integration tests * Make type or objects required but not both in the same call * Add spaces / security tests * Add noTypeOrObjects to security / spaces tests * Use json-stable-stringify and add tests for export ordering * Address self feedback, add without kibana index test * Only allow export API to export index-pattern, dashboard, visualization and search type objects * Make import export size configurable and fix broken tests * Fix broken tests * Move test config to mock server * Add more typescript types instead of using any * Convert request from GET to POST * Fix saved objects mixin test * Update src/legacy/server/saved_objects/lib/export.ts Co-Authored-By: mikecote <mikecote@users.noreply.github.com> * Apply PR feedback * Fix lint error * Update test snapshots due to jest upgrade * Add error handling for bulkGet * Split export API into two endpoints * Update src/legacy/server/saved_objects/routes/export_by_type.test.ts Co-Authored-By: mikecote <mikecote@users.noreply.github.com> * Update docs/api/saved-objects/export_by_type.asciidoc Co-Authored-By: mikecote <mikecote@users.noreply.github.com> * Update docs/api/saved-objects/export_by_type.asciidoc Co-Authored-By: mikecote <mikecote@users.noreply.github.com> * Update src/legacy/server/saved_objects/routes/export_objects.test.ts Co-Authored-By: mikecote <mikecote@users.noreply.github.com> * Apply PR feedback * MockServer -> createMockServer * Revert back to single API * Re-apply PR feedback
2019-03-05 21:42:02 +01:00
`excludeExportDetails`::
(Optional, boolean) Do not add export details entry at the end of the stream.
TIP: You must include `type` or `objects` in the request body.
Basic server side export API for saved objects (#30326) * Initial work for new server side export API * Revert UI changes, API only in this PR * Remove whitespace at top of export.asciidoc * Add tests around limitations * Add comment * Convert some files to typescript * Move Boom.boomify to where the errors are created * Use Boom.badRequest for now * Fix lint issue * Move files * Update tests * Add functional test * Export all documents by default * Update test assertions * Use ~10000 saved objects in export api integration test * Convert route to typescript, add content-type response header * Move some tests to api_integration * Use new sort and rename functions/variables * Move tests to API integration * Cleanup and finalize api integration tests * Make type or objects required but not both in the same call * Add spaces / security tests * Add noTypeOrObjects to security / spaces tests * Use json-stable-stringify and add tests for export ordering * Address self feedback, add without kibana index test * Only allow export API to export index-pattern, dashboard, visualization and search type objects * Make import export size configurable and fix broken tests * Fix broken tests * Move test config to mock server * Add more typescript types instead of using any * Convert request from GET to POST * Fix saved objects mixin test * Update src/legacy/server/saved_objects/lib/export.ts Co-Authored-By: mikecote <mikecote@users.noreply.github.com> * Apply PR feedback * Fix lint error * Update test snapshots due to jest upgrade * Add error handling for bulkGet * Split export API into two endpoints * Update src/legacy/server/saved_objects/routes/export_by_type.test.ts Co-Authored-By: mikecote <mikecote@users.noreply.github.com> * Update docs/api/saved-objects/export_by_type.asciidoc Co-Authored-By: mikecote <mikecote@users.noreply.github.com> * Update docs/api/saved-objects/export_by_type.asciidoc Co-Authored-By: mikecote <mikecote@users.noreply.github.com> * Update src/legacy/server/saved_objects/routes/export_objects.test.ts Co-Authored-By: mikecote <mikecote@users.noreply.github.com> * Apply PR feedback * MockServer -> createMockServer * Revert back to single API * Re-apply PR feedback
2019-03-05 21:42:02 +01:00
[[saved-objects-api-export-request-response-body]]
Basic server side export API for saved objects (#30326) * Initial work for new server side export API * Revert UI changes, API only in this PR * Remove whitespace at top of export.asciidoc * Add tests around limitations * Add comment * Convert some files to typescript * Move Boom.boomify to where the errors are created * Use Boom.badRequest for now * Fix lint issue * Move files * Update tests * Add functional test * Export all documents by default * Update test assertions * Use ~10000 saved objects in export api integration test * Convert route to typescript, add content-type response header * Move some tests to api_integration * Use new sort and rename functions/variables * Move tests to API integration * Cleanup and finalize api integration tests * Make type or objects required but not both in the same call * Add spaces / security tests * Add noTypeOrObjects to security / spaces tests * Use json-stable-stringify and add tests for export ordering * Address self feedback, add without kibana index test * Only allow export API to export index-pattern, dashboard, visualization and search type objects * Make import export size configurable and fix broken tests * Fix broken tests * Move test config to mock server * Add more typescript types instead of using any * Convert request from GET to POST * Fix saved objects mixin test * Update src/legacy/server/saved_objects/lib/export.ts Co-Authored-By: mikecote <mikecote@users.noreply.github.com> * Apply PR feedback * Fix lint error * Update test snapshots due to jest upgrade * Add error handling for bulkGet * Split export API into two endpoints * Update src/legacy/server/saved_objects/routes/export_by_type.test.ts Co-Authored-By: mikecote <mikecote@users.noreply.github.com> * Update docs/api/saved-objects/export_by_type.asciidoc Co-Authored-By: mikecote <mikecote@users.noreply.github.com> * Update docs/api/saved-objects/export_by_type.asciidoc Co-Authored-By: mikecote <mikecote@users.noreply.github.com> * Update src/legacy/server/saved_objects/routes/export_objects.test.ts Co-Authored-By: mikecote <mikecote@users.noreply.github.com> * Apply PR feedback * MockServer -> createMockServer * Revert back to single API * Re-apply PR feedback
2019-03-05 21:42:02 +01:00
==== Response body
The format of the response body is newline delimited JSON. Each exported object is exported as a valid JSON record and separated by the newline character '\n'.
When `excludeExportDetails=false` (the default) we append an export result details record at the end of the file after all the saved object records. The export result details object has the following format:
[source,json]
--------------------------------------------------
{
"exportedCount": 27,
"missingRefCount": 2,
"missingReferences": [
{ "id": "an-id", "type": "visualisation"},
{ "id": "another-id", "type": "index-pattern"}
]
}
--------------------------------------------------
[[export-objects-api-create-request-codes]]
==== Response code
Basic server side export API for saved objects (#30326) * Initial work for new server side export API * Revert UI changes, API only in this PR * Remove whitespace at top of export.asciidoc * Add tests around limitations * Add comment * Convert some files to typescript * Move Boom.boomify to where the errors are created * Use Boom.badRequest for now * Fix lint issue * Move files * Update tests * Add functional test * Export all documents by default * Update test assertions * Use ~10000 saved objects in export api integration test * Convert route to typescript, add content-type response header * Move some tests to api_integration * Use new sort and rename functions/variables * Move tests to API integration * Cleanup and finalize api integration tests * Make type or objects required but not both in the same call * Add spaces / security tests * Add noTypeOrObjects to security / spaces tests * Use json-stable-stringify and add tests for export ordering * Address self feedback, add without kibana index test * Only allow export API to export index-pattern, dashboard, visualization and search type objects * Make import export size configurable and fix broken tests * Fix broken tests * Move test config to mock server * Add more typescript types instead of using any * Convert request from GET to POST * Fix saved objects mixin test * Update src/legacy/server/saved_objects/lib/export.ts Co-Authored-By: mikecote <mikecote@users.noreply.github.com> * Apply PR feedback * Fix lint error * Update test snapshots due to jest upgrade * Add error handling for bulkGet * Split export API into two endpoints * Update src/legacy/server/saved_objects/routes/export_by_type.test.ts Co-Authored-By: mikecote <mikecote@users.noreply.github.com> * Update docs/api/saved-objects/export_by_type.asciidoc Co-Authored-By: mikecote <mikecote@users.noreply.github.com> * Update docs/api/saved-objects/export_by_type.asciidoc Co-Authored-By: mikecote <mikecote@users.noreply.github.com> * Update src/legacy/server/saved_objects/routes/export_objects.test.ts Co-Authored-By: mikecote <mikecote@users.noreply.github.com> * Apply PR feedback * MockServer -> createMockServer * Revert back to single API * Re-apply PR feedback
2019-03-05 21:42:02 +01:00
`200`::
Indicates a successful call.
[[ssaved-objects-api-create-example]]
Basic server side export API for saved objects (#30326) * Initial work for new server side export API * Revert UI changes, API only in this PR * Remove whitespace at top of export.asciidoc * Add tests around limitations * Add comment * Convert some files to typescript * Move Boom.boomify to where the errors are created * Use Boom.badRequest for now * Fix lint issue * Move files * Update tests * Add functional test * Export all documents by default * Update test assertions * Use ~10000 saved objects in export api integration test * Convert route to typescript, add content-type response header * Move some tests to api_integration * Use new sort and rename functions/variables * Move tests to API integration * Cleanup and finalize api integration tests * Make type or objects required but not both in the same call * Add spaces / security tests * Add noTypeOrObjects to security / spaces tests * Use json-stable-stringify and add tests for export ordering * Address self feedback, add without kibana index test * Only allow export API to export index-pattern, dashboard, visualization and search type objects * Make import export size configurable and fix broken tests * Fix broken tests * Move test config to mock server * Add more typescript types instead of using any * Convert request from GET to POST * Fix saved objects mixin test * Update src/legacy/server/saved_objects/lib/export.ts Co-Authored-By: mikecote <mikecote@users.noreply.github.com> * Apply PR feedback * Fix lint error * Update test snapshots due to jest upgrade * Add error handling for bulkGet * Split export API into two endpoints * Update src/legacy/server/saved_objects/routes/export_by_type.test.ts Co-Authored-By: mikecote <mikecote@users.noreply.github.com> * Update docs/api/saved-objects/export_by_type.asciidoc Co-Authored-By: mikecote <mikecote@users.noreply.github.com> * Update docs/api/saved-objects/export_by_type.asciidoc Co-Authored-By: mikecote <mikecote@users.noreply.github.com> * Update src/legacy/server/saved_objects/routes/export_objects.test.ts Co-Authored-By: mikecote <mikecote@users.noreply.github.com> * Apply PR feedback * MockServer -> createMockServer * Revert back to single API * Re-apply PR feedback
2019-03-05 21:42:02 +01:00
==== Examples
Export all index pattern saved objects:
Basic server side export API for saved objects (#30326) * Initial work for new server side export API * Revert UI changes, API only in this PR * Remove whitespace at top of export.asciidoc * Add tests around limitations * Add comment * Convert some files to typescript * Move Boom.boomify to where the errors are created * Use Boom.badRequest for now * Fix lint issue * Move files * Update tests * Add functional test * Export all documents by default * Update test assertions * Use ~10000 saved objects in export api integration test * Convert route to typescript, add content-type response header * Move some tests to api_integration * Use new sort and rename functions/variables * Move tests to API integration * Cleanup and finalize api integration tests * Make type or objects required but not both in the same call * Add spaces / security tests * Add noTypeOrObjects to security / spaces tests * Use json-stable-stringify and add tests for export ordering * Address self feedback, add without kibana index test * Only allow export API to export index-pattern, dashboard, visualization and search type objects * Make import export size configurable and fix broken tests * Fix broken tests * Move test config to mock server * Add more typescript types instead of using any * Convert request from GET to POST * Fix saved objects mixin test * Update src/legacy/server/saved_objects/lib/export.ts Co-Authored-By: mikecote <mikecote@users.noreply.github.com> * Apply PR feedback * Fix lint error * Update test snapshots due to jest upgrade * Add error handling for bulkGet * Split export API into two endpoints * Update src/legacy/server/saved_objects/routes/export_by_type.test.ts Co-Authored-By: mikecote <mikecote@users.noreply.github.com> * Update docs/api/saved-objects/export_by_type.asciidoc Co-Authored-By: mikecote <mikecote@users.noreply.github.com> * Update docs/api/saved-objects/export_by_type.asciidoc Co-Authored-By: mikecote <mikecote@users.noreply.github.com> * Update src/legacy/server/saved_objects/routes/export_objects.test.ts Co-Authored-By: mikecote <mikecote@users.noreply.github.com> * Apply PR feedback * MockServer -> createMockServer * Revert back to single API * Re-apply PR feedback
2019-03-05 21:42:02 +01:00
[source,js]
--------------------------------------------------
POST api/saved_objects/_export
{
"type": "index-pattern"
Basic server side export API for saved objects (#30326) * Initial work for new server side export API * Revert UI changes, API only in this PR * Remove whitespace at top of export.asciidoc * Add tests around limitations * Add comment * Convert some files to typescript * Move Boom.boomify to where the errors are created * Use Boom.badRequest for now * Fix lint issue * Move files * Update tests * Add functional test * Export all documents by default * Update test assertions * Use ~10000 saved objects in export api integration test * Convert route to typescript, add content-type response header * Move some tests to api_integration * Use new sort and rename functions/variables * Move tests to API integration * Cleanup and finalize api integration tests * Make type or objects required but not both in the same call * Add spaces / security tests * Add noTypeOrObjects to security / spaces tests * Use json-stable-stringify and add tests for export ordering * Address self feedback, add without kibana index test * Only allow export API to export index-pattern, dashboard, visualization and search type objects * Make import export size configurable and fix broken tests * Fix broken tests * Move test config to mock server * Add more typescript types instead of using any * Convert request from GET to POST * Fix saved objects mixin test * Update src/legacy/server/saved_objects/lib/export.ts Co-Authored-By: mikecote <mikecote@users.noreply.github.com> * Apply PR feedback * Fix lint error * Update test snapshots due to jest upgrade * Add error handling for bulkGet * Split export API into two endpoints * Update src/legacy/server/saved_objects/routes/export_by_type.test.ts Co-Authored-By: mikecote <mikecote@users.noreply.github.com> * Update docs/api/saved-objects/export_by_type.asciidoc Co-Authored-By: mikecote <mikecote@users.noreply.github.com> * Update docs/api/saved-objects/export_by_type.asciidoc Co-Authored-By: mikecote <mikecote@users.noreply.github.com> * Update src/legacy/server/saved_objects/routes/export_objects.test.ts Co-Authored-By: mikecote <mikecote@users.noreply.github.com> * Apply PR feedback * MockServer -> createMockServer * Revert back to single API * Re-apply PR feedback
2019-03-05 21:42:02 +01:00
}
--------------------------------------------------
// KIBANA
Export all index pattern saved objects and exclude the export summary from the stream:
[source,js]
--------------------------------------------------
POST api/saved_objects/_export
{
"type": "index-pattern",
"excludeExportDetails": true
}
--------------------------------------------------
// KIBANA
Export a specific saved object:
[source,js]
--------------------------------------------------
POST api/saved_objects/_export
{
"objects": [
{
"type": "dashboard",
"id": "be3733a0-9efe-11e7-acb3-3dab96693fab"
}
]
}
--------------------------------------------------
// KIBANA
Export a specific saved object and it's related objects :
[source,js]
--------------------------------------------------
POST api/saved_objects/_export
{
"objects": [
{
"type": "dashboard",
"id": "be3733a0-9efe-11e7-acb3-3dab96693fab"
}
],
"includeReferencesDeep": true
}
--------------------------------------------------
// KIBANA