Download File fails - REST API

I can successfully upload and download a file using the standard Backendless API REST endpoints.

The problem is using the save Files from Byte Arrays API and then downloading with the same download function that worked in the process above.

In cURL i get an unsupported protocol error code.

All the http headers for the download are the same. Help?

Hi Roy!

Could you provide an example of your request for download?
Regards,
Kate.

URL = https://api.backendless.com/85640F83-1394-1E16-FFF8-1DCE458CAE00/v1/files/temp/file2.txt

HTTP Headers

application-id: 856…
secret-key: C0…
user-token: 25E34935-A092-6BAD-FFBF-BFE5EA3FEF00
application-type: REST

I got a 2.1MB file for that link

Must be something I’m not doing properly during the setup of the download file request. Will investigate…

I found the problem on my end. The URL returned from calling the regular File upload is for example:

{“fileURL”:“https://api.backendless.com/<AppID>/v1/files/directory1/file_ABCDEQRSTUVWX123456789__1.dat”}

The URL returned from the “Save Files From Byte Arrays” API is:

https://api.backendless.com/<AppID>/v1/files/directory1/file_ABCDEQRSTUVWX123456789__1.dat”

The first is a JSON object that when the data item for “fileURL” is parsed by the JSON class, it treats it as a string and no quotes are contained in the extracted string. (e.g. https://api.backendless.com/<AppID>/v1/files/directory1/file_ABCDEQRSTUVWX123456789__1.dat)

The download file API URL expects a string to be a URL that doesn’t have any leading or trailing quotes. So, by deleting the leading or trailing quotes before calling my common download file API function, the downloading a file works in both of the cases mention previously.