diff --git a/docs/api/saved-objects/export.asciidoc b/docs/api/saved-objects/export.asciidoc index 247af44e54c8b..237e54af3444b 100644 --- a/docs/api/saved-objects/export.asciidoc +++ b/docs/api/saved-objects/export.asciidoc @@ -6,6 +6,12 @@ experimental[] Retrieve sets of saved objects that you want to import into {kib}. +[NOTE] +==== +For the most up-to-date API details, refer to the +{kib-repo}/tree/{branch}/packages/core/saved-objects/docs/openapi[open API specification]. +==== + [[saved-objects-api-export-request]] ==== Request diff --git a/docs/api/saved-objects/import.asciidoc b/docs/api/saved-objects/import.asciidoc index 58c0e9b39b9ef..62ff1d040c5c0 100644 --- a/docs/api/saved-objects/import.asciidoc +++ b/docs/api/saved-objects/import.asciidoc @@ -6,6 +6,12 @@ experimental[] Create sets of {kib} saved objects from a file created by the export API. +[NOTE] +==== +For the most up-to-date API details, refer to the +{kib-repo}/tree/{branch}/packages/core/saved-objects/docs/openapi[open API specification]. +==== + ==== Compatibility across versions Saved objects can only be imported into the same version, a newer minor on the same major, or the next major. Exported saved objects are not backwards compatible and cannot be imported into an older version of {kib}. See the table below for compatibility examples: diff --git a/packages/core/saved-objects/docs/openapi/README.md b/packages/core/saved-objects/docs/openapi/README.md new file mode 100644 index 0000000000000..71b3ceebec0b3 --- /dev/null +++ b/packages/core/saved-objects/docs/openapi/README.md @@ -0,0 +1,34 @@ +# OpenAPI (Experimental) + +The current self-contained spec file is `bundled.json` or `bundled.yaml` and can be used for online tools like those found at . +This spec is experimental and may be incomplete or change later. + +A guide about the openApi specification can be found at [https://swagger.io/docs/specification/about/](https://swagger.io/docs/specification/about/). + +## The `openapi` folder + +* `entrypoint.yaml` is the overview file which pulls together all the paths and components. +* [Paths](paths/README.md): this defines each endpoint. A path can have one operation per http method. + +## Tools + +To validate and bundle the docs, you can use [Redocly](https://redocly.com/docs/cli/) and [Swagger/OpenAPI CLI](https://www.npmjs.com/package/swagger-cli). + +For example, run the following commands from the `packages/core/saved-objects/docs/openapi/` folder: + + ```bash + npx swagger-cli validate entrypoint.yaml + ``` + +Then you can generate the `bundled` files by running the following commands: + + ```bash + npx @redocly/cli bundle entrypoint.yaml --output bundled.yaml --ext yaml + npx @redocly/cli bundle entrypoint.yaml --output bundled.json --ext json + ``` + +After generating the json bundle ensure that it is also valid by running the following command: + + ```bash + npx @redocly/cli lint bundled.json + ``` diff --git a/packages/core/saved-objects/docs/openapi/bundled.json b/packages/core/saved-objects/docs/openapi/bundled.json new file mode 100644 index 0000000000000..21c305d6f4216 --- /dev/null +++ b/packages/core/saved-objects/docs/openapi/bundled.json @@ -0,0 +1,326 @@ +{ + "openapi": "3.1.0", + "info": { + "title": "Saved objects", + "description": "OpenAPI schema for saved object endpoints", + "version": "0.1", + "contact": { + "name": "Kibana Core Team" + }, + "license": { + "name": "Elastic License 2.0", + "url": "https://www.elastic.co/licensing/elastic-license" + } + }, + "servers": [ + { + "url": "http://localhost:5601", + "description": "local" + } + ], + "security": [ + { + "basicAuth": [] + }, + { + "apiKeyAuth": [] + } + ], + "tags": [ + { + "name": "saved objects", + "description": "Manage Kibana saved objects, including dashboards, visualizations, and more." + } + ], + "paths": { + "/api/saved_objects/_export": { + "post": { + "summary": "Retrieve sets of saved objects that you want to import into Kibana.", + "operationId": "exportSavedObjects", + "description": "This functionality is in technical preview and may be changed or removed in a future release. Elastic will apply best effort to fix any issues, but features in technical preview are not subject to the support SLA of official GA features. NOTE: The `savedObjects.maxImportExportSize` configuration setting limits the number of saved objects which may be exported.\n", + "tags": [ + "saved objects" + ], + "parameters": [ + { + "$ref": "#/components/parameters/kbn_xsrf" + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "anyOf": [ + { + "required": [ + "type" + ] + }, + { + "required": [ + "objects" + ] + } + ], + "properties": { + "excludeExportDetails": { + "description": "Do not add export details entry at the end of the stream.", + "type": "boolean", + "default": false + }, + "includeReferencesDeep": { + "description": "Includes all of the referenced objects in the exported objects.", + "type": "boolean" + }, + "objects": { + "description": "A list of objects to export.", + "type": "array", + "items": { + "type": "object" + } + }, + "type": { + "description": "The saved object types to include in the export.", + "oneOf": [ + { + "type": "string" + }, + { + "type": "array", + "items": { + "type": "string" + } + } + ] + } + } + }, + "examples": { + "exportSavedObjectsRequest": { + "$ref": "#/components/examples/export_objects_request" + } + } + } + } + }, + "responses": { + "200": { + "description": "Indicates a successful call.", + "content": { + "multipart/form-data": { + "schema": { + "type": "string" + }, + "examples": { + "exportSavedObjectsResponse": { + "$ref": "#/components/examples/export_objects_response" + } + } + } + } + }, + "400": { + "description": "Bad request.", + "content": { + "application/json": { + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "servers": [ + { + "url": "https://localhost:5601" + } + ] + }, + "servers": [ + { + "url": "https://localhost:5601" + } + ] + }, + "/api/saved_objects/_import": { + "post": { + "summary": "Create sets of Kibana saved objects from a file created by the export API.", + "operationId": "importSavedObjects", + "description": "This functionality is in technical preview and may be changed or removed in a future release. Elastic will apply best effort to fix any issues, but features in technical preview are not subject to the support SLA of official GA features. Saved objects can be imported only into the same version, a newer minor on the same major, or the next major. Exported saved objects are not backwards compatible and cannot be imported into an older version of Kibana.\n", + "tags": [ + "saved objects" + ], + "parameters": [ + { + "$ref": "#/components/parameters/kbn_xsrf" + }, + { + "in": "query", + "name": "compatibilityMode", + "schema": { + "type": "boolean" + }, + "required": false, + "description": "Applies various adjustments to the saved objects that are being imported to maintain compatibility between different Kibana versions. Use this option only if you encounter issues with imported saved objects. NOTE: This option cannot be used with the `createNewCopies` option.\n" + }, + { + "in": "query", + "name": "createNewCopies", + "schema": { + "type": "boolean" + }, + "required": false, + "description": "Creates copies of saved objects, regenerates each object ID, and resets the origin. When used, potential conflict errors are avoided. NOTE: This option cannot be used with the `overwrite` and `compatibilityMode` options.\n" + }, + { + "in": "query", + "name": "overwrite", + "schema": { + "type": "boolean" + }, + "required": false, + "description": "Overwrites saved objects when they already exist. When used, potential conflict errors are automatically resolved by overwriting the destination object. NOTE: This option cannot be used with the `createNewCopies` option.\n" + } + ], + "requestBody": { + "required": true, + "content": { + "multipart/form-data": { + "schema": { + "type": "object", + "description": "A file exported using the export API. NOTE: The `savedObjects.maxImportExportSize` configuration setting limits the number of saved objects which may be included in this file. Similarly, the `savedObjects.maxImportPayloadBytes` setting limits the overall size of the file that can be imported.\n" + } + } + } + }, + "responses": { + "200": { + "description": "Indicates a successful call.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "errors": { + "type": "array", + "description": "Indicates the import was unsuccessful and specifies the objects that failed to import. One object may result in multiple errors, which requires separate steps to resolve. For instance, a `missing_references` error and conflict error.\n" + }, + "success": { + "type": "boolean", + "description": "Indicates when the import was successfully completed. When set to false, some objects may not have been created. For additional information, refer to the `errors` and `successResults` properties.\n" + }, + "successCount": { + "type": "integer", + "description": "Indicates the number of successfully imported records." + }, + "successResults": { + "type": "array", + "items": { + "type": "object" + }, + "description": "Indicates the objects that are successfully imported, with any metadata if applicable. Objects are created only when all resolvable errors are addressed, including conflicts and missing references. If objects are created as new copies, each entry in the `successResults` array includes a `destinationId` attribute.\n" + }, + "warnings": { + "type": "array" + } + } + }, + "examples": { + "importObjectsResponse": { + "$ref": "#/components/examples/import_objects_response" + } + } + } + } + }, + "400": { + "description": "Bad request.", + "content": { + "application/json": { + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "servers": [ + { + "url": "https://localhost:5601" + } + ] + }, + "servers": [ + { + "url": "https://localhost:5601" + } + ] + } + }, + "components": { + "securitySchemes": { + "basicAuth": { + "type": "http", + "scheme": "basic" + }, + "apiKeyAuth": { + "type": "apiKey", + "in": "header", + "name": "ApiKey" + } + }, + "parameters": { + "kbn_xsrf": { + "schema": { + "type": "string" + }, + "in": "header", + "name": "kbn-xsrf", + "description": "Cross-site request forgery protection", + "required": true + } + }, + "examples": { + "export_objects_request": { + "summary": "Export a specific saved object.", + "value": { + "objects": [ + { + "type": "index-pattern", + "id": "90943e30-9a47-11e8-b64d-95841ca0b247" + } + ], + "includeReferencesDeep": false + } + }, + "export_objects_response": { + "summary": "The export objects API response contains a JSON record for each exported object and an export result details record.", + "value": "{\"attributes\":{\"fieldFormatMap\":\"{\\\"hour_of_day\\\":{}}\",\"name\":\"Kibana Sample Data Logs\",\"runtimeFieldMap\":\"{\\\"hour_of_day\\\":{\\\"type\\\":\\\"long\\\",\\\"script\\\":{\\\"source\\\":\\\"emit(doc['timestamp'].value.getHour());\\\"}}}\",\"timeFieldName\":\"timestamp\",\"title\":\"kibana_sample_data_logs\"},\"coreMigrationVersion\":\"8.8.0\",\"created_at\":\"2023-07-25T19:36:36.695Z\",\"id\":\"90943e30-9a47-11e8-b64d-95841ca0b247\",\"managed\":false,\"references\":[],\"type\":\"index-pattern\",\"typeMigrationVersion\":\"8.0.0\",\"updated_at\":\"2023-07-25T19:36:36.695Z\",\"version\":\"WzM5LDJd\"}\n{\"excludedObjects\":[],\"excludedObjectsCount\":0,\"exportedCount\":1,\"missingRefCount\":0,\"missingReferences\":[]}\n" + }, + "import_objects_response": { + "summary": "The import objects API response indicates a successful import and the objects are created. Since these objects are created as new copies, each entry in the successResults array includes a destinationId attribute.", + "value": { + "successCount": 1, + "success": true, + "warnings": [], + "successResults": [ + { + "type": "index-pattern", + "id": "90943e30-9a47-11e8-b64d-95841ca0b247", + "meta": { + "title": "Kibana Sample Data Logs", + "icon": "indexPatternApp" + }, + "managed": false, + "destinationId": "82d2760c-468f-49cf-83aa-b9a35b6a8943" + } + ] + } + } + } + } +} \ No newline at end of file diff --git a/packages/core/saved-objects/docs/openapi/bundled.yaml b/packages/core/saved-objects/docs/openapi/bundled.yaml new file mode 100644 index 0000000000000..0facbd5446640 --- /dev/null +++ b/packages/core/saved-objects/docs/openapi/bundled.yaml @@ -0,0 +1,209 @@ +openapi: 3.1.0 +info: + title: Saved objects + description: OpenAPI schema for saved object endpoints + version: '0.1' + contact: + name: Kibana Core Team + license: + name: Elastic License 2.0 + url: https://www.elastic.co/licensing/elastic-license +servers: + - url: http://localhost:5601 + description: local +security: + - basicAuth: [] + - apiKeyAuth: [] +tags: + - name: saved objects + description: Manage Kibana saved objects, including dashboards, visualizations, and more. +paths: + /api/saved_objects/_export: + post: + summary: Retrieve sets of saved objects that you want to import into Kibana. + operationId: exportSavedObjects + description: | + This functionality is in technical preview and may be changed or removed in a future release. Elastic will apply best effort to fix any issues, but features in technical preview are not subject to the support SLA of official GA features. NOTE: The `savedObjects.maxImportExportSize` configuration setting limits the number of saved objects which may be exported. + tags: + - saved objects + parameters: + - $ref: '#/components/parameters/kbn_xsrf' + requestBody: + required: true + content: + application/json: + schema: + type: object + anyOf: + - required: + - type + - required: + - objects + properties: + excludeExportDetails: + description: Do not add export details entry at the end of the stream. + type: boolean + default: false + includeReferencesDeep: + description: Includes all of the referenced objects in the exported objects. + type: boolean + objects: + description: A list of objects to export. + type: array + items: + type: object + type: + description: The saved object types to include in the export. + oneOf: + - type: string + - type: array + items: + type: string + examples: + exportSavedObjectsRequest: + $ref: '#/components/examples/export_objects_request' + responses: + '200': + description: Indicates a successful call. + content: + multipart/form-data: + schema: + type: string + examples: + exportSavedObjectsResponse: + $ref: '#/components/examples/export_objects_response' + '400': + description: Bad request. + content: + application/json: + schema: + type: object + additionalProperties: true + servers: + - url: https://localhost:5601 + servers: + - url: https://localhost:5601 + /api/saved_objects/_import: + post: + summary: Create sets of Kibana saved objects from a file created by the export API. + operationId: importSavedObjects + description: | + This functionality is in technical preview and may be changed or removed in a future release. Elastic will apply best effort to fix any issues, but features in technical preview are not subject to the support SLA of official GA features. Saved objects can be imported only into the same version, a newer minor on the same major, or the next major. Exported saved objects are not backwards compatible and cannot be imported into an older version of Kibana. + tags: + - saved objects + parameters: + - $ref: '#/components/parameters/kbn_xsrf' + - in: query + name: compatibilityMode + schema: + type: boolean + required: false + description: | + Applies various adjustments to the saved objects that are being imported to maintain compatibility between different Kibana versions. Use this option only if you encounter issues with imported saved objects. NOTE: This option cannot be used with the `createNewCopies` option. + - in: query + name: createNewCopies + schema: + type: boolean + required: false + description: | + Creates copies of saved objects, regenerates each object ID, and resets the origin. When used, potential conflict errors are avoided. NOTE: This option cannot be used with the `overwrite` and `compatibilityMode` options. + - in: query + name: overwrite + schema: + type: boolean + required: false + description: | + Overwrites saved objects when they already exist. When used, potential conflict errors are automatically resolved by overwriting the destination object. NOTE: This option cannot be used with the `createNewCopies` option. + requestBody: + required: true + content: + multipart/form-data: + schema: + type: object + description: | + A file exported using the export API. NOTE: The `savedObjects.maxImportExportSize` configuration setting limits the number of saved objects which may be included in this file. Similarly, the `savedObjects.maxImportPayloadBytes` setting limits the overall size of the file that can be imported. + responses: + '200': + description: Indicates a successful call. + content: + application/json: + schema: + type: object + properties: + errors: + type: array + description: | + Indicates the import was unsuccessful and specifies the objects that failed to import. One object may result in multiple errors, which requires separate steps to resolve. For instance, a `missing_references` error and conflict error. + success: + type: boolean + description: | + Indicates when the import was successfully completed. When set to false, some objects may not have been created. For additional information, refer to the `errors` and `successResults` properties. + successCount: + type: integer + description: Indicates the number of successfully imported records. + successResults: + type: array + items: + type: object + description: | + Indicates the objects that are successfully imported, with any metadata if applicable. Objects are created only when all resolvable errors are addressed, including conflicts and missing references. If objects are created as new copies, each entry in the `successResults` array includes a `destinationId` attribute. + warnings: + type: array + examples: + importObjectsResponse: + $ref: '#/components/examples/import_objects_response' + '400': + description: Bad request. + content: + application/json: + schema: + type: object + additionalProperties: true + servers: + - url: https://localhost:5601 + servers: + - url: https://localhost:5601 +components: + securitySchemes: + basicAuth: + type: http + scheme: basic + apiKeyAuth: + type: apiKey + in: header + name: ApiKey + parameters: + kbn_xsrf: + schema: + type: string + in: header + name: kbn-xsrf + description: Cross-site request forgery protection + required: true + examples: + export_objects_request: + summary: Export a specific saved object. + value: + objects: + - type: index-pattern + id: 90943e30-9a47-11e8-b64d-95841ca0b247 + includeReferencesDeep: false + export_objects_response: + summary: The export objects API response contains a JSON record for each exported object and an export result details record. + value: | + {"attributes":{"fieldFormatMap":"{\"hour_of_day\":{}}","name":"Kibana Sample Data Logs","runtimeFieldMap":"{\"hour_of_day\":{\"type\":\"long\",\"script\":{\"source\":\"emit(doc['timestamp'].value.getHour());\"}}}","timeFieldName":"timestamp","title":"kibana_sample_data_logs"},"coreMigrationVersion":"8.8.0","created_at":"2023-07-25T19:36:36.695Z","id":"90943e30-9a47-11e8-b64d-95841ca0b247","managed":false,"references":[],"type":"index-pattern","typeMigrationVersion":"8.0.0","updated_at":"2023-07-25T19:36:36.695Z","version":"WzM5LDJd"} + {"excludedObjects":[],"excludedObjectsCount":0,"exportedCount":1,"missingRefCount":0,"missingReferences":[]} + import_objects_response: + summary: The import objects API response indicates a successful import and the objects are created. Since these objects are created as new copies, each entry in the successResults array includes a destinationId attribute. + value: + successCount: 1 + success: true + warnings: [] + successResults: + - type: index-pattern + id: 90943e30-9a47-11e8-b64d-95841ca0b247 + meta: + title: Kibana Sample Data Logs + icon: indexPatternApp + managed: false + destinationId: 82d2760c-468f-49cf-83aa-b9a35b6a8943 diff --git a/packages/core/saved-objects/docs/openapi/components/examples/export_objects_request.yaml b/packages/core/saved-objects/docs/openapi/components/examples/export_objects_request.yaml new file mode 100644 index 0000000000000..065e956d0f6ab --- /dev/null +++ b/packages/core/saved-objects/docs/openapi/components/examples/export_objects_request.yaml @@ -0,0 +1,11 @@ +summary: Export a specific saved object. +value: + { + "objects": [ + { + "type": "index-pattern", + "id": "90943e30-9a47-11e8-b64d-95841ca0b247" + } + ], + "includeReferencesDeep": false + } \ No newline at end of file diff --git a/packages/core/saved-objects/docs/openapi/components/examples/export_objects_response.yaml b/packages/core/saved-objects/docs/openapi/components/examples/export_objects_response.yaml new file mode 100644 index 0000000000000..f6eb12f671b20 --- /dev/null +++ b/packages/core/saved-objects/docs/openapi/components/examples/export_objects_response.yaml @@ -0,0 +1,4 @@ +summary: The export objects API response contains a JSON record for each exported object and an export result details record. +value: | + {"attributes":{"fieldFormatMap":"{\"hour_of_day\":{}}","name":"Kibana Sample Data Logs","runtimeFieldMap":"{\"hour_of_day\":{\"type\":\"long\",\"script\":{\"source\":\"emit(doc['timestamp'].value.getHour());\"}}}","timeFieldName":"timestamp","title":"kibana_sample_data_logs"},"coreMigrationVersion":"8.8.0","created_at":"2023-07-25T19:36:36.695Z","id":"90943e30-9a47-11e8-b64d-95841ca0b247","managed":false,"references":[],"type":"index-pattern","typeMigrationVersion":"8.0.0","updated_at":"2023-07-25T19:36:36.695Z","version":"WzM5LDJd"} + {"excludedObjects":[],"excludedObjectsCount":0,"exportedCount":1,"missingRefCount":0,"missingReferences":[]} \ No newline at end of file diff --git a/packages/core/saved-objects/docs/openapi/components/examples/import_objects_response.yaml b/packages/core/saved-objects/docs/openapi/components/examples/import_objects_response.yaml new file mode 100644 index 0000000000000..a19cf00a9bb97 --- /dev/null +++ b/packages/core/saved-objects/docs/openapi/components/examples/import_objects_response.yaml @@ -0,0 +1,17 @@ +summary: The import objects API response indicates a successful import and the objects are created. Since these objects are created as new copies, each entry in the successResults array includes a destinationId attribute. +value: + { + "successCount":1, + "success":true, + "warnings":[], + "successResults":[ + { + "type":"index-pattern", + "id":"90943e30-9a47-11e8-b64d-95841ca0b247", + "meta":{ + "title":"Kibana Sample Data Logs","icon":"indexPatternApp"}, + "managed":false, + "destinationId":"82d2760c-468f-49cf-83aa-b9a35b6a8943" + } + ] + } \ No newline at end of file diff --git a/packages/core/saved-objects/docs/openapi/components/headers/kbn_xsrf.yaml b/packages/core/saved-objects/docs/openapi/components/headers/kbn_xsrf.yaml new file mode 100644 index 0000000000000..fe0402a43aa03 --- /dev/null +++ b/packages/core/saved-objects/docs/openapi/components/headers/kbn_xsrf.yaml @@ -0,0 +1,6 @@ +schema: + type: string +in: header +name: kbn-xsrf +description: Cross-site request forgery protection +required: true diff --git a/packages/core/saved-objects/docs/openapi/entrypoint.yaml b/packages/core/saved-objects/docs/openapi/entrypoint.yaml new file mode 100644 index 0000000000000..a76f7880822fe --- /dev/null +++ b/packages/core/saved-objects/docs/openapi/entrypoint.yaml @@ -0,0 +1,56 @@ +openapi: 3.1.0 +info: + title: Saved objects + description: OpenAPI schema for saved object endpoints + version: '0.1' + contact: + name: Kibana Core Team + license: + name: Elastic License 2.0 + url: https://www.elastic.co/licensing/elastic-license +tags: + - name: saved objects + description: Manage Kibana saved objects, including dashboards, visualizations, and more. +servers: + - url: 'http://localhost:5601' + description: local +paths: +# Paths in the default space +# '/api/encrypted_saved_objects/_rotate_key': +# $ref: 'paths/api@encrypted_saved_objects@_rotate_key.yaml' +# '/api/saved_objects/_bulk_create': +# $ref: 'paths/api@saved_objects@_bulk_create.yaml' +# '/api/saved_objects/_bulk_delete': +# $ref: 'paths/api@saved_objects@_bulk_delete.yaml' +# '/api/saved_objects/_bulk_get': +# $ref: 'paths/api@saved_objects@_bulk_get.yaml' +# '/api/saved_objects/_bulk_resolve': +# $ref: 'paths/api@saved_objects@_bulk_resolve.yaml' +# '/api/saved_objects/_bulk_update': +# $ref: 'paths/api@saved_objects@_bulk_update.yaml' + '/api/saved_objects/_export': + $ref: 'paths/api@saved_objects@_export.yaml' +# '/api/saved_objects/_find': +# $ref: 'paths/api@saved_objects@_find.yaml' + '/api/saved_objects/_import': + $ref: 'paths/api@saved_objects@_import.yaml' +# '/api/saved_objects/_resolve_import_errors': +# $ref: 'paths/api@saved_objects@_resolve_import_errors.yaml' +# '/api/saved_objects/{type}': +# $ref: 'paths/api@saved_objects@{type}.yaml' +# '/api/saved_objects/{type}/{id}': +# $ref: 'paths/api@saved_objects@{type}@{id}.yaml +# 'api/saved_objects/resolve/{type}/{id}': +# $ref: 'paths/api@saved_objects@resolve@{type}@{id}.yaml' +components: + securitySchemes: + basicAuth: + type: http + scheme: basic + apiKeyAuth: + type: apiKey + in: header + name: ApiKey +security: + - basicAuth: [] + - apiKeyAuth: [] diff --git a/packages/core/saved-objects/docs/openapi/paths/README.md b/packages/core/saved-objects/docs/openapi/paths/README.md new file mode 100644 index 0000000000000..b7818c8474fc8 --- /dev/null +++ b/packages/core/saved-objects/docs/openapi/paths/README.md @@ -0,0 +1,10 @@ +Paths +===== + +Each path definition for which there is a specification exists within this folder. + +These files currently use the following conventions: + +* path separator token (e.g. `@`) is included in the file name +* path parameter (e.g. `{example}`) is included in the file name +* there is one file per path; each file can contain multiple operations diff --git a/packages/core/saved-objects/docs/openapi/paths/api@saved_objects@_export.yaml b/packages/core/saved-objects/docs/openapi/paths/api@saved_objects@_export.yaml new file mode 100644 index 0000000000000..2c3cb60aff742 --- /dev/null +++ b/packages/core/saved-objects/docs/openapi/paths/api@saved_objects@_export.yaml @@ -0,0 +1,63 @@ +post: + summary: Retrieve sets of saved objects that you want to import into Kibana. + operationId: exportSavedObjects + description: > + This functionality is in technical preview and may be changed or removed in a future release. Elastic will apply best effort to fix any issues, but features in technical preview are not subject to the support SLA of official GA features. + NOTE: The `savedObjects.maxImportExportSize` configuration setting limits the number of saved objects which may be exported. + tags: + - saved objects + parameters: + - $ref: '../components/headers/kbn_xsrf.yaml' + requestBody: + required: true + content: + application/json: + schema: + type: object + anyOf: + - required: [type] + - required: [objects] + properties: + excludeExportDetails: + description: Do not add export details entry at the end of the stream. + type: boolean + default: false + includeReferencesDeep: + description: Includes all of the referenced objects in the exported objects. + type: boolean + objects: + description: A list of objects to export. + type: array + items: + type: object + type: + description: The saved object types to include in the export. + oneOf: + - type: string + - type: array + items: + type: string + examples: + exportSavedObjectsRequest: + $ref: '../components/examples/export_objects_request.yaml' + responses: + '200': + description: Indicates a successful call. + content: + multipart/form-data: + schema: + type: string + examples: + exportSavedObjectsResponse: + $ref: '../components/examples/export_objects_response.yaml' + '400': + description: Bad request. + content: + application/json: + schema: + type: object + additionalProperties: true + servers: + - url: https://localhost:5601 +servers: + - url: https://localhost:5601 \ No newline at end of file diff --git a/packages/core/saved-objects/docs/openapi/paths/api@saved_objects@_import.yaml b/packages/core/saved-objects/docs/openapi/paths/api@saved_objects@_import.yaml new file mode 100644 index 0000000000000..a6c21a5d9551b --- /dev/null +++ b/packages/core/saved-objects/docs/openapi/paths/api@saved_objects@_import.yaml @@ -0,0 +1,95 @@ +post: + summary: Create sets of Kibana saved objects from a file created by the export API. + operationId: importSavedObjects + description: > + This functionality is in technical preview and may be changed or removed in a future release. Elastic will apply best effort to fix any issues, but features in technical preview are not subject to the support SLA of official GA features. + Saved objects can be imported only into the same version, a newer minor on the same major, or the next major. + Exported saved objects are not backwards compatible and cannot be imported into an older version of Kibana. + tags: + - saved objects + parameters: + - $ref: '../components/headers/kbn_xsrf.yaml' + - in: query + name: compatibilityMode + schema: + type: boolean + required: false + description: > + Applies various adjustments to the saved objects that are being imported to maintain compatibility between different Kibana versions. + Use this option only if you encounter issues with imported saved objects. + NOTE: This option cannot be used with the `createNewCopies` option. + - in: query + name: createNewCopies + schema: + type: boolean + required: false + description: > + Creates copies of saved objects, regenerates each object ID, and resets the origin. + When used, potential conflict errors are avoided. + NOTE: This option cannot be used with the `overwrite` and `compatibilityMode` options. + - in: query + name: overwrite + schema: + type: boolean + required: false + description: > + Overwrites saved objects when they already exist. + When used, potential conflict errors are automatically resolved by overwriting the destination object. + NOTE: This option cannot be used with the `createNewCopies` option. + requestBody: + required: true + content: + multipart/form-data: + schema: + type: object + description: > + A file exported using the export API. + NOTE: The `savedObjects.maxImportExportSize` configuration setting limits the number of saved objects which may be included in this file. + Similarly, the `savedObjects.maxImportPayloadBytes` setting limits the overall size of the file that can be imported. + responses: + '200': + description: Indicates a successful call. + content: + application/json: + schema: + type: object + properties: + errors: + type: array + description: > + Indicates the import was unsuccessful and specifies the objects that failed to import. + One object may result in multiple errors, which requires separate steps to resolve. + For instance, a `missing_references` error and conflict error. + success: + type: boolean + description: > + Indicates when the import was successfully completed. + When set to false, some objects may not have been created. + For additional information, refer to the `errors` and `successResults` properties. + successCount: + type: integer + description: Indicates the number of successfully imported records. + successResults: + type: array + items: + type: object + description: > + Indicates the objects that are successfully imported, with any metadata if applicable. + Objects are created only when all resolvable errors are addressed, including conflicts and missing references. + If objects are created as new copies, each entry in the `successResults` array includes a `destinationId` attribute. + warnings: + type: array + examples: + importObjectsResponse: + $ref: '../components/examples/import_objects_response.yaml' + '400': + description: Bad request. + content: + application/json: + schema: + type: object + additionalProperties: true + servers: + - url: https://localhost:5601 +servers: + - url: https://localhost:5601 \ No newline at end of file