Forum Discussion

Aadi12's avatar
Aadi12
Explorer | Level 4
3 years ago

Error, When using Batch Operation

hello, 
When I use batch operation like Create folder in batch
The operation perform but it show this kind of error 
Indivisual operation like Create folder, Copy File is working fine and give the JSON also but in Batch operation this error

Cannot convert to JSON, detail: Invalid tag: required Tag.COMPLETE, but was Tag.ASYNC_JOB_ID (through reference chain: com.dropbox.core.v2.files.CreateFolderBatchLaunch["completeValue"])




4 Replies

  • Rich's avatar
    Rich
    Icon for Super User II rankSuper User II
    3 years ago

    Aadi12 wrote:

    Error, When using Batch Operation


    Is this something you're doing through the Dropbox API? If so, I'll move your post to the appropriate section for help with the API.

  • Aadi12's avatar
    Aadi12
    Explorer | Level 4
    3 years ago

    Yes, I make Custom Snap Using API

     

  • Greg-DB's avatar
    Greg-DB
    Icon for Dropbox Community Moderator rankDropbox Community Moderator
    3 years ago

    Aadi12 It looks like you're using the Dropbox Java SDK to create some folders. When using createFolderBatch or createFolderBatchBuilder functionality, the resulting CreateFolderBatchLaunch may indicate either "launch an asynchronous job or complete synchronously". That being the case, you'll need to check which type it is before attempting to use it as that type.

     

    The error you're getting indicates that you're calling CreateFolderBatchLaunch.getCompleteValue on an object that isn't tagged as "complete". You should call CreateFolderBatchLaunch.isComplete first; only if that returns true should you then use CreateFolderBatchLaunch.getCompleteValue.

     

    You should likewise use CreateFolderBatchLaunch.isAsyncJobId to check if it is instead an async job ID, and if so then use CreateFolderBatchLaunch.getAsyncJobIdValue to get the value and use createFolderBatchCheck to check on the job.

     

    For example, if you're doing something like this:

    CreateFolderBatchLaunch createFolderBatchLaunch = client.files().createFolderBatch(foldersToCreate);

    Then just doing this would be incorrect, since you're not checking if the object is actually "complete" first:

    System.out.println(createFolderBatchLaunch.getCompleteValue());

    Instead, you need to do something like this:

    if (createFolderBatchLaunch.isComplete()) {
        System.out.println(createFolderBatchLaunch.getCompleteValue());
        // handle completed operation as desired...
    } else if (createFolderBatchLaunch.isAsyncJobId()) {
        System.out.println(createFolderBatchLaunch.getAsyncJobIdValue());
        // use createFolderBatchCheck to poll for the job status...
    } else {
        // fallback behavior...
    }

     

  • Aadi12's avatar
    Aadi12
    Explorer | Level 4
    3 years ago

    Thank you !. Error have resolved

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!