Added REST routes
MODIFY
src/assets/server/rest/v1/docs/e-mobility-oas.json
src/assets/server/rest/v1/docs/e-mobility-oas.json
{
"openapi": "3.0.3",
"servers": [
+ {
+ "description": "Localhost - Development",
+ "url": "http://localhost:8080/v1"
+ },
{
"description": "SCP - Production system",
"url": "https://sap-ev-rest-server-prod.cfapps.eu10.hana.ondemand.com/v1"
{
"description": "SCP - Quality system",
"url": "https://sap-ev-rest-server-qa.cfapps.eu10.hana.ondemand.com/v1"
- },
- {
- "description": "Localhost - Development",
- "url": "http://localhost:8080/v1"
}
],
"info": {
{
"name": "Authentication",
"description": "Authentication API"
+ },
+ {
+ "name": "Charging Stations",
+ "description": "Charging Stations API"
}
],
"paths": {
"type": "string",
"format": "date-time",
"example": "2020-07-22T17:02:42.036Z"
+ },
+ "Charging Station": {
+ "type": "object",
+ "properties": {
+ "id": {
+ "type": "string",
+ "example": ""
+ },
+ "templateHash": {
+ "type": "string"
+ },
+ "templateHashCapabilities": {
+ "type": "string"
+ },
+ "templateHashTechnical": {
+ "type": "string"
+ },
+ "templateHashOcppStandard": {
+ "type": "string"
+ },
+ "templateHashOcppVendor": {
+ "type": "string"
+ },
+ "issuer": {
+ "type": "boolean"
+ },
+ "public": {
+ "type": "boolean"
+ },
+ "siteAreaID": {
+ "type": "string"
+ },
+ "chargePointSerialNumber": {
+ "type": "string"
+ },
+ "chargePointModel": {
+ "type": "string"
+ },
+ "chargeBoxSerialNumber": {
+ "type": "string"
+ },
+ "chargePointVendor": {
+ "type": "string"
+ },
+ "iccid": {
+ "type": "string"
+ },
+ "imsi": {
+ "type": "string"
+ },
+ "meterType": {
+ "type": "string"
+ },
+ "firmwareVersion": {
+ "type": "string"
+ },
+ "firmwareUpdateStatus": {
+ "type": "string"
+ },
+ "meterSerialNumber": {
+ "type": "string"
+ },
+ "endpoint": {
+ "type": "string"
+ },
+ "ocppVersion": {
+ "type": "string"
+ },
+ "ocppProtocol": {
+ "type": "string"
+ },
+ "cfApplicationIDAndInstanceIndex": {
+ "type": "string"
+ },
+ "lastSeen": {
+ "type": "string"
+ },
+ "deleted": {
+ "type": "string"
+ },
+ "inactive": {
+ "type": "string"
+ },
+ "forceInactive": {
+ "type": "string"
+ },
+ "lastReboot": {
+ "type": "string"
+ },
+ "chargingStationURL": {
+ "type": "string"
+ },
+ "maximumPower": {
+ "type": "string"
+ },
+ "voltage": {
+ "type": "string"
+ },
+ "excludeFromSmartCharging": {
+ "type": "string"
+ },
+ "powerLimitUnit": {
+ "type": "string"
+ },
+ "coordinates": {
+ "type": "string"
+ },
+ "chargePoints": {
+ "type": "string"
+ },
+ "connectors": {
+ "type": "string"
+ },
+ "remoteAuthorizations": {
+ "type": "string"
+ },
+ "currentIPAddress": {
+ "type": "string"
+ },
+ "siteArea": {
+ "type": "string"
+ },
+ "capabilities": {
+ "type": "string"
+ },
+ "ocppStandardParameters": {
+ "type": "string"
+ },
+ "ocppVendorParameters": {
+ "type": "string"
+ },
+ "distanceMeters": {
+ "type": "string"
+ },
+ "ocpiData": {
+ "type": "object",
+ "properties": {
+ "evse": {
+ "type": "string"
+ }
+ }
+ }
+ }
}
},
"parameters": {

MODIFY
src/server/rest/v1/router/GlobalRouter.ts
src/server/rest/v1/router/GlobalRouter.ts
@@ -2,6 +2,7 @@ import express, { NextFunction, Request, Response } from 'express';
import AuthRouter from './auth/AuthRouter';
import AuthService from '../service/AuthService';
+import ChargingStationRouter from './api/ChargingStationRouter';
import { StatusCodes } from 'http-status-codes';
import SwaggerRouter from './doc/SwaggerRouter';
import TenantRouter from './api/TenantRouter';
@@ -29,7 +30,8 @@ export default class GlobalRouter {
protected buildRouteAPI(): void {
this.router.use('/api', AuthService.authenticate(), [
- new TenantRouter().buildRoutes()
+ new TenantRouter().buildRoutes(),
+ new ChargingStationRouter().buildRoutes()
]);
}

MODIFY
src/server/rest/v1/router/api/ChargingStationRouter.ts
src/server/rest/v1/router/api/ChargingStationRouter.ts
@@ -14,6 +14,35 @@ export default class ChargingStationRouter {
public buildRoutes(): express.Router {
this.buildRouteChargingStations();
+ this.buildRouteChargingStation();
+ this.buildRouteChargingStationDelete();
+ this.buildRouteChargingStationReset();
+ this.buildRouteChargingStationClearCache();
+ this.buildRouteChargingStationConfiguration();
+ this.buildRouteChargingStationRemoteStart();
+ this.buildRouteChargingStationRemoteStop();
+ this.buildRouteChargingStationUnlockConnector();
+ this.buildRouteChargingStationGenerateQRCode();
+ this.buildRouteChargingStationSetChargingProfile();
+ this.buildRouteChargingStationClearChargingProfile();
+ this.buildRouteChargingStationCompositeSchedule();
+ this.buildRouteChargingStationDiagnostics();
+ this.buildRouteChargingStationUpdateFirmware();
+ this.buildRouteChargingStationChangeAvailability();
+ this.buildRouteChargingStationDownloadQRCode();
+ this.buildRouteChargingStationRequestOCPPParameters();
+ this.buildRouteChargingStationOCPPParameters();
+ this.buildRouteChargingStationExportOCPPParameters();
+ this.buildRouteChargingStationUpdateParameters();
+ this.buildRouteChargingStationLimitPower();
+ this.buildRouteChargingStationTransactions();
+ this.buildRouteChargingStationsInError();
+ this.buildRouteChargingStationsExport();
+ this.buildRouteChargingStationDownloadFirmware();
+ this.buildRouteChargingStationCheckSmartCharging();
+ this.buildRouteChargingStationProfile();
+ this.buildRouteChargingStationDeleteProfile();
+ this.buildRouteChargingStationUpdateParameters();
return this.router;
}
@@ -22,4 +51,179 @@ export default class ChargingStationRouter {
await RouterUtils.handleServerAction(ChargingStationService.handleGetChargingStations.bind(this), ServerAction.REST_CHARGING_STATIONS, req, res, next);
});
}
+
+ protected buildRouteChargingStation(): void {
+ this.router.get(`/${ServerAction.REST_CHARGING_STATIONS}/:id`, async (req: Request, res: Response, next: NextFunction) => {
+ await RouterUtils.handleServerAction(ChargingStationService.handleGetChargingStation.bind(this), ServerAction.REST_CHARGING_STATIONS, req, res, next);
+ });
+ }
+
+ protected buildRouteChargingStationDelete(): void {
+ this.router.delete(`/${ServerAction.REST_CHARGING_STATIONS}/:id`, async (req: Request, res: Response, next: NextFunction) => {
+ await RouterUtils.handleServerAction(ChargingStationService.handleDeleteChargingStation.bind(this), ServerAction.REST_CHARGING_STATIONS, req, res, next);
+ });
+ }
+
+ protected buildRouteChargingStationReset(): void {
+ this.router.get(`/${ServerAction.REST_CHARGING_STATIONS_RESET}`, async (req: Request, res: Response, next: NextFunction) => {
+ await RouterUtils.handleServerAction(ChargingStationService.handleGetChargingStation.bind(this), ServerAction.REST_CHARGING_STATIONS_RESET, req, res, next);
+ });
+ }
+
+ protected buildRouteChargingStationClearCache(): void {
+ this.router.get(`/${ServerAction.REST_CHARGING_STATIONS_CACHE_CLEAR}`, async (req: Request, res: Response, next: NextFunction) => {
+ await RouterUtils.handleServerAction(ChargingStationService.handleDeleteChargingProfile.bind(this), ServerAction.REST_CHARGING_STATIONS_CACHE_CLEAR, req, res, next);
+ });
+ }
+
+ protected buildRouteChargingStationConfiguration(): void {
+ this.router.get(`/${ServerAction.REST_CHARGING_STATIONS_CONFIGURATION}`, async (req: Request, res: Response, next: NextFunction) => {
+ await RouterUtils.handleServerAction(ChargingStationService.handleDeleteChargingProfile.bind(this), ServerAction.REST_CHARGING_STATIONS_CACHE_CLEAR, req, res, next);
+ });
+ }
+
+ protected buildRouteChargingStationRemoteStart(): void {
+ this.router.post(`/${ServerAction.REST_CHARGING_STATIONS_REMOTE_START}`, async (req: Request, res: Response, next: NextFunction) => {
+ await RouterUtils.handleServerAction(ChargingStationService.handleDeleteChargingProfile.bind(this), ServerAction.REST_CHARGING_STATIONS_REMOTE_START, req, res, next);
+ });
+ }
+
+ protected buildRouteChargingStationRemoteStop(): void {
+ this.router.post(`/${ServerAction.REST_CHARGING_STATIONS_REMOTE_STOP}`, async (req: Request, res: Response, next: NextFunction) => {
+ await RouterUtils.handleServerAction(ChargingStationService.handleDeleteChargingProfile.bind(this), ServerAction.REST_CHARGING_STATIONS_REMOTE_STOP, req, res, next);
+ });
+ }
+
+ protected buildRouteChargingStationUnlockConnector(): void {
+ this.router.post(`/${ServerAction.REST_CHARGING_STATIONS_UNLOCK_CONNECTOR}`, async (req: Request, res: Response, next: NextFunction) => {
+ await RouterUtils.handleServerAction(ChargingStationService.handleDeleteChargingProfile.bind(this), ServerAction.REST_CHARGING_STATIONS_UNLOCK_CONNECTOR, req, res, next);
+ });
+ }
+
+ protected buildRouteChargingStationGenerateQRCode(): void {
+ this.router.get(`/${ServerAction.REST_CHARGING_STATIONS_GENERATE_QRCODE}`, async (req: Request, res: Response, next: NextFunction) => {
+ await RouterUtils.handleServerAction(ChargingStationService.handleDeleteChargingProfile.bind(this), ServerAction.REST_CHARGING_STATIONS_GENERATE_QRCODE, req, res, next);
+ });
+ }
+
+ protected buildRouteChargingStationSetChargingProfile(): void {
+ this.router.post(`/${ServerAction.REST_CHARGING_PROFILE}`, async (req: Request, res: Response, next: NextFunction) => {
+ await RouterUtils.handleServerAction(ChargingStationService.handleDeleteChargingProfile.bind(this), ServerAction.REST_CHARGING_PROFILE, req, res, next);
+ });
+ }
+
+ protected buildRouteChargingStationClearChargingProfile(): void {
+ this.router.delete(`/${ServerAction.REST_CHARGING_PROFILE}`, async (req: Request, res: Response, next: NextFunction) => {
+ await RouterUtils.handleServerAction(ChargingStationService.handleDeleteChargingProfile.bind(this), ServerAction.REST_CHARGING_PROFILE, req, res, next);
+ });
+ }
+
+ protected buildRouteChargingStationCompositeSchedule(): void {
+ this.router.get(`/${ServerAction.REST_CHARGING_STATIONS_COMPOSITE_SCHEDULE}`, async (req: Request, res: Response, next: NextFunction) => {
+ await RouterUtils.handleServerAction(ChargingStationService.handleDeleteChargingProfile.bind(this), ServerAction.REST_CHARGING_STATIONS_COMPOSITE_SCHEDULE, req, res, next);
+ });
+ }
+
+ protected buildRouteChargingStationDiagnostics(): void {
+ this.router.get(`/${ServerAction.REST_CHARGING_STATIONS_DIAGNOSTICS}`, async (req: Request, res: Response, next: NextFunction) => {
+ await RouterUtils.handleServerAction(ChargingStationService.handleDeleteChargingProfile.bind(this), ServerAction.REST_CHARGING_STATIONS_DIAGNOSTICS, req, res, next);
+ });
+ }
+
+ protected buildRouteChargingStationUpdateFirmware(): void {
+ this.router.put(`/${ServerAction.REST_CHARGING_STATIONS_FIRMWARE}`, async (req: Request, res: Response, next: NextFunction) => {
+ await RouterUtils.handleServerAction(ChargingStationService.handleDeleteChargingProfile.bind(this), ServerAction.REST_CHARGING_STATIONS_FIRMWARE, req, res, next);
+ });
+ }
+
+ protected buildRouteChargingStationChangeAvailability(): void {
+ this.router.put(`/${ServerAction.REST_CHARGING_STATIONS_AVAILABILITY}`, async (req: Request, res: Response, next: NextFunction) => {
+ await RouterUtils.handleServerAction(ChargingStationService.handleDeleteChargingProfile.bind(this), ServerAction.REST_CHARGING_STATIONS_AVAILABILITY, req, res, next);
+ });
+ }
+
+ protected buildRouteChargingStationDownloadQRCode(): void {
+ this.router.get(`/${ServerAction.REST_CHARGING_STATIONS_DOWNLOAD_QR_CODE}`, async (req: Request, res: Response, next: NextFunction) => {
+ await RouterUtils.handleServerAction(ChargingStationService.handleDeleteChargingProfile.bind(this), ServerAction.REST_CHARGING_STATIONS_DOWNLOAD_QR_CODE, req, res, next);
+ });
+ }
+
+ protected buildRouteChargingStationRequestOCPPParameters(): void {
+ this.router.post(`/${ServerAction.REST_CHARGING_STATIONS_OCPP_PARAMETERS}`, async (req: Request, res: Response, next: NextFunction) => {
+ await RouterUtils.handleServerAction(ChargingStationService.handleDeleteChargingProfile.bind(this), ServerAction.REST_CHARGING_STATIONS_OCPP_PARAMETERS, req, res, next);
+ });
+ }
+
+ protected buildRouteChargingStationOCPPParameters(): void {
+ this.router.get(`/${ServerAction.REST_CHARGING_STATIONS_OCPP_PARAMETERS}`, async (req: Request, res: Response, next: NextFunction) => {
+ await RouterUtils.handleServerAction(ChargingStationService.handleDeleteChargingProfile.bind(this), ServerAction.REST_CHARGING_STATIONS_OCPP_PARAMETERS, req, res, next);
+ });
+ }
+
+ protected buildRouteChargingStationExportOCPPParameters(): void {
+ this.router.get(`/${ServerAction.REST_CHARGING_STATIONS_OCPP_PARAMETERS_EXPORT}`, async (req: Request, res: Response, next: NextFunction) => {
+ await RouterUtils.handleServerAction(ChargingStationService.handleDeleteChargingProfile.bind(this), ServerAction.REST_CHARGING_STATIONS_OCPP_PARAMETERS_EXPORT, req, res, next);
+ });
+ }
+
+ protected buildRouteChargingStationUpdateParameters(): void {
+ this.router.put(`/${ServerAction.REST_CHARGING_STATIONS_PARAMETERS}`, async (req: Request, res: Response, next: NextFunction) => {
+ await RouterUtils.handleServerAction(ChargingStationService.handleDeleteChargingProfile.bind(this), ServerAction.REST_CHARGING_STATIONS_PARAMETERS, req, res, next);
+ });
+ }
+
+ protected buildRouteChargingStationLimitPower(): void {
+ this.router.put(`/${ServerAction.REST_CHARGING_STATIONS_POWER_LIMIT}`, async (req: Request, res: Response, next: NextFunction) => {
+ await RouterUtils.handleServerAction(ChargingStationService.handleDeleteChargingProfile.bind(this), ServerAction.REST_CHARGING_STATIONS_POWER_LIMIT, req, res, next);
+ });
+ }
+
+ protected buildRouteChargingStationTransactions(): void {
+ this.router.put(`/${ServerAction.REST_CHARGING_STATIONS_TRANSACTIONS}`, async (req: Request, res: Response, next: NextFunction) => {
+ await RouterUtils.handleServerAction(ChargingStationService.handleDeleteChargingProfile.bind(this), ServerAction.REST_CHARGING_STATIONS_TRANSACTIONS, req, res, next);
+ });
+ }
+
+ protected buildRouteChargingStationsInError(): void {
+ this.router.get(`/${ServerAction.REST_CHARGING_STATIONS_IN_ERROR}`, async (req: Request, res: Response, next: NextFunction) => {
+ await RouterUtils.handleServerAction(ChargingStationService.handleGetChargingStationsInError.bind(this), ServerAction.REST_CHARGING_STATIONS_IN_ERROR, req, res, next);
+ });
+ }
+
+ protected buildRouteChargingStationsExport(): void {
+ this.router.get(`/${ServerAction.REST_CHARGING_STATIONS_EXPORT}`, async (req: Request, res: Response, next: NextFunction) => {
+ await RouterUtils.handleServerAction(ChargingStationService.handleExportChargingStations.bind(this), ServerAction.REST_CHARGING_STATIONS_EXPORT, req, res, next);
+ });
+ }
+
+ protected buildRouteChargingStationDownloadFirmware(): void {
+ this.router.get(`/${ServerAction.REST_CHARGING_STATIONS_FIRMWARE}`, async (req: Request, res: Response, next: NextFunction) => {
+ await RouterUtils.handleServerAction(ChargingStationService.handleGetFirmware.bind(this), ServerAction.REST_CHARGING_STATIONS_FIRMWARE, req, res, next);
+ });
+ }
+
+ protected buildRouteChargingStationCheckSmartCharging(): void {
+ this.router.get(`/${ServerAction.REST_CHARGING_STATION_CHECK_SMART_CHARGING_CONNECTION}`, async (req: Request, res: Response, next: NextFunction) => {
+ await RouterUtils.handleServerAction(ChargingStationService.handleCheckSmartChargingConnection.bind(this), ServerAction.REST_CHARGING_STATION_CHECK_SMART_CHARGING_CONNECTION, req, res, next);
+ });
+ }
+
+ protected buildRouteChargingStationProfile(): void {
+ this.router.get(`/${ServerAction.REST_CHARGING_PROFILE}`, async (req: Request, res: Response, next: NextFunction) => {
+ await RouterUtils.handleServerAction(ChargingStationService.handleGetChargingProfiles.bind(this), ServerAction.REST_CHARGING_PROFILE, req, res, next);
+ });
+ }
+
+ protected buildRouteChargingStationUpdateProfile(): void {
+ this.router.put(`/${ServerAction.REST_CHARGING_PROFILE}`, async (req: Request, res: Response, next: NextFunction) => {
+ await RouterUtils.handleServerAction(ChargingStationService.handleUpdateChargingProfile.bind(this), ServerAction.REST_CHARGING_PROFILE, req, res, next);
+ });
+ }
+
+ protected buildRouteChargingStationDeleteProfile(): void {
+ this.router.delete(`/${ServerAction.REST_CHARGING_PROFILE}`, async (req: Request, res: Response, next: NextFunction) => {
+ await RouterUtils.handleServerAction(ChargingStationService.handleDeleteChargingProfile.bind(this), ServerAction.REST_CHARGING_PROFILE, req, res, next);
+ });
+ }
+
}

MODIFY
src/types/Server.ts
src/types/Server.ts
@@ -397,6 +397,28 @@ export enum ServerAction {
REST_MAIL_RESEND = 'mail/resend',
REST_CHARGING_STATIONS = 'chargingstations',
+ REST_CHARGING_STATIONS_RESET = 'chargingstations/:id/reset',
+ REST_CHARGING_STATIONS_CACHE_CLEAR = 'chargingstations/:id/cache/clear',
+ REST_CHARGING_STATIONS_CONFIGURATION = 'chargingstations/:id/configuration',
+ REST_CHARGING_STATIONS_REMOTE_START = 'chargingstations/:id/remote/start',
+ REST_CHARGING_STATIONS_REMOTE_STOP = 'chargingstations/:id/remote/stop',
+ REST_CHARGING_STATIONS_UNLOCK_CONNECTOR = 'chargingstations/:id/connectors/:connectorId/unlock',
+ REST_CHARGING_STATIONS_GENERATE_QRCODE = 'chargingstations/:id/connectors/:connectorId/qrcode',
+ REST_CHARGING_STATION_CHECK_SMART_CHARGING_CONNECTION = 'chargingstations/smartcharging/checkconnection',
+ REST_CHARGING_STATIONS_COMPOSITE_SCHEDULE = 'chargingstations/:id/compositeschedule',
+ REST_CHARGING_STATIONS_DIAGNOSTICS = 'chargingstations/:id/compositeschedule',
+ REST_CHARGING_STATIONS_DOWNLOAD_FIRMWARE = 'chargingstations/firmware/:name',
+ REST_CHARGING_STATIONS_FIRMWARE = 'chargingstations/:id/firmware',
+ REST_CHARGING_STATIONS_AVAILABILITY = 'chargingstations/:id/availabilty',
+ REST_CHARGING_STATIONS_DOWNLOAD_QR_CODE = 'chargingstations/:id/qrcode',
+ REST_CHARGING_STATIONS_OCPP_PARAMETERS = 'chargingstations/:id/ocppparameters',
+ REST_CHARGING_STATIONS_OCPP_PARAMETERS_EXPORT = 'chargingstations/:id/ocppparameters/export',
+ REST_CHARGING_STATIONS_PARAMETERS = 'chargingstations/:id/parameters',
+ REST_CHARGING_STATIONS_POWER_LIMIT = 'chargingstations/:id/power/limit',
+ REST_CHARGING_STATIONS_TRANSACTIONS = 'chargingstations/:id/transactions',
+ REST_CHARGING_STATIONS_IN_ERROR = 'chargingstations/inerror',
+ REST_CHARGING_STATIONS_EXPORT = 'chargingstations/export',
+ REST_CHARGING_PROFILE = 'chargingstations/:id/profile',
REST_PING = 'ping',
REST_TENANTS = 'tenants'
}

Added REST routes