I am trying to use Communications.makeWebRequest() to get data from Google Spreadsheet like this
var url = "">docs.google.com/.../pub
var params = {
};
var options = {
:method => Communications.HTTP_REQUEST_METHOD_GET,
:headers => {
"Content-Type" => Communications.REQUEST_CONTENT_TYPE_URL_ENCODED
},
:responseType => Communications.HTTP_RESPONSE_CONTENT_TYPE_TEXT_PLAIN
};
Communications.makeWebRequest(url, params, options, method(:onReceive));
There are only a few responseTypes, which I can use in Garmin API and it is mentioned here https://developer.garmin.com/connect-iq/api-docs/Toybox/Communications.html
Basically, only these 2 for text content.
HTTP_RESPONSE_CONTENT_TYPE_TEXT_PLAIN (Content type "text/plain")
HTTP_RESPONSE_CONTENT_TYPE_JSON (Content type "application/json")
It works in simulator, but on Fenix 7 I received "-401" error. I read a lot of forum discussions about the same error. As I understand from all these discussions, Garmin API just return "-401" if content type returned by the server does not match responseType I set like this?
:responseType => Communications.HTTP_RESPONSE_CONTENT_TYPE_*
so, for me to read Google spreadsheet in CSV format, the only thing I can do is to contact Google and ask them to change Content-Type from what they return now ("text/csv") to "text/plain".
If I correctly understand this, then is there any workaround for this? Maybe setting something in monkey.jungle to make it less restrictive?