-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Spaces] - Experimental Public spaces api (#22501)
[skip ci]
- Loading branch information
Showing
33 changed files
with
1,246 additions
and
498 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
[[spaces-api-delete]] | ||
=== Delete space | ||
|
||
experimental[This API is *experimental* and may be changed or removed completely in a future release. The underlying Spaces concepts are stable, but the APIs for managing Spaces are currently experimental.] | ||
|
||
[WARNING] | ||
================================================== | ||
Deleting a space will automatically delete all saved objects that belong to that space. This operation cannot be undone! | ||
================================================== | ||
|
||
==== Request | ||
|
||
To delete a space, submit a DELETE request to the `/api/spaces/space/<space_id>` | ||
endpoint: | ||
|
||
[source,js] | ||
-------------------------------------------------- | ||
DELETE /api/spaces/space/marketing | ||
-------------------------------------------------- | ||
// KIBANA | ||
|
||
==== Response | ||
|
||
If the space is successfully deleted, the response code is `204`; otherwise, the response | ||
code is 404. |
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,77 @@ | ||
[[spaces-api-get]] | ||
=== Get Space | ||
|
||
experimental[This API is *experimental* and may be changed or removed completely in a future release. The underlying Spaces concepts are stable, but the APIs for managing Spaces are currently experimental.] | ||
|
||
Retrieves all {kib} spaces, or a specific space. | ||
|
||
==== Get all {kib} spaces | ||
|
||
===== Request | ||
|
||
To retrieve all spaces, issue a GET request to the | ||
/api/spaces/space endpoint. | ||
|
||
[source,js] | ||
-------------------------------------------------- | ||
GET /api/spaces/space | ||
-------------------------------------------------- | ||
// KIBANA | ||
|
||
===== Response | ||
|
||
A successful call returns a response code of `200` and a response body containing a JSON | ||
representation of the spaces. | ||
|
||
[source,js] | ||
-------------------------------------------------- | ||
[ | ||
{ | ||
"id": "default", | ||
"name": "Default", | ||
"description" : "This is the Default Space", | ||
"_reserved": true | ||
}, | ||
{ | ||
"id": "marketing", | ||
"name": "Marketing", | ||
"description" : "This is the Marketing Space", | ||
"color": "#aabbcc", | ||
"initials": "MK" | ||
}, | ||
{ | ||
"id": "sales", | ||
"name": "Sales", | ||
"initials": "MK" | ||
}, | ||
] | ||
-------------------------------------------------- | ||
|
||
==== Get a specific space | ||
|
||
===== Request | ||
|
||
To retrieve a specific space, issue a GET request to | ||
the `/api/spaces/space/<space_id>` endpoint: | ||
|
||
[source,js] | ||
-------------------------------------------------- | ||
GET /api/spaces/space/marketing | ||
-------------------------------------------------- | ||
// KIBANA | ||
|
||
===== Response | ||
|
||
A successful call returns a response code of `200` and a response body containing a JSON | ||
representation of the space. | ||
|
||
[source,js] | ||
-------------------------------------------------- | ||
{ | ||
"id": "marketing", | ||
"name": "Marketing", | ||
"description" : "This is the Marketing Space", | ||
"color": "#aabbcc", | ||
"initials": "MK" | ||
} | ||
-------------------------------------------------- |
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,50 @@ | ||
[[spaces-api-post]] | ||
=== Create Space | ||
|
||
experimental[This API is *experimental* and may be changed or removed completely in a future release. The underlying Spaces concepts are stable, but the APIs for managing Spaces are currently experimental.] | ||
|
||
Creates a new {kib} space. To update an existing space, use the PUT command. | ||
|
||
==== Request | ||
|
||
To create a space, issue a POST request to the | ||
`/api/spaces/space` endpoint. | ||
|
||
[source,js] | ||
-------------------------------------------------- | ||
PUT /api/spaces/space | ||
-------------------------------------------------- | ||
|
||
==== Request Body | ||
|
||
The following parameters can be specified in the body of a POST request to create a space: | ||
|
||
`id`:: (string) Required identifier for the space. This identifier becomes part of Kibana's URL when inside the space. This cannot be changed by the update operation. | ||
|
||
`name`:: (string) Required display name for the space. | ||
|
||
`description`:: (string) Optional description for the space. | ||
|
||
`initials`:: (string) Optionally specify the initials shown in the Space Avatar for this space. By default, the initials will be automatically generated from the space name. | ||
If specified, initials should be either 1 or 2 characters. | ||
|
||
`color`:: (string) Optioanlly specify the hex color code used in the Space Avatar for this space. By default, the color will be automatically generated from the space name. | ||
|
||
===== Example | ||
|
||
[source,js] | ||
-------------------------------------------------- | ||
POST /api/spaces/space | ||
{ | ||
"id": "marketing", | ||
"name": "Marketing", | ||
"description" : "This is the Marketing Space", | ||
"color": "#aabbcc", | ||
"initials": "MK" | ||
} | ||
-------------------------------------------------- | ||
// KIBANA | ||
|
||
==== Response | ||
|
||
A successful call returns a response code of `200` with the created Space. |
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,50 @@ | ||
[[spaces-api-put]] | ||
=== Update Space | ||
|
||
experimental[This API is *experimental* and may be changed or removed completely in a future release. The underlying Spaces concepts are stable, but the APIs for managing Spaces are currently experimental.] | ||
|
||
Updates an existing {kib} space. To create a new space, use the POST command. | ||
|
||
==== Request | ||
|
||
To update a space, issue a PUT request to the | ||
`/api/spaces/space/<space_id>` endpoint. | ||
|
||
[source,js] | ||
-------------------------------------------------- | ||
PUT /api/spaces/space/<space_id> | ||
-------------------------------------------------- | ||
|
||
==== Request Body | ||
|
||
The following parameters can be specified in the body of a PUT request to update a space: | ||
|
||
`id`:: (string) Required identifier for the space. This identifier becomes part of Kibana's URL when inside the space. This cannot be changed by the update operation. | ||
|
||
`name`:: (string) Required display name for the space. | ||
|
||
`description`:: (string) Optional description for the space. | ||
|
||
`initials`:: (string) Optionally specify the initials shown in the Space Avatar for this space. By default, the initials will be automatically generated from the space name. | ||
If specified, initials should be either 1 or 2 characters. | ||
|
||
`color`:: (string) Optioanlly specify the hex color code used in the Space Avatar for this space. By default, the color will be automatically generated from the space name. | ||
|
||
===== Example | ||
|
||
[source,js] | ||
-------------------------------------------------- | ||
PUT /api/spaces/space/marketing | ||
{ | ||
"id": "marketing", | ||
"name": "Marketing", | ||
"description" : "This is the Marketing Space", | ||
"color": "#aabbcc", | ||
"initials": "MK" | ||
} | ||
-------------------------------------------------- | ||
// KIBANA | ||
|
||
==== Response | ||
|
||
A successful call returns a response code of `200` with the updated Space. |
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,17 @@ | ||
[role="xpack"] | ||
[[spaces-api]] | ||
== Kibana Spaces API | ||
|
||
experimental[This API is *experimental* and may be changed or removed completely in a future release. The underlying Spaces concepts are stable, but the APIs for managing Spaces are currently experimental.] | ||
|
||
The spaces API allows people to manage their spaces within {kib}. | ||
|
||
* <<spaces-api-put>> | ||
* <<spaces-api-post>> | ||
* <<spaces-api-get>> | ||
* <<spaces-api-delete>> | ||
|
||
include::spaces-management/put.asciidoc[] | ||
include::spaces-management/post.asciidoc[] | ||
include::spaces-management/get.asciidoc[] | ||
include::spaces-management/delete.asciidoc[] |
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
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
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
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
29 changes: 29 additions & 0 deletions
29
x-pack/plugins/spaces/server/routes/api/__fixtures__/create_spaces.ts
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,29 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
export function createSpaces() { | ||
return [ | ||
{ | ||
id: 'a-space', | ||
attributes: { | ||
name: 'a space', | ||
}, | ||
}, | ||
{ | ||
id: 'b-space', | ||
attributes: { | ||
name: 'b space', | ||
}, | ||
}, | ||
{ | ||
id: 'default', | ||
attributes: { | ||
name: 'Default Space', | ||
_reserved: true, | ||
}, | ||
}, | ||
]; | ||
} |
Oops, something went wrong.