Can makeWebRequest receive simple text?

Hi all,

for my home automation system controlling widget GarminFhem, I would like to display some values from the system such as a temperature or a state of a (light) switch.

The HTTP request I intend use for this returns a simple text (response content-type = text/plain) with the requested value. I tried quite a lot of variants for calling the makeWebRequest, but is my assumption correct that returning "text" is not supported? I know that there is no constant for text in Communication.HTTP_RESPONSE_CONTENT_TYPE_*, but I somehow think that my use case is so simple that it should work.

Did manage to process a text response even if it was no JSON?

Thanks & regards,
Florian
  • No, the framework does not support receiving text data that is not formatted as a json object. According to the json spec, this is legal, but it is not properly handled by Garmin Connect Mobile. I reported this a while ago. The only way around it that I see is to do something to tell the server to provide a traditional json object (a dictionary), or to create your own local server that acts as a proxy and reformats the response.

    Travis
  • No, the framework does not support receiving text data that is not formatted as a json object. According to the json spec, this is legal, but it is not properly handled by Garmin Connect Mobile. I reported this a while ago. The only way around it that I see is to do something to tell the server to provide a traditional json object (a dictionary), or to create your own local server that acts as a proxy and reformats the response.

    Travis


    Thanks Travis, as always a fast and very helpful reply. I will stop my investigations and prototyping on Connect IQ side and focus on the FHEM server.

    Best regards,
    Florian