diff --git a/src/platform/plugins/shared/dashboard/common/constants.ts b/src/platform/plugins/shared/dashboard/common/constants.ts index 934ef199e6b30..e107a40f5fb38 100644 --- a/src/platform/plugins/shared/dashboard/common/constants.ts +++ b/src/platform/plugins/shared/dashboard/common/constants.ts @@ -11,11 +11,12 @@ import { DASHBOARD_GRID_COLUMN_COUNT } from './page_bundle_constants'; /** The base API path for public dashboard endpoints. */ export const DASHBOARD_API_PATH = '/api/dashboards'; -export const DASHBOARD_API_VERSION = '1'; +export const DASHBOARD_API_VERSION = '2023-10-31'; /** The base API path for internal dashboard endpoints. */ export const DASHBOARD_INTERNAL_API_PATH = '/internal/dashboards'; export const DASHBOARD_APP_API_PATH = `${DASHBOARD_INTERNAL_API_PATH}/app`; +export const DASHBOARD_APP_API_VERSION = '1'; export const DASHBOARD_SAVED_OBJECT_TYPE = 'dashboard'; diff --git a/src/platform/plugins/shared/dashboard/public/dashboard_client/dashboard_client.ts b/src/platform/plugins/shared/dashboard/public/dashboard_client/dashboard_client.ts index 9d9786d06bcab..20b641bba5389 100644 --- a/src/platform/plugins/shared/dashboard/public/dashboard_client/dashboard_client.ts +++ b/src/platform/plugins/shared/dashboard/public/dashboard_client/dashboard_client.ts @@ -18,6 +18,7 @@ import { DASHBOARD_API_PATH, DASHBOARD_API_VERSION, DASHBOARD_APP_API_PATH, + DASHBOARD_APP_API_VERSION, DASHBOARD_SAVED_OBJECT_TYPE, } from '../../common/constants'; import type { @@ -53,7 +54,7 @@ export const dashboardClient = { accessMode?: SavedObjectAccessControl['accessMode'] ) => { return coreServices.http.post(DASHBOARD_APP_API_PATH, { - version: DASHBOARD_API_VERSION, + version: DASHBOARD_APP_API_VERSION, body: JSON.stringify({ ...dashboardState, ...(accessMode && { access_control: { access_mode: accessMode } }), @@ -73,7 +74,7 @@ export const dashboardClient = { const { body, response } = await coreServices.http .get(buildDashboardAppPath(id), { - version: DASHBOARD_API_VERSION, + version: DASHBOARD_APP_API_VERSION, asResponse: true, }) .catch((e) => { @@ -116,7 +117,7 @@ export const dashboardClient = { const updateResponse = await coreServices.http.put( buildDashboardAppPath(id), { - version: DASHBOARD_API_VERSION, + version: DASHBOARD_APP_API_VERSION, body: JSON.stringify(dashboardState), } ); diff --git a/src/platform/plugins/shared/dashboard/public/share/export_json_share_utils.ts b/src/platform/plugins/shared/dashboard/public/share/export_json_share_utils.ts index 395b37880ceb8..b7a70eb12d936 100644 --- a/src/platform/plugins/shared/dashboard/public/share/export_json_share_utils.ts +++ b/src/platform/plugins/shared/dashboard/public/share/export_json_share_utils.ts @@ -7,7 +7,7 @@ * License v3.0 only", or the "Server Side Public License, v 1". */ -import { DASHBOARD_API_PATH, DASHBOARD_API_VERSION } from '../../common/constants'; +import { DASHBOARD_API_PATH } from '../../common/constants'; const DEFAULT_FILENAME_BASE = 'export'; @@ -41,11 +41,5 @@ export function buildExportJsonFilename(filenameBase: string, fileExtension: str * The console will open with the HTTP verb + kbn: path, followed by a JSON body. */ export function buildCreateDashboardRequestForConsole(jsonBody: string): string { - // TODO remove these conditionals once the dashboard endpoints are public - // adds the `apiVersion` query parameter to the dashboard API path for internal requests - const dashboardApiPath = - DASHBOARD_API_VERSION === '1' - ? `${DASHBOARD_API_PATH}?apiVersion=${DASHBOARD_API_VERSION}` - : DASHBOARD_API_PATH; - return `POST kbn:${dashboardApiPath}\n${jsonBody}`; + return `POST kbn:${DASHBOARD_API_PATH}\n${jsonBody}`; } diff --git a/src/platform/plugins/shared/dashboard/server/api/get_route_config.ts b/src/platform/plugins/shared/dashboard/server/api/get_route_config.ts index e4fac24f5e9b1..fbac39fd877c6 100644 --- a/src/platform/plugins/shared/dashboard/server/api/get_route_config.ts +++ b/src/platform/plugins/shared/dashboard/server/api/get_route_config.ts @@ -7,7 +7,12 @@ * License v3.0 only", or the "Server Side Public License, v 1". */ -import { DASHBOARD_API_PATH, DASHBOARD_APP_API_PATH } from '../../common/constants'; +import { + DASHBOARD_API_PATH, + DASHBOARD_API_VERSION, + DASHBOARD_APP_API_PATH, + DASHBOARD_APP_API_VERSION, +} from '../../common/constants'; export function getRouteConfig(isDashboardAppRequest: boolean) { return isDashboardAppRequest @@ -27,26 +32,19 @@ export function getRouteConfig(isDashboardAppRequest: boolean) { }, }, } as const, - routeVersion: '1', + routeVersion: DASHBOARD_APP_API_VERSION, } : { basePath: DASHBOARD_API_PATH, routeConfig: { - // TODO change to public before FF - access: 'internal', - /** - * `enableQueryVersion` is a temporary solution for testing internal endpoints. - * Requests to these internal endpoints from Kibana Dev Tools or external clients - * should include the ?apiVersion=1 query parameter. - * This will be removed when the API is finalized and moved to a stable version. - */ - enableQueryVersion: true, + access: 'public', description: 'This functionality is in technical preview and may be changed or removed in a future release. Elastic will work to fix any issues, but features in technical preview are not subject to the support SLA of official GA features.', options: { tags: ['oas-tag:Dashboards'], availability: { stability: 'experimental', + since: '9.4.0', }, }, security: { @@ -56,7 +54,6 @@ export function getRouteConfig(isDashboardAppRequest: boolean) { }, }, } as const, - // TODO change to '2023-10-31' before FF - routeVersion: '1', + routeVersion: DASHBOARD_API_VERSION, }; } diff --git a/src/platform/plugins/shared/dashboard/test/scout/api/fixtures/constants.ts b/src/platform/plugins/shared/dashboard/test/scout/api/fixtures/constants.ts index 249c00ac022b0..5c9cea1c54932 100644 --- a/src/platform/plugins/shared/dashboard/test/scout/api/fixtures/constants.ts +++ b/src/platform/plugins/shared/dashboard/test/scout/api/fixtures/constants.ts @@ -9,12 +9,13 @@ /** The base API path for dashboard endpoints (no leading slash for apiClient). */ export const DASHBOARD_API_PATH = 'api/dashboards'; +export const DASHBOARD_API_VERSION = '2023-10-31'; /** Common headers for Dashboard API requests (internal API version 1) */ export const COMMON_HEADERS = { 'kbn-xsrf': 'some-xsrf-token', 'x-elastic-internal-origin': 'kibana', - 'elastic-api-version': '1', + 'elastic-api-version': DASHBOARD_API_VERSION, } as const; /** Test data paths */ diff --git a/x-pack/platform/plugins/shared/lens/common/constants.ts b/x-pack/platform/plugins/shared/lens/common/constants.ts index df36b0c5151cb..0c96416bc8804 100644 --- a/x-pack/platform/plugins/shared/lens/common/constants.ts +++ b/x-pack/platform/plugins/shared/lens/common/constants.ts @@ -23,8 +23,8 @@ export const LENS_EDIT_BY_VALUE = 'edit_by_value'; export const LENS_ICON = 'lensApp'; export const STAGE_ID = 'production'; -export const LENS_API_VERSION = '1'; // TODO repalce with '2023-10-31' before 9.4 FF -export const LENS_API_ACCESS: RouteAccess = 'internal'; // TODO replace with 'public' before 9.4 FF +export const LENS_API_VERSION = '2023-10-31'; +export const LENS_API_ACCESS: RouteAccess = 'public'; export const LENS_INTERNAL_API_VERSION = '1'; /** * In the OpenAPISpec this represents the endpoint group name diff --git a/x-pack/platform/plugins/shared/lens/server/api/routes/visualizations/create.ts b/x-pack/platform/plugins/shared/lens/server/api/routes/visualizations/create.ts index 7ba63af6689e7..a804c436ae05f 100644 --- a/x-pack/platform/plugins/shared/lens/server/api/routes/visualizations/create.ts +++ b/x-pack/platform/plugins/shared/lens/server/api/routes/visualizations/create.ts @@ -33,7 +33,6 @@ export const registerLensVisualizationsCreateAPIRoute: RegisterAPIRouteFn = ( const createRoute = router.post({ path: LENS_VIS_API_PATH, access: LENS_API_ACCESS, - enableQueryVersion: true, summary: 'Create visualization', description: 'Create a new visualization.', options: { diff --git a/x-pack/platform/plugins/shared/lens/server/api/routes/visualizations/delete.ts b/x-pack/platform/plugins/shared/lens/server/api/routes/visualizations/delete.ts index c3a0e9da76563..0d726ef424576 100644 --- a/x-pack/platform/plugins/shared/lens/server/api/routes/visualizations/delete.ts +++ b/x-pack/platform/plugins/shared/lens/server/api/routes/visualizations/delete.ts @@ -23,8 +23,7 @@ export const registerLensVisualizationsDeleteAPIRoute: RegisterAPIRouteFn = ( ) => { const deleteRoute = router.delete({ path: `${LENS_VIS_API_PATH}/{id}`, - access: LENS_API_ACCESS, // to go public in 9.4 - enableQueryVersion: true, + access: LENS_API_ACCESS, summary: 'Delete visualization', description: 'Delete a visualization by id.', options: { diff --git a/x-pack/platform/plugins/shared/lens/server/api/routes/visualizations/get.ts b/x-pack/platform/plugins/shared/lens/server/api/routes/visualizations/get.ts index d4ee1b0ce348d..af419606aef4c 100644 --- a/x-pack/platform/plugins/shared/lens/server/api/routes/visualizations/get.ts +++ b/x-pack/platform/plugins/shared/lens/server/api/routes/visualizations/get.ts @@ -28,7 +28,6 @@ export const registerLensVisualizationsGetAPIRoute: RegisterAPIRouteFn = ( const getRoute = router.get({ path: `${LENS_VIS_API_PATH}/{id}`, access: LENS_API_ACCESS, - enableQueryVersion: true, summary: 'Get visualization', description: 'Get a visualization from id.', options: { diff --git a/x-pack/platform/plugins/shared/lens/server/api/routes/visualizations/search.ts b/x-pack/platform/plugins/shared/lens/server/api/routes/visualizations/search.ts index 0a67a6cc7244f..d886e8b894943 100644 --- a/x-pack/platform/plugins/shared/lens/server/api/routes/visualizations/search.ts +++ b/x-pack/platform/plugins/shared/lens/server/api/routes/visualizations/search.ts @@ -27,7 +27,6 @@ export const registerLensVisualizationsSearchAPIRoute: RegisterAPIRouteFn = ( const searchRoute = router.get({ path: LENS_VIS_API_PATH, access: LENS_API_ACCESS, - enableQueryVersion: true, summary: 'Search visualizations', description: 'Get list of visualizations.', options: { diff --git a/x-pack/platform/plugins/shared/lens/server/api/routes/visualizations/update.ts b/x-pack/platform/plugins/shared/lens/server/api/routes/visualizations/update.ts index 70a4ac585514f..269a1028b3f61 100644 --- a/x-pack/platform/plugins/shared/lens/server/api/routes/visualizations/update.ts +++ b/x-pack/platform/plugins/shared/lens/server/api/routes/visualizations/update.ts @@ -37,7 +37,6 @@ export const registerLensVisualizationsUpdateAPIRoute: RegisterAPIRouteFn = ( const updateRoute = router.put({ path: `${LENS_VIS_API_PATH}/{id}`, access: LENS_API_ACCESS, - enableQueryVersion: true, summary: 'Create or update visualization', description: 'Create or update a visualization with the given id. When no visualization exists for the id, one is created.', diff --git a/x-pack/platform/test/api_integration/apis/content_management/created_by.ts b/x-pack/platform/test/api_integration/apis/content_management/created_by.ts index be33b7d0fc956..778544d0986f1 100644 --- a/x-pack/platform/test/api_integration/apis/content_management/created_by.ts +++ b/x-pack/platform/test/api_integration/apis/content_management/created_by.ts @@ -19,7 +19,7 @@ export default function ({ getService }: FtrProviderContext) { const { body, status } = await supertest .post(DASHBOARD_API_PATH) .set('kbn-xsrf', 'true') - .set('elastic-api-version', '1') + .set('elastic-api-version', '2023-10-31') .send({ title: 'Sample dashboard', }); @@ -48,7 +48,7 @@ export default function ({ getService }: FtrProviderContext) { .post(DASHBOARD_API_PATH) .set(interactiveUser.headers) .set('kbn-xsrf', 'true') - .set('elastic-api-version', '1') + .set('elastic-api-version', '2023-10-31') .send({ title: 'Sample dashboard', }); diff --git a/x-pack/platform/test/api_integration/apis/content_management/updated_by.ts b/x-pack/platform/test/api_integration/apis/content_management/updated_by.ts index 0bf5eaf101f93..7a72c7d5717cb 100644 --- a/x-pack/platform/test/api_integration/apis/content_management/updated_by.ts +++ b/x-pack/platform/test/api_integration/apis/content_management/updated_by.ts @@ -19,7 +19,7 @@ export default function ({ getService }: FtrProviderContext) { const createResponse = await supertest .post(DASHBOARD_API_PATH) .set('kbn-xsrf', 'true') - .set('elastic-api-version', '1') + .set('elastic-api-version', '2023-10-31') .send({ title: 'Sample dashboard', }); @@ -31,7 +31,7 @@ export default function ({ getService }: FtrProviderContext) { const updateResponse = await supertest .put(`${DASHBOARD_API_PATH}/${createResponse.body.id}`) .set('kbn-xsrf', 'true') - .set('elastic-api-version', '1') + .set('elastic-api-version', '2023-10-31') .send({ title: 'updated title', }); @@ -58,7 +58,7 @@ export default function ({ getService }: FtrProviderContext) { .post(DASHBOARD_API_PATH) .set(interactiveUser.headers) .set('kbn-xsrf', 'true') - .set('elastic-api-version', '1') + .set('elastic-api-version', '2023-10-31') .send({ title: 'Sample dashboard', }); @@ -79,7 +79,7 @@ export default function ({ getService }: FtrProviderContext) { const updateResponse = await supertestWithAuth .put(`${DASHBOARD_API_PATH}/${createResponse.body.id}`) .set('kbn-xsrf', 'true') - .set('elastic-api-version', '1') + .set('elastic-api-version', '2023-10-31') .send({ title: 'updated title', }); @@ -89,7 +89,7 @@ export default function ({ getService }: FtrProviderContext) { const getResponse = await supertestWithAuth .get(`${DASHBOARD_API_PATH}/${createResponse.body.id}`) .set('kbn-xsrf', 'true') - .set('elastic-api-version', '1') + .set('elastic-api-version', '2023-10-31') .send(); expect(getResponse.status).to.be(200); @@ -114,7 +114,7 @@ export default function ({ getService }: FtrProviderContext) { .put(`${DASHBOARD_API_PATH}/${createResponse.body.id}`) .set(interactiveUser2.headers) .set('kbn-xsrf', 'true') - .set('elastic-api-version', '1') + .set('elastic-api-version', '2023-10-31') .send({ title: 'updated title', }); @@ -124,7 +124,7 @@ export default function ({ getService }: FtrProviderContext) { const getResponse = await supertestWithAuth .get(`${DASHBOARD_API_PATH}/${createResponse.body.id}`) .set('kbn-xsrf', 'true') - .set('elastic-api-version', '1') + .set('elastic-api-version', '2023-10-31') .send(); expect(getResponse.status).to.be(200); diff --git a/x-pack/platform/test/api_integration/apis/spaces/get_content_summary.ts b/x-pack/platform/test/api_integration/apis/spaces/get_content_summary.ts index 6350125be5c53..f9b053b190767 100644 --- a/x-pack/platform/test/api_integration/apis/spaces/get_content_summary.ts +++ b/x-pack/platform/test/api_integration/apis/spaces/get_content_summary.ts @@ -61,7 +61,7 @@ export default function ({ getService }: FtrProviderContext) { .post(`/s/${ATestSpace}${DASHBOARD_API_PATH}`) .set('kbn-xsrf', 'xxx') .set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana') - .set('elastic-api-version', '1') + .set('elastic-api-version', '2023-10-31') .send({ title: 'Sample dashboard', }); @@ -70,7 +70,7 @@ export default function ({ getService }: FtrProviderContext) { .post(`/s/${ATestSpace}${DASHBOARD_API_PATH}`) .set('kbn-xsrf', 'xxx') .set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana') - .set('elastic-api-version', '1') + .set('elastic-api-version', '2023-10-31') .send({ title: 'Sample dashboard', }); @@ -99,7 +99,7 @@ export default function ({ getService }: FtrProviderContext) { .post(`/s/${BTestSpace}${DASHBOARD_API_PATH}`) .set('kbn-xsrf', 'xxx') .set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana') - .set('elastic-api-version', '1') + .set('elastic-api-version', '2023-10-31') .send({ title: 'Sample dashboard', }); diff --git a/x-pack/solutions/observability/plugins/slo/test/scout/api/fixtures/constants.ts b/x-pack/solutions/observability/plugins/slo/test/scout/api/fixtures/constants.ts index 6de8635b3a7cc..94f33c97a053e 100644 --- a/x-pack/solutions/observability/plugins/slo/test/scout/api/fixtures/constants.ts +++ b/x-pack/solutions/observability/plugins/slo/test/scout/api/fixtures/constants.ts @@ -17,9 +17,9 @@ export const SLO_ERROR_BUDGET_ID = 'slo_error_budget'; export const SLO_BURN_RATE_EMBEDDABLE_ID = 'slo_burn_rate'; export const SLO_ALERTS_EMBEDDABLE_ID = 'slo_alerts'; -/** Common headers for Dashboard API requests (internal API version 1) */ +/** Common headers for Dashboard API requests */ export const COMMON_HEADERS = { 'kbn-xsrf': 'some-xsrf-token', 'x-elastic-internal-origin': 'kibana', - 'elastic-api-version': '1', + 'elastic-api-version': '2023-10-31', } as const;