Updated routes and unit tests
MODIFY
src/assets/server/rest/v1/docs/e-mobility-oas.json
src/assets/server/rest/v1/docs/e-mobility-oas.json
{
"in": "query",
"name": "WithNoSiteArea",
+ "example": true,
"schema": {
"type": "boolean"
}
}
},
{
- "in": "query",
- "name": "ErrorType",
- "schema": {
- "type": "string"
- }
+ "$ref": "#/components/parameters/ErrorType"
},
{
"in": "query",
"in": "query",
"name": "LocLatitude",
"schema": {
- "type": "string"
+ "type": "number"
}
},
{
],
"responses": {
"200": {
- "description": "Charging Stations list",
+ "description": "Return Charging Stations list",
"content": {
"application/json": {
"example": {
"type": "string",
"example": "SAP-Mougins-03"
}
- }
- ],
- "requestBody": {
- "content": {
- "application/json": {
- "schema": {
- "type": "object",
- "required": [
- "chargeBoxID",
- "type"
- ],
- "properties": {
- "chargeBoxID": {
- "type": "string"
- },
- "type": {
- "type": "string"
- }
- }
- },
- "examples": {
- "softReset": {
- "summary": "Soft Reset",
- "value": {
- "chargeBoxID": "SAP-Mougins-03",
- "type": "Soft"
- }
},
- "hardReset": {
- "summary": "Hard Reset",
- "value": {
- "chargeBoxID": "SAP-Mougins-03",
- "type": "Hard"
- }
- }
- }
+ {
+ "in": "path",
+ "name": "type",
+ "required": true,
+ "schema": {
+ "type": "string",
+ "enum": ["Soft", "Hard"],
+ "example": "Soft"
}
}
- },
+ ],
"tags": [
"Charging Stations"
],
}
}
},
- "/api/chargingstations/{id}/remote/start": {
+ "/api/chargingstations/remote/start": {
"post": {
"security": [
{
}
],
"description": "Start a remote transaction",
- "parameters": [
- {
- "in": "path",
- "name": "id",
- "required": true,
- "schema": {
- "type": "string",
- "example": "SAP-Mougins-03"
- }
- }
- ],
"requestBody": {
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
+ "chargeBoxID": {
+ "type": "string"
+ },
"connectorId": {
- "type": "number"
+ "type": "integer",
+ "minimum": 1,
+ "example": 1
},
"tagID": {
"type": "string",
}
}
},
- "/api/chargingstations/{id}/remote/stop": {
+ "/api/chargingstations/remote/stop": {
"post": {
"security": [
{
}
],
"description": "Stop a remote transaction",
- "parameters": [
- {
- "in": "path",
- "name": "id",
- "required": true,
- "schema": {
- "type": "string",
- "example": "SAP-Mougins-03"
- }
- }
- ],
"requestBody": {
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
+ "chargeBoxID": {
+ "type": "string"
+ },
"transactionId": {
"type": "string"
}
}
},
{
- "in": "path",
- "name": "connectorId",
- "required": true,
- "schema": {
- "type": "number",
- "example": "0"
- }
+ "$ref": "#/components/parameters/ConnectorID"
}
],
"tags": [
}
},
{
- "in": "path",
- "name": "connectorId",
- "required": true,
- "schema": {
- "type": "number",
- "format": "integer",
- "example": "0"
- }
+ "$ref": "#/components/parameters/ConnectorID"
},
{
"in": "path",
}
}
},
- "/api/chargingstations/occp-parameters": {
+ "/api/chargingstations/ocpp-parameters": {
"post": {
"security": [
{
],
"properties": {
"chargeBoxID": {
- "type": "string"
+ "type": "string",
+ "example": "SAP-Mougins-03"
},
"forceUpdateOCPPParamsFromTemplate": {
- "type": "boolean"
+ "type": "boolean",
+ "example": false
}
}
}
"example": "SAP-Mougins-03"
},
"maximumPower": {
- "type": "string"
+ "type": "number"
},
"excludeFromSmartCharging": {
- "type": "string"
+ "type": "boolean"
},
"forceInactive": {
"type": "boolean"
}
},
{
- "in": "query",
- "name": "ErrorType",
- "schema": {
- "type": "string",
- "enum": ["missing_settings", "connection_broken", "missing_site_area", "connection_error"]
- }
+ "$ref": "#/components/parameters/ErrorType"
},
{
"in": "query",
}
},
{
- "in": "query",
- "name": "ErrorType",
- "schema": {
- "type": "string"
- }
+ "$ref": "#/components/parameters/ErrorType"
},
{
"in": "query",
"schema": {
"type": "number"
}
- },
- {
- "$ref": "#/components/parameters/Limit"
- },
- {
- "$ref": "#/components/parameters/Skip"
- },
- {
- "$ref": "#/components/parameters/SortFields"
}
],
"tags": [
"name": "id",
"required": true,
"schema": {
- "type": "string"
+ "type": "string",
+ "example": "SAP-Mougins-03"
}
},
{
"$ref": "#/components/responses/500BackendError"
}
}
+ },
+ "put": {
+ "security": [
+ {
+ "bearerAuth": []
+ }
+ ],
+ "description": "Update a Charging Station profile",
+ "tags": [
+ "Charging Stations"
+ ],
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "id": {
+ "type": "string"
+ },
+ "chargingStationID": {
+ "type": "string",
+ "example": "SAP-Mougins-03"
+ },
+ "connectorID": {
+ "type": "integer",
+ "minimum": 1,
+ "example": 1
+ },
+ "chargePointID": {
+ "type": "string"
+ },
+ "profile": {
+ "$ref": "#/components/schemas/ChargingProfile"
+ }
+ }
+ }
+ }
+ }
+ },
+ "responses": {
+ "200": {
+ "description": "Charging station profile updated successfully",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "id": {
+ "type": "string"
+ },
+ "status": {
+ "type": "string",
+ "example": "Success"
+ }
+ }
+ }
+ }
+ }
+ },
+ "401": {
+ "$ref": "#/components/responses/UnauthorizedError"
+ },
+ "500": {
+ "$ref": "#/components/responses/500BackendError"
+ },
+ "585": {
+ "$ref": "#/components/responses/NotSupportedError"
+ }
+ }
+ }
+ },
+ "/api/chargingstations/profiles/{id}": {
+ "delete": {
+ "security": [
+ {
+ "bearerAuth": []
+ }
+ ],
+ "description": "Delete a Charging Station profile",
+ "parameters": [
+ {
+ "in": "path",
+ "name": "id",
+ "required": true,
+ "schema": {
+ "type": "string"
+ }
+ }
+ ],
+ "tags": [
+ "Charging Stations"
+ ],
+ "responses": {
+ "200": {
+ "description": "Charging Station deleted successfully"
+ },
+ "401": {
+ "$ref": "#/components/responses/UnauthorizedError"
+ },
+ "500": {
+ "$ref": "#/components/responses/500BackendError"
+ },
+ "537": {
+ "description": "Error occured while clearing Charging Profile"
+ }
+ }
}
}
},
"format": "date-time"
},
"chargingSchedule": {
- "$ref": "#/components/schemas/chargingSchedule"
+ "$ref": "#/components/schemas/ChargingSchedule"
}
}
}
}
},
- "chargingSchedule": {
+ "ChargingSchedule": {
"type": "object",
"required": [
"chargingRateUnit",
"schema": {
"type": "string"
}
+ },
+ "ErrorType": {
+ "in": "query",
+ "name": "ErrorType",
+ "schema": {
+ "type": "string",
+ "enum": ["missing_settings", "connection_broken", "missing_site_area", "connection_error"]
+ }
+ },
+ "ConnectorID": {
+ "in": "path",
+ "name": "connectorId",
+ "required": true,
+ "schema": {
+ "type": "integer",
+ "minimum": 1,
+ "example": 1
+ }
}
}
}

