We are aware of the issue with the badge emails resending to everyone, we apologise for the inconvenience - learn more here.

Forum Discussion

Peter G.7's avatar
Peter G.7
New member | Level 2
9 years ago

[request-id 953b09474eb624414a4a43c7eeabc88c] API route error - { ".tag" = path; path = { ".tag" = "not_file"; };

I am trying to download a file using SwiftyDropbox.   I can connect to Dropbox ok and I can access my Dropbox files, but I cannot download files.  My code:

        let client = Dropbox.authorizedClient

        let destination : (NSURL, NSHTTPURLResponse) -> NSURL = { temporaryURL, response in

            let fileManager = NSFileManager.defaultManager()

            let directoryURL = fileManager.URLsForDirectory(.DocumentDirectory, inDomains: .UserDomainMask)[0]

            let UUID = NSUUID().UUIDString

            let pathComponent = "\(UUID)-\(response.suggestedFilename!)"

            return directoryURL.URLByAppendingPathComponent(pathComponent)

        }

        let fromPath = "/Panther4/\(filenameX)"

        let toPath = destination

        

        client!.files.download(path: fromPath, destination: toPath).response { response, error in

            if let (metadata, data) = response {

                print("Dowloaded file name: \(metadata.name)")

                print("Downloaded file data: \(data)")

            } else {

                print(error!)

            }

        }

and the error I get is: 

[request-id 953b09474eb624414a4a43c7eeabc88c] API route error - {

    ".tag" = path;

    path =     {

        ".tag" = "not_file";

    };

}

Any help would be appreciated.

  • Peter G.7's avatar
    Peter G.7
    New member | Level 2

    A follow up.......I am able to upload and download individual files, but I need to be able to upload and download folders.  I have tried numerous path configurations, to no avail. I am sure the answer is right in front of my face.....

  • Greg-DB's avatar
    Greg-DB
    Icon for Dropbox Staff rankDropbox Staff

    Peter, the Dropbox API doesn't offer a way to download entire folders at once like this, but I'll be sure to pass this along as a feature request. That being the case, you'll need to loop through the files you need and download each of them.

    Pouria, if the above resolve the issue you're having, please open a new thread with the details of the problem you're seeing.