How to get all files from all folders in JSON from Google Drive API in Java -
is there chance files in folders in json using google drive api, simple sending method?
yes, possible. can use files.list
. corresponding request, returns files default.
get https://www.googleapis.com/drive/v2/files
take closer here. there online demo test it.
the java code request this:
private static list<file> retrieveallfiles(drive service) throws ioexception { list<file> result = new arraylist<file>(); files.list request = service.files().list(); { try { filelist files = request.execute(); result.addall(files.getitems()); request.setpagetoken(files.getnextpagetoken()); } catch (ioexception e) { system.out.println("an error occurred: " + e); request.setpagetoken(null); } } while (request.getpagetoken() != null && request.getpagetoken().length() > 0); return result; }
Comments
Post a Comment