Need to see if your shared folder is taking up space on your dropbox 👨‍💻? Find out how to check here.

Forum Discussion

abhishek9851's avatar
abhishek9851
Explorer | Level 3
9 years ago
Solved

Swifty Dropbox Batchupload

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();

 

  • 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! 

2 Replies

Replies have been turned off for this discussion
  • Greg-DB's avatar
    Greg-DB
    Icon for Dropbox Community Moderator rankDropbox Community Moderator
    9 years ago

    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! 

About Dropbox API Support & Feedback

Node avatar for Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.

The Dropbox Community team is active from Monday to Friday. We try to respond to you as soon as we can, usually within 2 hours.

If you need more help you can view your support options (expected response time for an email or ticket is 24 hours), or contact us on X, Facebook or Instagram.

For more info on available support options for your Dropbox plan, see this article.

If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!