Ticket Created
over 1 year ago

CIQQA-1662

Bug report: ConnectIQ Api & web request via GCM iOS is not passing http response as plain text

Hello ConnectIQ team,

I use makeWebRequest to proceed an auth process of an oAuth API, where I have to read an bearer token from the WebAPI.

The API responds the token as a JSON value type string. It's not possible to read that value as JSON dictionary. But with the GarminConnect app on a Android phone it's possible to use the parameter HTTP_RESPONSE_CONTENT_TYPE_TEXT_PLAIN to get the http response as plain text to read the bearer token from.

With the GCM app on a iPhone it's not possible. The ConectIQ API returns error code -400 independent of the response type parameter.

As it's not possible to read JSON values from a application/json response body, it's necessary to be able to read the body as plain text and parse it in the app. That's the only possibility to handle WebAPIs not following the ConnectIQ rules.

Please add the possibility of reading plain text responses using the makeWebRequest parameter HTTP_RESPONSE_CONTENT_TYPE_TEXT_PLAIN on iOS platform like on Android.

Many thanks. That will help many developers dealing with WebAPIs which are not completely compatible to the ConnectIQ rules.

Referenze thead with examples:

https://forums.garmin.com/developer/connect-iq/f/discussion/310015/webrequest-how-to-ignore-wrong-response-content-type#pifragment-1298=2

Kind regards

Ronny Winkler

  • Ronny-

    This issue is not currently scheduled. I do not expect that to change any time soon.

  • Hello
    any news after a month?

    Regards
    Ronny

  • This issue is not currently scheduled.

  • Hello ,
    do you have an update regarding the ticket?
    If there is anything I can do/help, please let me know.

    Regards

    Ronny

  • One solution would be to use the parameter Communications.HTTP_RESPONSE_CONTENT_TYPE_TEXT_PLAIN to force the SDK to provide the response body as plain text and the app can parse it as string.

    Yes, this is the Android hack that you're currently hoping will work solve your problem. A fix to the iOS app would allow this to work for iOS.

    That would be the easiest solution. This will need an update for the iOS app, right? If it's the easiest/fastest solition then I would be for it.

    Another aproach can be that the SDK will wrap simple JSON values into a JSON object like {body: "JSON string"}. Then the app can handle it as a regular JSON object.

    Yes, this would also work, but then the payload that we give is not the same as the payload that we receive. Developers would need to be aware of this and deal with it internally. Still better than not working at all, but not great.

    This is the comfortable way because then you can read the JSON object directly without parsing.
    And nobody is affected because these results won't work today (exept using an external proxy). But also in that case the devs wil be happy to get the response directly.
    What will be affected on your side? Both app versions for Android/iOS or the devices, too?

    I would be happy with both variants. It depends on what causes less effort.