cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Update: Find information on Dropbox support during COVID-19 here
Close

Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Highlighted

Swifty Dropbox Batchupload

Explorer | Level 3

I am trying to write batchupload function in swifty, and it works. But I cant get access to async_job_id after I call uploadSessionFinishBatch.

 

client.files.uploadSessionFinishBatch(entries: finishArgArray).response{ response, error in
                    if let result = response {
                        print(result.description.)
                    }
            }

I can only access description and the output is something like this

 

{
    ".tag" = "async_job_id";
    "async_job_id" = "dbjid:AAAY5UFZ3gPJJn5Com802JjQl48zzD4YYMIXgdhD1ZL0ZnkPApGP4P9pr-_HLAHsIfSu2Jeov9sCpoL_kGuxshpt";
}

 

I would like to fetch the async_job_id field, so that I can check the status of batch upload. What is the right way of doing it in swift?

 

In Java I could do something like this

String asyncJobId =  dbxClient.files().uploadSessionFinishBatch(mFinishArgs).getAsyncJobIdValue();

 

1 Accepted Solution

Accepted Solutions
Highlighted

Re: Swifty Dropbox Batchupload

Dropboxer
Dropboxer

You can access the results job ID like this:

 

switch result {
case .none:
    print("Empty result")
case .some(let unwrappedResult):
    switch unwrappedResult {
    case .asyncJobId(let asyncJobId):
        print(asyncJobId)
    case .complete:
        print("Job is complete")
    }
}

Hope this helps! 

View solution in original post

2 Replies 2
Highlighted

Re: Swifty Dropbox Batchupload

Dropboxer
Dropboxer

You can access the results job ID like this:

 

switch result {
case .none:
    print("Empty result")
case .some(let unwrappedResult):
    switch unwrappedResult {
    case .asyncJobId(let asyncJobId):
        print(asyncJobId)
    case .complete:
        print("Job is complete")
    }
}

Hope this helps! 

View solution in original post

Highlighted

Re: Swifty Dropbox Batchupload

Explorer | Level 3

Thanks Greg, that worked. 

Since I hardly see any examples of batch upload, ill post my version here, i hope it helps.

 

https://gist.github.com/bazimogmbh/bba9ab300750a236d903709eeebf82b5

Polls
Do you know how to organize your files and folders?
We have created a guide on folder best practice, so you can get organized now check it out here.

Work Smarter with Dropbox

The way we work is changing. Share and discover new ways to work smarter with Dropbox in our community.

Sound good? Let's get started.
Who's talking

Top contributors to this post

What do Dropbox user levels mean?
Need more support?