diff --git a/changelogs/fragments/6859.yml b/changelogs/fragments/6859.yml new file mode 100644 index 000000000000..499f2ccc80ff --- /dev/null +++ b/changelogs/fragments/6859.yml @@ -0,0 +1,2 @@ +doc: +- Add OpenAPI specification for bulk create and bulk update saved object APIs ([#6859](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/6859)) \ No newline at end of file diff --git a/docs/openapi/saved_objects/saved_objects.yml b/docs/openapi/saved_objects/saved_objects.yml index de5634890719..443d37ada9b4 100644 --- a/docs/openapi/saved_objects/saved_objects.yml +++ b/docs/openapi/saved_objects/saved_objects.yml @@ -206,6 +206,155 @@ paths: application/json: schema: $ref: '#/components/schemas/400_bad_request' + /api/saved_objects/_bulk_create: + post: + tags: + - saved objects + summary: Bulk create saved objects + parameters: + - name: overwrite + in: query + schema: + type: boolean + description: If set to true, will overwrite the existing saved object with same type and id. + - name: workspaces + in: query + schema: + type: array + items: + type: string + description: Workspaces that the saved objects exist in. + requestBody: + required: true + description: Array of saved objects to create + content: + application/json: + schema: + type: array + items: + type: object + properties: + id: + type: string + description: Unique id of the saved object. + type: + type: string + required: true + description: The type of saved object. + attributes: + type: object + required: true + description: The metadata of the saved object to be created, and the object is not validated. + version: + type: string + migrationVersion: + type: object + description: The information about the migrations that have been applied to this saved object to be created. + references: + description: List of objects that describe other saved objects the created object references. + type: array + items: + type: object + properties: + id: + type: string + type: + type: string + name: + type: string + initialNamespaces: + description: Namespaces that this saved object exists in. This attribute is only used for multi-namespace saved object types. + type: array + items: + type: string + example: + - id: 67a9021c-c97e-4499-8150-9722ab44edd4 + type: visualization + attributes: + title: 'vega-visualization' + fieldFormatMap: '{"hour_of_day":{}}' + fields: '[{"name":"@timestamp","type":"date","esTypes":["date"],"count":0,"scripted":false,"searchable":true,"aggregatable":true,"readFromDocValues":true}]' + version: '1' + migrationVersion: {} + references: + - id: ef71d6c1-8e6b-418d-9f7c-e5d9bbde9cf7 + type: data-source + name: dataSource + initialNamespaces: + - default + responses: + '200': + description: The bulk creation request is successful. + content: + application/json: + schema: + type: object + /api/saved_objects/_bulk_update: + post: + tags: + - saved objects + summary: Bulk update saved objects + requestBody: + required: true + description: Array of saved objects to update + content: + application/json: + schema: + type: array + items: + type: object + properties: + id: + type: string + description: Unique id of the saved object. + type: + type: string + required: true + description: The type of saved object. + attributes: + type: object + required: true + description: The metadata of the saved object to be created, and the object is not validated. + version: + type: string + references: + description: List of objects that describe other saved objects the created object references. + type: array + items: + type: object + properties: + id: + type: string + type: + type: string + name: + type: string + namespaces: + description: Namespaces that this saved object exists in. This attribute is only used for multi-namespace saved object types. + type: array + items: + type: string + example: + - id: 67a9021c-c97e-4499-8150-9722ab44edd4 + type: visualization + attributes: + title: vega-visualization + fieldFormatMap: '{"hour_of_day":{}}' + fields: '[{"name":"@timestamp","type":"date","esTypes":["date"],"count":0,"scripted":false,"searchable":true,"aggregatable":true,"readFromDocValues":true}]' + version: '1' + migrationVersion: {} + references: + - id: ef71d6c1-8e6b-418d-9f7c-e5d9bbde9cf7 + type: data-source + name: dataSource + namespace: default + responses: + '200': + description: The bulk update request is successful. + content: + application/json: + schema: + type: object components: parameters: type: