cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Back again with another edition of 'How we use Dropbox', so find out how Emma uses to-do lists to get it all done here!

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: 

Uploading multiple file with session Typescript

Uploading multiple file with session Typescript

DavidM27
Explorer | Level 4

Hi,

I'm facing an issue with the UploadSessionFinishBatch method with TypeScript.

I'm having this error :

Error in call to API function \"files/upload_session/finish_batch\": request body: entries: unknown field 'contents

It seems like the "contents" parameter is not supposed to be here and makes the call crash. But in TypeScript the contents is required.

In some example I found on the web I've never seen the contents parameter. Is it a problem of type due to TypeScript SDK ? Or there is something I miss ?

Here is the code I use

const finishUploadBatchArg: DropboxTypes.files.UploadSessionFinishBatchArg = {
      entries: [],
    }

// For each file I do : 
const response = await this.dropBox.filesUploadSessionStart(uploadSessionStartArg)
        sessionId = response.session_id
        const cursor: DropboxTypes.files.UploadSessionCursor = {
          contents: file,
          offset:file.size,
          session_id: sessionId,
        }
        const commitInfo: DropboxTypes.files.CommitInfo = {
          contents: file,
          path: filePath,
          autorename: true,
        }

        const finishSessionArg = {
          contents : file, //This one is unknown from what I understand of the error I get
          cursor: cursor,
          commit: commitInfo,
        }
        finishUploadBatchArg.entries.push(finishSessionArg)
//Then I call the finish batch method : 
const response: DropboxTypes.files.UploadSessionFinishBatchLaunch = await this.dropBox.filesUploadSessionFinishBatch(finishUploadBatchArg)

By the way all the session start goes well.

Can you please help me on this ?

 

1 Reply 1

Re: Uploading multiple file with session Typescript

Greg-DB
Dropboxer

This appears to be a duplicate of this thread, so I'll close it and follow up with you there.

Poll
We love to learn from the educators who use Dropbox. Whether you teach kids, teens, adults or a combination of all three, we want to know what apps and integrations you use with Dropbox to help with teaching. Which of the ones below is your favorite, or most used tool?
Who's talking

Top contributors to this post

  • User avatar
    Greg-DB Dropboxer
What do Dropbox user levels mean?
Need more support?