Newer
Older
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
:construction: Section under Construction :construction:
## EGL Konnector
This konnector fetches consumptions 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".
You can clone the project [here](https://forge.grandlyon.com/web-et-numerique/llle_project/egl-konnector).
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://agence-rec.eaudugrandlyon.com](https://agence-rec.eaudugrandlyon.com/)
API Url for Production : [https://agence.eaudugrandlyon.com/ws](https://agence.eaudugrandlyon.com/ws)
## Authentication
In order to authenticate to the EGL API we have to request the following route
Method : **POST**
Authentication Route : **/connect.asp**
```json
"headers":
{
{
"AuthKey": <your-auth-key>,
"Content-Type": "application/x-www-form-urlencoded"
}
}
```
```json
"body":
{
"mode": "formdata"
{
"login": <your-login>,
"pass": <your-password>
}
}
```
Once you've sent this request the API should answer with a code 100 if everything is ok and provides you a valid **_token_** and **_num_abt_** that you will use later in order to get data.
```json
{
"codeRetour": 100,
"libelleRetour": "Connecté",
"resultatRetour": {
"num_abt": 1895683,
"token": "897555754A703055397897456568776E32704C3953514F5R"
}
}
```
## Fetch Data
In order to get data from the EGL API we have to request the following route :
Method : **POST**
Authentication Route : **/getAllAgregatsByAbonnement.aspx**
```json
"body":
{
"mode": "formdata"
{
"login": <your-login>,
"pass": <your-password>
}
}
```
```json
"body":
{
"mode": "formdata"
{
"token": "897555754A703055397897456568776E32704C3953514F5R",
"num_abt": 1895683,
"date_debut": MM/JJ/YYYY,
"date_fin": MM/JJ/YYYY
}
}
```
The dates must be valid dates otherwise you'll get an error
There answer will provides you an array of data day by day with the value got by the water meter 'ValeurIndex' at this moment.
```json
{
"codeRetour": 100,
"libelleRetour": "L'opération a réussi",
"resultatRetour": [
{
"DateReleve": "2020-07-01T00:00:00+02:00",
"TypeAgregat": "R",
"ValeurIndex": 562362
},
{
"DateReleve": "2020-07-02T00:00:00+02:00",
"TypeAgregat": "R",
"ValeurIndex": 562432
}
]
}
```
You'll have to subtract a day value with the previous's to get a consumption for a given day.
### TypeAgregats
- "R", means the real value
- "A", means an anomaly
- "D", means a water meter changing
- "V"
- "X"
- "T", means pending data
If you're looking for more information about the API, checkout the [complete API documentation](/documents/egl-api-doc.pdf)
### Usage
TODO : add explanation of how we manage data in the konnector