@@ -110,3 +110,18 @@ Also, we consider that if the heating or the hotwater are collective, we don't c
The method **fetchDJU(month:number)** tries to fetch the daily dju from the datagrandlyon API trough a remote doctype named _org.ecolyo.dju_.
The data returned by this API are gathered by the lyon-bron-sta The API returns dju by day for a given month, so we add them to return a monthly dju. If remote doctype fails or return a null value, we returns instead the default dju stored in _heating.json_
Usefull tips while working with this API :
- Do not pass a Content-Type while requesting, it will returns error
- While requesting from a cozy instance, if you get errors, you will get errors from the cozy stack and not directly from the API, which leads to weird cases :
- If there is an authentication error, the api will returns an error in _html_ format to cozy, so you'll get from cozy an error 502 as following, beacause cozy expects a json response :
```json
{
"status":"502",
"title":"Bad Gateway",
"detail":"the content-type for the response is not authorized",
"source":{}
}
```
- In case of bad request (wrong paramaters for example), the API will return an error in _xml_ format so you'll get exaclty the same error as above in your cozy instance.