diff --git a/packages/noco-docs/content/en/developer-resources/rest-apis.md b/packages/noco-docs/content/en/developer-resources/rest-apis.md index 22cd7fe419..72bdeb470c 100644 --- a/packages/noco-docs/content/en/developer-resources/rest-apis.md +++ b/packages/noco-docs/content/en/developer-resources/rest-apis.md @@ -166,7 +166,8 @@ Currently, the default value for {orgs} is noco. Users will be able to ch | Meta | Delete| utils | cacheDelete | /api/v1/db/meta/cache | | Meta | Post | utils | testConnection | /api/v1/db/meta/projects/connection/test | | Meta | Get | utils | appInfo | /api/v1/db/meta/nocodb/info | -| Meta | Get | utils | appVersion | /api/v1/db/meta/nocodb/version | +| Meta | Get | utils | appVersion | /api/v1/version | +| Meta | Get | utils | appHealth | /api/v1/health | ## Query params diff --git a/packages/nocodb-sdk/src/lib/Api.ts b/packages/nocodb-sdk/src/lib/Api.ts index b9ab9d3e20..950123a8ad 100644 --- a/packages/nocodb-sdk/src/lib/Api.ts +++ b/packages/nocodb-sdk/src/lib/Api.ts @@ -3197,12 +3197,28 @@ export class Api< * * @tags Utils * @name AppVersion - * @request GET:/api/v1/db/meta/nocodb/version + * @request GET:/api/v1/version * @response `200` `any` OK */ appVersion: (params: RequestParams = {}) => this.request({ - path: `/api/v1/db/meta/nocodb/version`, + path: `/api/v1/version`, + method: 'GET', + format: 'json', + ...params, + }), + + /** + * No description + * + * @tags Utils + * @name AppHealth + * @request GET:/api/v1/health + * @response `200` `any` OK + */ + appHealth: (params: RequestParams = {}) => + this.request({ + path: `/api/v1/health`, method: 'GET', format: 'json', ...params, diff --git a/packages/nocodb/src/lib/meta/api/utilApis.ts b/packages/nocodb/src/lib/meta/api/utilApis.ts index 89ebef8cb6..ff04fb9d24 100644 --- a/packages/nocodb/src/lib/meta/api/utilApis.ts +++ b/packages/nocodb/src/lib/meta/api/utilApis.ts @@ -60,6 +60,14 @@ export async function releaseVersion(_req: Request, res: Response) { res.json(result); } +export async function appHealth(_: Request, res: Response) { + res.json({ + message: 'OK', + timestamp: Date.now(), + uptime: process.uptime() + }); +} + async function _axiosRequestMake(req: Request, res: Response) { const { apiMeta } = req.body; @@ -132,6 +140,7 @@ export default router => { ncMetaAclMw(testConnection, 'testConnection') ); router.get('/api/v1/db/meta/nocodb/info', catchError(appInfo)); - router.get('/api/v1/db/meta/nocodb/version', catchError(releaseVersion)); router.post('/api/v1/db/meta/axiosRequestMake', catchError(axiosRequestMake)); + router.get('/api/v1/version', catchError(releaseVersion)); + router.get('/api/v1/health', catchError(appHealth)); }; diff --git a/scripts/sdk/swagger.json b/scripts/sdk/swagger.json index 670b1a57b3..2f68462f6d 100644 --- a/scripts/sdk/swagger.json +++ b/scripts/sdk/swagger.json @@ -5107,7 +5107,7 @@ ] } }, - "/api/v1/db/meta/nocodb/version": { + "/api/v1/version": { "parameters": [], "get": { "summary": "", @@ -5128,6 +5128,27 @@ "description": "" } }, + "/api/v1/health": { + "parameters": [], + "get": { + "summary": "", + "operationId": "utils-app-health", + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": {} + } + } + } + }, + "tags": [ + "Utils" + ], + "description": "" + } + }, "/api/v1/db/meta/cache": { "get": { "summary": "Your GET endpoint",