MODIFY
src/server/rest/CentralRestServerService.ts
src/server/rest/CentralRestServerService.ts
@@ -38,10 +38,8 @@ class RequestMapper {
case 'POST':
this.registerOneActionManyPaths(
async (action: ServerAction, req: Request, res: Response, next: NextFunction) => {
- // Keep the action (remove ChargingStation)
- const command = action.slice(15) as Command;
// Delegate
- await ChargingStationService.handleAction(action, command, req, res, next);
+ await ChargingStationService.handleAction(action, req, res, next);
},
ServerAction.CHARGING_STATION_CLEAR_CACHE,
ServerAction.CHARGING_STATION_GET_CONFIGURATION,

MODIFY
src/server/rest/v1/router/api/ChargingStationRouter.ts
src/server/rest/v1/router/api/ChargingStationRouter.ts
@@ -17,6 +17,10 @@ export default class ChargingStationRouter {
this.buildRouteChargingStationsInError();
this.buildRouteChargingStationsExport();
this.buildRouteChargingStationProfile();
+ this.buildRouteChargingStationRequestOCPPParameters();
+ this.buildRouteChargingStationDownloadFirmware();
+ this.buildRouteChargingStationDeleteProfile();
+ this.buildRouteChargingStationUpdateProfile();
this.buildRouteChargingStations();
this.buildRouteChargingStation();
this.buildRouteChargingStationDelete();
@@ -27,23 +31,17 @@ export default class ChargingStationRouter {
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.buildRouteChargingStationDownloadFirmware();
this.buildRouteChargingStationCheckSmartCharging();
- this.buildRouteChargingStationDeleteProfile();
- this.buildRouteChargingStationUpdateParameters();
return this.router;
}
@@ -62,66 +60,60 @@ export default class ChargingStationRouter {
protected buildRouteChargingStationDelete(): void {
this.router.delete(`/${ServerAction.REST_CHARGING_STATIONS}/:id`, async (req: Request, res: Response, next: NextFunction) => {
+ req.query.ID = req.params.id;
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.handleAction.bind(this), ServerAction.REST_CHARGING_STATIONS_RESET, req, res, next);
+ req.query.chargeBoxID = req.params.id;
+ await RouterUtils.handleServerAction(ChargingStationService.handleAction.bind(this), ServerAction.CHARGING_STATION_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.handleAction.bind(this), ServerAction.REST_CHARGING_STATIONS_CACHE_CLEAR, req, res, next);
+ await RouterUtils.handleServerAction(ChargingStationService.handleAction.bind(this), ServerAction.CHARGING_STATION_CLEAR_CACHE, 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.handleAction.bind(this), ServerAction.REST_CHARGING_STATIONS_CACHE_CLEAR, req, res, next);
+ await RouterUtils.handleServerAction(ChargingStationService.handleAction.bind(this), ServerAction.CHARGING_STATION_GET_CONFIGURATION, 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.handleAction.bind(this), ServerAction.REST_CHARGING_STATIONS_REMOTE_START, req, res, next);
+ req.query.chargeBoxID = req.params.id;
+ await RouterUtils.handleServerAction(ChargingStationService.handleAction.bind(this), ServerAction.CHARGING_STATION_REMOTE_START_TRANSACTION, 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.handleAction.bind(this), ServerAction.REST_CHARGING_STATIONS_REMOTE_STOP, req, res, next);
+ await RouterUtils.handleServerAction(ChargingStationService.handleAction.bind(this), ServerAction.CHARGING_STATION_REMOTE_STOP_TRANSACTION, 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.handleAction.bind(this), ServerAction.REST_CHARGING_STATIONS_UNLOCK_CONNECTOR, req, res, next);
+ await RouterUtils.handleServerAction(ChargingStationService.handleAction.bind(this), ServerAction.CHARGING_STATION_UNLOCK_CONNECTOR, req, res, next);
});
}
protected buildRouteChargingStationGenerateQRCode(): void {
this.router.post(`/${ServerAction.REST_CHARGING_STATIONS_GENERATE_QRCODE}`, async (req: Request, res: Response, next: NextFunction) => {
+ req.query.ChargeBoxID = req.params.id;
+ req.query.ConnectorID = req.params.connectorId;
await RouterUtils.handleServerAction(ChargingStationService.handleGenerateQrCodeForConnector.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.handleAction.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.handleAction.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) => {
+ req.query.chargeBoxID = req.params.id;
await RouterUtils.handleServerAction(ChargingStationService.handleAction.bind(this), ServerAction.REST_CHARGING_STATIONS_COMPOSITE_SCHEDULE, req, res, next);
});
}
@@ -146,6 +138,8 @@ export default class ChargingStationRouter {
protected buildRouteChargingStationDownloadQRCode(): void {
this.router.get(`/${ServerAction.REST_CHARGING_STATIONS_DOWNLOAD_QR_CODE}`, async (req: Request, res: Response, next: NextFunction) => {
+ req.query.ChargeBoxID = req.params.id;
+ req.query.ConnectorID = req.params.connectorId;
await RouterUtils.handleServerAction(ChargingStationService.handleDownloadQrCodesPdf.bind(this), ServerAction.REST_CHARGING_STATIONS_DOWNLOAD_QR_CODE, req, res, next);
});
}
@@ -157,7 +151,7 @@ export default class ChargingStationRouter {
}
protected buildRouteChargingStationOCPPParameters(): void {
- this.router.get(`/${ServerAction.REST_CHARGING_STATIONS_OCPP_PARAMETERS}`, async (req: Request, res: Response, next: NextFunction) => {
+ this.router.get(`/${ServerAction.REST_CHARGING_STATION_OCPP_PARAMETERS}`, async (req: Request, res: Response, next: NextFunction) => {
req.query.ChargeBoxID = req.params.id;
await RouterUtils.handleServerAction(ChargingStationService.handleGetChargingStationOcppParameters.bind(this), ServerAction.REST_CHARGING_STATIONS_OCPP_PARAMETERS, req, res, next);
});
@@ -202,6 +196,7 @@ export default class ChargingStationRouter {
protected buildRouteChargingStationDownloadFirmware(): void {
this.router.get(`/${ServerAction.REST_CHARGING_STATIONS_FIRMWARE}`, async (req: Request, res: Response, next: NextFunction) => {
+ req.query.ID = req.params.firmwareId;
await RouterUtils.handleServerAction(ChargingStationService.handleGetFirmware.bind(this), ServerAction.REST_CHARGING_STATIONS_FIRMWARE, req, res, next);
});
}
@@ -213,20 +208,21 @@ export default class ChargingStationRouter {
}
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);
+ this.router.get(`/${ServerAction.REST_CHARGING_PROFILES}`, async (req: Request, res: Response, next: NextFunction) => {
+ await RouterUtils.handleServerAction(ChargingStationService.handleGetChargingProfiles.bind(this), ServerAction.REST_CHARGING_PROFILES, 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);
+ this.router.put(`/${ServerAction.REST_CHARGING_PROFILES}`, async (req: Request, res: Response, next: NextFunction) => {
+ await RouterUtils.handleServerAction(ChargingStationService.handleUpdateChargingProfile.bind(this), ServerAction.REST_CHARGING_PROFILES, 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);
+ req.query.ID = req.params.id;
+ await RouterUtils.handleServerAction(ChargingStationService.handleDeleteChargingProfile.bind(this), ServerAction.REST_CHARGING_PROFILES, req, res, next);
});
}

MODIFY
src/server/rest/v1/service/ChargingStationService.ts
src/server/rest/v1/service/ChargingStationService.ts
@@ -472,7 +472,7 @@ export default class ChargingStationService {
connectorID: filteredRequest.ConnectorID,
endpoint: Utils.getChargingStationEndpoint(),
tenantName: req.user.tenantName,
- tenantSubDomain: req.tenant.subdomain
+ tenantSubDomain: req.user.tenantSubdomain
};
// Generate
const generatedQR = await Utils.generateQrCode(Buffer.from(JSON.stringify(chargingStationQRCode)).toString('base64'));
@@ -952,7 +952,7 @@ export default class ChargingStationService {
public static async handleGetFirmware(action: ServerAction, req: Request, res: Response, next: NextFunction) {
// Filter
const filteredRequest = ChargingStationSecurity.filterChargingStationGetFirmwareRequest(req.query);
- if (!filteredRequest.FileName) {
+ if (!filteredRequest.ID) {
throw new AppError({
source: Constants.CENTRAL_SERVER,
errorCode: HTTPError.GENERAL_ERROR,
@@ -962,10 +962,10 @@ export default class ChargingStationService {
});
}
// Open a download stream and pipe it in the response
- const bucketStream = ChargingStationStorage.getChargingStationFirmware(filteredRequest.FileName);
+ const bucketStream = ChargingStationStorage.getChargingStationFirmware(filteredRequest.ID);
// Set headers
res.setHeader('Content-Type', 'application/octet-stream');
- res.setHeader('Content-Disposition', 'attachment; filename=' + filteredRequest.FileName);
+ res.setHeader('Content-Disposition', 'attachment; filename=' + filteredRequest.ID);
// Write chunks
bucketStream.on('data', (chunk) => {
res.write(chunk);
@@ -975,7 +975,7 @@ export default class ChargingStationService {
Logging.logError({
tenantID: Constants.DEFAULT_TENANT,
action: action,
- message: `Firmware '${filteredRequest.FileName}' has not been found!`,
+ message: `Firmware '${filteredRequest.ID}' has not been found!`,
module: MODULE_NAME, method: 'handleGetFirmware',
detailedMessages: { error: error.message, stack: error.stack },
});
@@ -986,15 +986,18 @@ export default class ChargingStationService {
Logging.logInfo({
tenantID: Constants.DEFAULT_TENANT,
action: action,
- message: `Firmware '${filteredRequest.FileName}' has been downloaded with success`,
+ message: `Firmware '${filteredRequest.ID}' has been downloaded with success`,
module: MODULE_NAME, method: 'handleGetFirmware',
});
res.end();
});
}
- public static async handleAction(action: ServerAction, command: Command, req: Request, res: Response, next: NextFunction) {
+ public static async handleAction(action: ServerAction, req: Request, res: Response, next: NextFunction) {
// Filter - Type is hacked because code below is. Would need approval to change code structure.
+ // const command = action.substr(ServerAction.REST_CHARGING_STATIONS.length) as Command;
+ const command = action.slice(15) as Command;
+
const filteredRequest: HttpChargingStationCommandRequest =
ChargingStationSecurity.filterChargingStationActionRequest({ ...req.query, ...req.body });
UtilsService.assertIdIsProvided(action, filteredRequest.chargeBoxID, MODULE_NAME, 'handleAction', req.user);

MODIFY
src/server/rest/v1/service/security/ChargingStationSecurity.ts
src/server/rest/v1/service/security/ChargingStationSecurity.ts
@@ -280,7 +280,7 @@ export default class ChargingStationSecurity {
public static filterChargingStationGetFirmwareRequest(request: any): HttpChargingStationGetFirmwareRequest {
return {
- FileName: sanitize(request.FileName),
+ ID: sanitize(request.ID),
};
}

MODIFY
src/types/Server.ts
src/types/Server.ts
@@ -400,25 +400,27 @@ export enum ServerAction {
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_REMOTE_START = 'chargingstations/remote/start',
+ REST_CHARGING_STATIONS_REMOTE_STOP = 'chargingstations/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_FIRMWARE = 'chargingstations/:id/firmware/:firmwareId',
REST_CHARGING_STATIONS_AVAILABILITY = 'chargingstations/:id/availabilty',
REST_CHARGING_STATIONS_DOWNLOAD_QR_CODE = 'chargingstations/:id/connectors/:connectorId/qrcode',
- REST_CHARGING_STATIONS_OCPP_PARAMETERS = 'chargingstations/:id/ocpp-parameters',
+ REST_CHARGING_STATIONS_OCPP_PARAMETERS = 'chargingstations/ocpp-parameters',
+ REST_CHARGING_STATION_OCPP_PARAMETERS = 'chargingstations/:id/ocpp-parameters',
REST_CHARGING_STATIONS_OCPP_PARAMETERS_EXPORT = 'chargingstations/:id/ocpp-parameters/export',
REST_CHARGING_STATIONS_PARAMETERS = 'chargingstations/parameters',
REST_CHARGING_STATIONS_POWER_LIMIT = 'chargingstations/power/limit',
REST_CHARGING_STATIONS_TRANSACTIONS = 'chargingstations/:id/transactions',
REST_CHARGING_STATIONS_IN_ERROR = 'chargingstations/in-error',
REST_CHARGING_STATIONS_EXPORT = 'chargingstations/export',
- REST_CHARGING_PROFILE = 'chargingstations/profiles',
+ REST_CHARGING_PROFILES = 'chargingstations/profiles',
+ REST_CHARGING_PROFILE = 'chargingstations/profiles/:id',
REST_PING = 'ping',
REST_TENANTS = 'tenants'
}

MODIFY
src/types/requests/HttpChargingStationRequest.ts
src/types/requests/HttpChargingStationRequest.ts
@@ -99,5 +99,5 @@ export interface HttpIsAuthorizedRequest {
}
export interface HttpChargingStationGetFirmwareRequest {
- FileName: string;
+ ID: string;
}

MODIFY
test/api/client/ChargingStationApi.ts
test/api/client/ChargingStationApi.ts
@@ -13,27 +13,27 @@ export default class ChargingStationApi extends CrudApi {
}
public async readById(id) {
- return super.readById(id, '/client/api/ChargingStation');
+ return super.readById(id, `/v1/api/chargingstations/${id}`);
}
public async readAll(params, paging = TestConstants.DEFAULT_PAGING, ordering = TestConstants.DEFAULT_ORDERING) {
- return super.readAll(params, paging, ordering, '/client/api/ChargingStations');
+ return super.readAll(params, paging, ordering, '/v1/api/chargingstations');
}
public async readAllInError(params, paging = TestConstants.DEFAULT_PAGING, ordering = TestConstants.DEFAULT_ORDERING) {
- return super.readAll(params, paging, ordering, '/client/api/ChargingStationsInError');
+ return super.readAll(params, paging, ordering, '/v1/api/chargingstations/in-error');
}
public async update(data) {
- return super.update(data, '/client/api/ChargingStationUpdateParams');
+ return super.update(data, '/v1/api/chargingstations/parameters');
}
public async delete(id) {
- return super.delete(id, '/client/api/ChargingStationDelete');
+ return super.delete(id, '/v1/api/chargingstations');
}
public async readConfiguration(chargeBoxID) {
- return super.read({ ChargeBoxID: chargeBoxID }, '/client/api/ChargingStationOcppParameters');
+ return super.read({}, `/v1/api/chargingstations/${chargeBoxID}/configuration`);
}
public async readConsumptionStatistics(year) {
@@ -45,7 +45,7 @@ export default class ChargingStationApi extends CrudApi {
}
public async readAllTransactions(params, paging = TestConstants.DEFAULT_PAGING, ordering = TestConstants.DEFAULT_ORDERING) {
- return super.readAll(params, paging, ordering, '/client/api/ChargingStationTransactions');
+ return super.readAll(params, paging, ordering, `/v1/api/chargingstations/${params.id}/transactions`);
}
public async readAllYears(params) {
@@ -53,11 +53,11 @@ export default class ChargingStationApi extends CrudApi {
}
public async updateParams(data) {
- return super.update(data, '/client/api/ChargingStationUpdateParams');
+ return super.update(data, '/v1/api/chargingstations/parameters');
}
public async remoteStartTransaction(data) {
- return super.create(data, '/client/api/ChargingStationRemoteStartTransaction');
+ return super.create(data, '/v1/api/chargingstations/remote/start');
}
public async checkConnector(chargingStation, connectorId, connectorData) {

Updated routes and unit tests