Kevin Tyler
Kevin Tyler

Reputation: 37

Google List API PDF Upload with Java

I am looking to upload a PDF using the resumable upload mechanism. However, the web server is throwing a 403 exception which states: "Files must uploaded using the resumable upload mechanism." This is particularly frustrating, since, the resumable upload mechanism is what I'm using. I am able to change the file to a .txt and it works efficiently.

String contentType = DocumentListEntry.MediaType.fromFileName(file3.getName()).getMimeType();
System.out.println("This is break zero.");
MediaFileSource mediaFile = new MediaFileSource(file3, contentType);
System.out.println("This is break one.");
ResumableGDataFileUploader uploader =
      new ResumableGDataFileUploader.Builder(
          client, new URL("https://docs.google.com/feeds/default/private/full"), mediaFile, null /*empty meatadata*/)
          .title(mediaFile.getName())
          .chunkSize(DEFAULT_CHUNK_SIZE).executor(executor)
          .trackProgress(listener, PROGRESS_UPDATE_INTERVAL)
          .build();

Upvotes: 1

Views: 428

Answers (1)

Claudio Cherubino
Claudio Cherubino

Reputation: 15004

You should send the request to the resumable upload url, which is https://docs.google.com/feeds/upload/create-session/default/private/full.

Check the resumable upload documentation for more details: https://developers.google.com/gdata/docs/resumable_upload

Upvotes: 2

Related Questions