From 1fda746baea2ff3fcbc2402c4b2a28e69032290e Mon Sep 17 00:00:00 2001 From: "guilhem.carron" <gcarron@grandlyon.com> Date: Thu, 22 Jul 2021 11:12:46 +0200 Subject: [PATCH] Add infos on dju api debug --- docs/ecolyo/functionalities/profile_type.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/docs/ecolyo/functionalities/profile_type.md b/docs/ecolyo/functionalities/profile_type.md index 065bb70..4003506 100644 --- a/docs/ecolyo/functionalities/profile_type.md +++ b/docs/ecolyo/functionalities/profile_type.md @@ -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. -- GitLab