* Add new references attribute to saved objects * Add dual support for dashboard export API * Use new relationships API supporting legacy relationships extraction * Code cleanup * Fix style and CI error * Add missing spaces test for findRelationships * Convert collect_references_deep to typescript * Add missing trailing commas * Fix broken test by making saved object API consistently return references * Fix broken api integration tests * Add comment about the two TS types for saved object * Only return title from the attributes returned in findRelationships * Fix broken test * Add missing security tests * Drop filterTypes support * Implement references to search, dashboard, visualization, graph * Add index pattern migration to dashboards * Add references mapping to dashboard mppings.json * Remove findRelationships from repository and into it's own function / file * Apply PR feedback pt1 * Fix some failing tests * Remove error throwing in migrations * Add references to edit saved object screen * Pass types to findRelationships * [ftr] restore snapshots from master, rely on migrations to add references * [security] remove `find_relationships` action * remove data set modifications * [security/savedObjectsClient] remove _getAuthorizedTypes method * fix security & spaces tests to consider references and migrationVersion * Add space id prefixes to es_archiver/saved_objects/spaces/data.json * Rename referenced attributes to have a suffix of RefName * Fix length check in scenario references doesn't exist * Add test for inject references to not be called when references array is empty or missing * some code cleanup * Make migrations run on machine learning data files, fix rollup filterPath for savedSearchRefName * fix broken test * Fix collector.js to include references in elasticsearch response * code cleanup pt2 * add some more tests * fix broken tests * updated documentation on referencedBy option for saved object client find function * Move visualization migrations into kibana plugin * Update docs with better description on references * Apply PR feedback * Fix merge * fix tests I broke adressing PR feedback * PR feedback pt2
77 lines
2.2 KiB
Text
77 lines
2.2 KiB
Text
[[saved-objects-api-create]]
|
|
=== Create Object
|
|
|
|
experimental[This functionality is *experimental* and may be changed or removed completely in a future release.]
|
|
|
|
The create saved object API enables you to persist a Kibana saved object.
|
|
|
|
Note: You cannot access this endpoint via the Console in Kibana.
|
|
|
|
==== Request
|
|
|
|
`POST /api/saved_objects/<type>` +
|
|
|
|
`POST /api/saved_objects/<type>/<id>`
|
|
|
|
==== Path Parameters
|
|
|
|
`type` (required)::
|
|
(string) Valid options, include: `visualization`, `dashboard`, `search`, `index-pattern`, `config`, and `timelion-sheet`
|
|
|
|
`id` (optional)::
|
|
(string) Enables specifying an ID to use, as opposed to one being randomly generated
|
|
|
|
|
|
==== Query Parameters
|
|
|
|
`overwrite` (optional)::
|
|
(boolean) If true, will overwrite the document with the same ID.
|
|
|
|
|
|
==== Request Body
|
|
|
|
`attributes` (required)::
|
|
(object) The data to persist
|
|
|
|
`references` (optional)::
|
|
(array) An array of objects with `name`, `id`, and `type` properties that describe the other saved objects this object references. The `name` can be used in the attributes to refer to the other saved object, but never the `id`, which may be updated automatically in the future during migrations or import/export.
|
|
|
|
==== Examples
|
|
|
|
The following example creates an index pattern object with a pattern of
|
|
`my-pattern-*`.
|
|
|
|
[source,js]
|
|
--------------------------------------------------
|
|
POST api/saved_objects/index-pattern/my-pattern
|
|
{
|
|
"attributes": {
|
|
"title": "my-pattern-*"
|
|
}
|
|
}
|
|
--------------------------------------------------
|
|
// KIBANA
|
|
|
|
A successful call returns a response code of `200` and a response body
|
|
containing a JSON structure similar to the following example:
|
|
|
|
[source,js]
|
|
--------------------------------------------------
|
|
{
|
|
"id": "my-pattern", <1>
|
|
"type": "index-pattern",
|
|
"version": 1,
|
|
"attributes": {
|
|
"title": "my-pattern-*"
|
|
}
|
|
}
|
|
--------------------------------------------------
|
|
|
|
<1> If `my-pattern` was not specified in the path, a unique ID would have been
|
|
generated.
|
|
|
|
==== Known issues
|
|
|
|
1. *Attributes are not validated at creation time*. This means you can pass
|
|
arbitrary and ill-formed data into this API that can break Kibana. Make sure
|
|
any data you send to this API is properly formed.
|