Skip to content
Snippets Groups Projects

feat: Add EGL efluid API documentation

2 files
+ 128
2
Compare changes
  • Side-by-side
  • Inline

Files

+ 120
0
# 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"
}
}
```
Loading