You might see that the Dropbox Community team have been busy working on some major updates to the Community itself! So, here is some info on what’s changed, what’s staying the same and what you can expect from the Dropbox Community overall.
Forum Discussion
DboxDeveloper
8 years agoExplorer | Level 3
Objective C batchUploadFiles gives error: "missing required field 'session_id'" or "Garbage at end."
Hi,
I am getting the error
DropboxBadInputError[{
ErrorContent = "Error in call to API function \"files/upload_session/finish_batch\": request body: entries.cursor: missing required ...
- 8 years agoThanks! This is very helpful. I'm able to reproduce this now. We're looking into it.
We have a rough idea of what's occurring, though not exactly why it's occurring yet. One thing that may be relevant though is that for some calls, you're using `setProgressBlock` and checking `if (totalBytesUploaded == totalBytesExpectedToUploaded` to see if the operation is complete. You should always use the response block (e.g., `setResponseBlock` for most calls, or passed as a parameter for `batchUploadFiles`) to know when the operation completed and then carry on with your next steps.
Please try making that change and let me know if it does or doesn't help. Thanks!
DboxDeveloper
Explorer | Level 3
Ok I've created an entirely new project but I still get the problem. I've publish this sample project in github and I've published the sample photos that I use to test the problem so you can put the sample photos into the document's folder of the app.
https://github.com/git-tyl/DropboxTestProblem
https://github.com/git-tyl/DropboxTestProblem
Greg-DB
8 years agoDropbox Staff
Thanks! This is very helpful. I'm able to reproduce this now. We're looking into it.
We have a rough idea of what's occurring, though not exactly why it's occurring yet. One thing that may be relevant though is that for some calls, you're using `setProgressBlock` and checking `if (totalBytesUploaded == totalBytesExpectedToUploaded` to see if the operation is complete. You should always use the response block (e.g., `setResponseBlock` for most calls, or passed as a parameter for `batchUploadFiles`) to know when the operation completed and then carry on with your next steps.
Please try making that change and let me know if it does or doesn't help. Thanks!
We have a rough idea of what's occurring, though not exactly why it's occurring yet. One thing that may be relevant though is that for some calls, you're using `setProgressBlock` and checking `if (totalBytesUploaded == totalBytesExpectedToUploaded` to see if the operation is complete. You should always use the response block (e.g., `setResponseBlock` for most calls, or passed as a parameter for `batchUploadFiles`) to know when the operation completed and then carry on with your next steps.
Please try making that change and let me know if it does or doesn't help. Thanks!
- DboxDeveloper8 years agoExplorer | Level 3
You were right, it was the completetion code being put into the progressblock. Its now working. Many thanks.
I've updated the new code
- rharter8 years agoNew member | Level 2
I'm actually receiving the same error, but I've got the correct code in the response block (I think). It doesn't seem to happen on the first batch upload call during a run, but the second upload attempt seems to fail pretty consistently. Here's my code, if it helps.
[self.fileRoutes batchUploadFiles:filesToUpload queue:self.fileUploadQueue progressBlock:^(int64_t uploaded, int64_t uploadedTotal, int64_t expectedToUploadTotal) { if (fileSize.intValue > 0) { float progress = (float) uploadedTotal / fileSize.longLongValue; photo.uploadProgress = progress; } } responseBlock:^(NSDictionary<NSURL *, DBFILESUploadSessionFinishBatchResultEntry *> *fileUrlsToBatchResultEntries, DBASYNCPollError *finishBatchRouteError, DBRequestError *finishBatchRequestError, NSDictionary<NSURL *, DBRequestError *> *fileUrlsToRequestErrors) { DBFILESUploadSessionFinishBatchResultEntry *result = fileUrlsToBatchResultEntries[srcPath]; if (result.isSuccess) { [self uploadedFile:destPath from:srcPath.absoluteString metadata:result.success]; } else { NSMutableDictionary *userInfo = [[NSMutableDictionary new] autorelease]; userInfo[@"path"] = srcPath.absoluteString; if (fileUrlsToRequestErrors) { NSMutableDictionary<NSURL *, NSString *> *errors = [[NSMutableDictionary new] autorelease]; for (NSURL *key in fileUrlsToRequestErrors.allKeys) { errors[key] = fileUrlsToRequestErrors[key].errorContent; } userInfo[@"fileErrors"] = errors; } if (finishBatchRouteError) { userInfo[@"routeError"] = finishBatchRouteError.description; } if (finishBatchRequestError) { userInfo[@"requestError"] = finishBatchRequestError.errorContent; } // TODO Handle conflicts here if (result.failure.isPath){ if (result.failure.path.isConflict) { // TODO Handle This DLog(@"Conflicting filename: %@, %@", photo.filename, result.failure.path.conflict) } } NSError *err = [NSError errorWithDomain:@"my.app" code:0 userInfo:userInfo]; [self uploadFileFailedWithError:err]; } }];
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
5,910 PostsLatest Activity: 4 days agoIf 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 or Facebook.
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!