Bug/Feature Request - 307 Redirect handling for ConnectIQ Web Requests

Former Member
Former Member
Hi,

I'm attempting to develop a Nest thermostat app using ConnectIQ but am hindered by the fact that the Nest API requires that a client handle 307 redirects. Web requests are sent from a Connect IQ device (In my case a fenix 3 watch) to google via the Garmin Connect App (In my case a Sumsung s6). I would expect the Connect App to automatically handle 307 redirects but unfortunately this is not the case. More critically, instead of returning a 307 response to the watch/device it returns a 401 with no response body... This makes it impossible to manually handle the redirect.

I'm using makeWebRequest:

Comms.makeWebRequest("developer-api.nest.com", {}, {
:method => Comms.HTTP_REQUEST_METHOD_GET,
:headers => {
"Content-Type" => Comms.REQUEST_CONTENT_TYPE_JSON,
"Authorization" => "Bearer " + token
},
:responseType => Comms.HTTP_RESPONSE_CONTENT_TYPE_JSON
}, method(:handleResponse));


Anyone have any success accessing an API that uses 307 redirects? Seems like a bug or at least a missing feature

Thanks
  • I agree this is probably a bug with the Garmin Connect Mobile app. That said this may be one of those cases where running your own web service might be useful anyway.

    I know that others have done it in the past for various reasons. The two big ones that I've seen are to reduce response data size (link from phone to watch is sssslllooooowwwww) and another is to handle sending and receiving message bodies that are well formed JSON but don't map well onto the API (ConnectIQ requires the response to be a JSON object, but it can legally be an object, array, number, string, true, false, or null according to the spec).

    By using your own service, you are adding some development cost and maintenance in exchange for additional control. If you are decent with python/java it shouldn't be too difficult to do, provided it doesn't violate the API license for the service you're accessing.

    Travis
  • Former Member
    Former Member over 7 years ago
    I'm having the same issue and, coincidentally, I'm also using the Nest API. I was hoping to avoid the custom api proxy route.
    Perhaps the simplest option is to return well-known headers in the data object (similar to how you register to receive well-known oauth params).
    Another option to follow redirects to the options Dictionary of Communications.makeWebRequest() would be preferable.

    My code:

    Comm.makeWebRequest( Lang.format("developer-api.nest.com/.../$1$", [camera["device_id"]]), { "is_streaming" => !camera["is_streaming"] }, // TODO verify this works on a real device - forums.garmin.com/.../145494 { :method => Comm.HTTP_REQUEST_METHOD_PUT, :headers => { "Authorization" => Lang.format("Bearer $1$", [accessToken]), "Content-Type" => Comm.REQUEST_CONTENT_TYPE_JSON } }, self.method(:onCameraEnableStreamingResponse) );
  • I've found the ticket for this and the GCM team is working on the fix.

    Thanks,
    -Coleman
  • Former Member
    Former Member over 7 years ago
    I've found the ticket for this and the GCM team is working on the fix.

    Thanks,
    -Coleman


    Thanks for letting us know. Is there an ETA or some issue we can follow along with?