I’ve been working on a project where I need to duplicate Google Documents programmatically using the Java GWT API. I noticed that the REST API documentation mentions document copying functionality, but when I check the Java GWT library documentation, I can’t find any corresponding methods or classes that handle document duplication.
I’ve seen that other language APIs like Python have built-in methods for copying documents, but the Java GWT version seems to be missing this feature in the official documentation. Has anyone successfully implemented document copying in Java GWT? Maybe there’s an undocumented method or a workaround that I’m missing?
I’m specifically looking for something equivalent to what other APIs offer for document duplication. Any help or code examples would be greatly appreciated!
you can skip the gwt drive api entirely. just use requestbuilder with regular http requests and hit the rest endpoint directly. way easier than digging through those gwt wrapper classes.
Had the same authentication issues with Bob’s approach - direct REST calls from GWT client-side hit CORS restrictions hard unless you proxy everything through your server. I ended up using the Google API Client Library for Java on the backend instead of trying to do this in GWT frontend code. Just expose the duplication functionality through your own RPC service and call the Drive API from server-side Java where you get full access to all methods. Performance is way better too since you’re not making cross-origin requests from the browser. Create a simple service method that takes the document ID and returns the copied document’s metadata.
Had this exact problem six months ago building a document management system. The Java GWT API does support copying Google Docs, but you won’t find it in the Docs API - you need the Drive API part of the GWT library instead. Look for Drive.Files.Copy in the com.google.gwt.drive.client package. You’re copying the file container, not the document content itself. When you copy a Google Doc through Drive API, it duplicates everything - formatting, content, the works. Just make sure your OAuth scope has both drive.file and documents permissions. The method signature’s a bit weird if you’re used to other language APIs, but it works once you find it in the right namespace.