Skip to content
Snippets Groups Projects
Commit 080141b0 authored by Pierre Ecarlat's avatar Pierre Ecarlat
Browse files

Merge branch '16-update-egl-section-with-efluid-api' into 'master'

feat: Add EGL efluid API documentation

See merge request !87
parents 89d9ff69 330cbe14
No related branches found
No related tags found
1 merge request!87feat: Add EGL efluid API documentation
Pipeline #115021 passed
# EGL - efluid API (2025)
[EGL repository](https://forge.grandlyon.com/web-et-numerique/factory/llle_project/egl-konnector).
This konnector fetches consumption measures from the efluid API from EGL.
The EGL API allows us to get a user's consumption data gathered by it's connected water meter "Téléo".
You should also check Cozy's official documentations for konnectors :
[https://docs.cozy.io/en/tutorials/konnector/getting-started/](https://docs.cozy.io/en/tutorials/konnector/getting-started/)
- API Url for Development : [https://prepro-epgl-ecolyo-efluidconnect.multield.net](https://prepro-epgl-ecolyo-efluidconnect.multield.net)
- API Url for Production : Not defined yet
## Update or create data
This konnector updates data if it has changed since the last execution or creates a new entry if the data is new. It also updates month and year aggregates except for start month and start year to prevent overriding data if user has more than 3 years of data.
For this we use a combinaison of the hydrateAndFilter function and the updateOrCreate function.
## Authentication
In order to authenticate to the EGL API we have to request the following route
Method : **POST**
Authentication Route : **/login**
```json
"body":
{
"user": "<epgl-user>",
"password": "<epgl-password>"
}
```
Once you've sent this request the API should answer with a code 200 and a token in the response header, under the variable name `EFLUIDCONNECT_TOKEN`.
## Identification
Using the `EFLUIDCONNECT_TOKEN` header, the path to identify the user is available
Method : **POST**
Authentication Route : **/acteurs/rechercherClientParCompteur**
```json
"body":
{
"refContrat": "<contract-number>",
"refCompteur": "<metering-id>"
}
```
This path returns either:
- `Status 200`: If the contract number does match the metering ID
- `Error 500`: If they do **not** match
## Fetch Data
:::warning
The earliest data that can be fetched is January 2024 due to the novelty of the API
:::
This path still requires `EFLUIDCONNECT_TOKEN` header
Method : **POST**
Data Route : **/contrats/consommationsJournalieres**
```json
"body":
{
"refContrat": "<contract-number>",
"refCompteur": "<metering-id>",
"dateDebut": "2023-12-31T22:00:00.000Z",
"dateFin": "2024-12-31T22:00:00.000Z"
}
```
The dates must be valid dates otherwise you'll get an error. They also should be in GMT-1.
The answer will provide you an array of data day by day with the value got by the water meter 'consommation'. The month value in the response data goes with values from 0 to 11. An example of the returned format with two days fetched can be found below:
```json
{
"postes": [
{
"libelle": "toutes heures",
"data": [
{
"consommation": 654,
"index": 12645,
"debitMin": 20,
"volumeEstimeFuite": 30,
"jour": 1,
"mois": 1,
"annee": 2024
},
{
"consommation": 600,
"index": 13245,
"debitMin": 20,
"volumeEstimeFuite": 30,
"jour": 2,
"mois": 1,
"annee": 2024
}
]
}
],
"unites": {
"consommation": "m3",
"index": "m3",
"debitMin": "L/h",
"volumeEstimeFuite": "L"
}
}
```
# EGL
# EGL - Veolia API (2024)
[EGL repository](https://forge.grandlyon.com/web-et-numerique/factory/llle_project/egl-konnector).
:::danger Deprecated version
This documentation details the technical implementation of the old konnector for EGL, using the Veolia API. A new version has been made based on the Efluid API, that planned to be released starting January 2025.
:::
[EGL repository, version v1.3.1](https://forge.grandlyon.com/web-et-numerique/factory/llle_project/egl-konnector/-/tree/v1.3.1).
This konnector fetches consumption measures from EGL API.
The EGL API allows us to get a user's consumption data gathered by it's connected water meter "Téléo".
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment