Help using makeWebRequest() please

I'd like to read in a GPX file using makeWebRequest().

I started with the webRequest sample app and got that to work.

I've created a GPX file for testing, placed in in a Google Drive, set sharing to anyone with the link, and verified with a browser that the link works to read the file.

I'm now trying to read that file using makeWebRequest() and I get a -400 error indicating "Response body data is invalid for the request type".

I've tried many combinations and variations in the options to the makeWebRequest() call. So far they all have returned -400.

Can someone provide a solution..... what combination of parameters to the makeWebRequest() call will let me read the file ?

Here's the code that makes the call:

//! Make the web request
private function makeRequest() as Void
{
_notify.invoke("Executing\nRequest");

var options =
{ :method => Communications.HTTP_REQUEST_METHOD_GET,
//:headers => { "Content-Type" => Communications.REQUEST_CONTENT_TYPE_JSON }, // URL_ENCODED },
:responseType => Communications.HTTP_RESPONSE_CONTENT_TYPE_JSON //TEXT_PLAIN // was TYPE_JSON
};


var reqStr = "">drive.google.com/.../view
System.println("request string = " + reqStr );

Communications.makeWebRequest( reqStr, {}, options, method(:onReceive) );

}

  • Hey Robin_

    I've found web pages and youtube videos that describe how to create a direct download link for OneDrive and DropBox.

    The DropBox solution I found works as described.

    So far I have not had success with OneDrive after following the instructions on several sites. All provide the same solution that results in an error -404.

    Can you point me to a solution that truly works with makeWebRequest() ?

    Thanks

  • it seems to be a simulator issue, just tried on mine works fine on the actual device, but throws a 404 error on the simulator so your probably doing it correctly, have you tested with side loading? 

  • Ahhh... very good news.

    I haven't tried it on a device. Since Google Drive and DropBox worked on the Simulator I got the sense that others would work as well. I'll try a sideload. 

    Thanks very much

  • Yup.... it works as expected on the device and not on the Simulator.

    Thanks again.

  • Any chance you know of a solution for iCloud Drive ?

    I've looked around and don't see anyone offering a solution.

    I can get a link that is supposed to share the file, but I get a -400 error which seems to indicate that Apple is rejecting the request.

    I get the same result with a sideload and on the simulator.

  • ICloud is known for being diffucult, are you using the generated link or did you capture the download link from the network traffic? i think unfortunately for icloud it's designed to not provide an easy option for direct links

    this is an example of a direct link captured through network traffic

    cvws.icloud-content.com/.../2hsp.pdf

  • Thanks Robin. I tried using a generated link. I'll check out the PDF you sent.

    Much appreciated.