Added consumption + getbyid endpoints
MODIFY
src/assets/server/rest/v1/docs/e-mobility-oas.json
src/assets/server/rest/v1/docs/e-mobility-oas.json
],
"responses": {
"200": {
- "description": "Return Transaction's list",
+ "description": "Return Transactions in progress list",
"content": {
"application/json": {
"example": {
"count": 1,
+ "stats": {
+ "_id": null,
+ "count": 1
+ },
"result": [
{
- "id": 1234567889,
"issuer": true,
- "siteID": "####",
- "siteAreaID": "####",
- "connectorId": 2,
- "tagID": "####",
- "userID": "####",
- "chargeBoxID": "####",
- "meterStart": 1122030,
- "timestamp": "2021-02-15T16:04:04.000Z",
+ "siteID": "###",
+ "siteAreaID": "###",
+ "connectorId": 1,
+ "tagID": "###",
+ "userID": "###",
+ "chargeBoxID": "###",
+ "meterStart": 7157518,
+ "timestamp": "2021-03-05T16:37:56.000Z",
+ "price": 0,
+ "roundedPrice": 0,
+ "priceUnit": "EUR",
+ "stateOfCharge": 0,
+ "timezone": "Europe/Paris",
+ "currentStateOfCharge": 0,
+ "currentTotalInactivitySecs": 11640,
+ "currentInactivityStatus": "E",
+ "currentCumulatedPrice": 1.968,
+ "currentInstantWatts": 0,
+ "currentTotalConsumptionWh": 12793,
+ "currentTotalDurationSecs": 21480,
+ "status": "SuspendedEV",
+ "id": 1234567890
+ }
+ ]
+ }
+ }
+ }
+ },
+ "401": {
+ "$ref": "#/components/responses/UnauthorizedError"
+ },
+ "403": {
+ "$ref": "#/components/responses/ForbiddenError"
+ },
+ "500": {
+ "$ref": "#/components/responses/BackendError"
+ }
+ }
+ }
+ },
+ "/api/transactions/{id}": {
+ "get": {
+ "security": [
+ {
+ "bearerAuth": []
+ }
+ ],
+ "description": "Retrieve a Transaction",
+ "parameters": [
+ {
+ "$ref": "#/components/parameters/transactionID"
+ }
+ ],
+ "tags": [
+ "Transactions"
+ ],
+ "responses": {
+ "200": {
+ "description": "Returned Transaction",
+ "content": {
+ "application/json": {
+ "example": {
+ "issuer": true,
+ "siteID": "###",
+ "siteAreaID": "###",
+ "connectorId": 1,
+ "tagID": "###",
+ "userID": "###",
+ "chargeBoxID": "###",
+ "meterStart": 0,
+ "timestamp": "2019-06-12T06:49:46.000Z",
+ "price": 0,
+ "roundedPrice": 0,
+ "priceUnit": "EUR",
"stateOfCharge": 0,
"timezone": "Europe/Paris",
+ "signedData": null,
"stop": {
- "userID": "####",
- "timestamp": "2021-02-15T16:05:38.000Z",
- "tagID": "####",
- "meterStop": 1122046,
+ "userID": "###",
+ "timestamp": "2019-06-12T09:54:18.000Z",
+ "tagID": "###",
+ "meterStop": 18540,
"stateOfCharge": 0,
- "totalConsumptionWh": 16,
+ "signedData": null,
+ "totalConsumptionWh": 18540,
"totalInactivitySecs": 0,
"inactivityStatus": "I",
- "totalDurationSecs": 94,
- "price": 0.002,
+ "totalDurationSecs": 11072,
+ "price": 2.5956,
+ "roundedPrice": 2.59,
"priceUnit": "EUR",
- "user": {
- "email": "####",
- "firstName": "####",
- "name": "####",
- "id": "####"
+ "pricingSource": "simple"
+ },
+ "id": 1234567890
+ }
+ }
}
},
- "ocpi": false,
- "ocpiWithCdr": false,
- "user": {
- "email": "####",
- "firstName": "####",
- "name": "####",
- "id": "####"
+ "401": {
+ "$ref": "#/components/responses/UnauthorizedError"
},
- "car": {
- "licensePlate": "####"
+ "403": {
+ "$ref": "#/components/responses/ForbiddenError"
},
- "carCatalog": {
- "vehicleMake": "Tesla",
- "vehicleModel": "Model 3",
- "vehicleModelVersion": "Long Range Dual Motor"
+ "500": {
+ "$ref": "#/components/responses/BackendError"
}
}
+ }
+ },
+ "/api/transactions/{id}/consumptions": {
+ "get": {
+ "security": [
+ {
+ "bearerAuth": []
+ }
+ ],
+ "description": "Retrieve a Transaction consumption",
+ "parameters": [
+ {
+ "$ref": "#/components/parameters/transactionID"
+ },
+ {
+ "in": "query",
+ "name": "LoadAllConsumptions",
+ "description": "Load all consumptions",
+ "schema": {
+ "type": "boolean"
+ }
+ }
+ ],
+ "tags": [
+ "Transactions"
+ ],
+ "responses": {
+ "200": {
+ "description": "Return a Transaction consumption",
+ "content": {
+ "application/json": {
+ "example": {
+ "issuer": true,
+ "siteID": "###",
+ "siteAreaID": "###",
+ "connectorId": 1,
+ "tagID": "###",
+ "userID": "###",
+ "chargeBoxID": "###",
+ "meterStart": 0,
+ "timestamp": "2019-06-12T06:49:46.000Z",
+ "stateOfCharge": 0,
+ "timezone": "Europe/Paris",
+ "stop": {
+ "userID": "###",
+ "timestamp": "2019-06-12T09:54:18.000Z",
+ "tagID": "###",
+ "stateOfCharge": 0,
+ "totalConsumptionWh": 18540,
+ "totalInactivitySecs": 0,
+ "inactivityStatus": "I",
+ "totalDurationSecs": 11072,
+ "price": 2.5956,
+ "roundedPrice": 2.59,
+ "priceUnit": "EUR",
+ "pricingSource": "simple"
+ },
+ "id": 1234567890,
+ "values": [
+ {
+ "startedAt": "2019-06-12T06:49:46.000Z",
+ "endedAt": "2019-06-12T06:50:46.000Z",
+ "cumulatedAmount": 0.01344,
+ "cumulatedConsumptionWh": 96,
+ "cumulatedConsumptionAmps": 0.417391304348,
+ "instantWatts": 5760,
+ "instantWattsL1": 0,
+ "instantWattsL2": 0,
+ "instantWattsL3": 0,
+ "instantWattsDC": 0,
+ "instantAmps": 25.04347826087,
+ "instantAmpsL1": 0,
+ "instantAmpsL2": 0,
+ "instantAmpsL3": 0,
+ "instantAmpsDC": 0,
+ "instantVolts": 0,
+ "instantVoltsL1": 0,
+ "instantVoltsL2": 0,
+ "instantVoltsL3": 0,
+ "instantVoltsDC": 0,
+ "stateOfCharge": 0,
+ "limitAmps": 96,
+ "limitWatts": 22080
+ }
]
}
}
"schema": {
"type": "string"
}
+ },
+ "transactionID": {
+ "in": "path",
+ "name": "id",
+ "description": "Transaction ID",
+ "required": true,
+ "schema": {
+ "type": "string"
+ }
}
}
}

MODIFY
src/types/Server.ts
src/types/Server.ts
@@ -474,7 +474,7 @@ export enum ServerRoute {
REST_TRANSACTIONS = 'transactions/history',
REST_TRANSACTION = 'transactions/:id',
REST_TRANSACTIONS_IN_PROGRESS = 'transactions/status/inprogress',
- REST_TRANSACTIONS_CONSUMPTION = 'transactions/:id/consumption',
+ REST_TRANSACTIONS_CONSUMPTION = 'transactions/:id/consumptions',
REST_USERS = 'users',
REST_USER = 'users/:id',

Added consumption + getbyid endpoints