java - Valid values for setFields in Google Drive API -
i've taken following code google documentation.
public static void detectdrivechanges() throws ioexception { startpagetoken response = drive.changes() .getstartpagetoken().execute(); string savedstartpagetoken = response.getstartpagetoken(); system.out.println("start token: " + savedstartpagetoken); // begin our last saved start token user or // current token getstartpagetoken() string pagetoken = savedstartpagetoken; while (pagetoken != null) { changelist changes = drive.changes().list(pagetoken) .setfields("*") .execute(); (change change : changes.getchanges()) { // process change system.out.println("change found file: " + change.getfileid()); } if (changes.getnewstartpagetoken() != null) { // last page, save token next polling interval savedstartpagetoken = changes.getnewstartpagetoken(); } pagetoken = changes.getnextpagetoken(); } }
the .setfields("*") causes following bad request response.
exception in thread "main" com.google.api.client.googleapis.json.googlejsonresponseexception: 400 bad request { "code" : 400, "errors" : [ { "domain" : "global", "message" : "bad request", "reason" : "badrequest" } ], "message" : "bad request"
if change * in setfields text invalid parameter. if remove altogether no errors. i've googled try determine possible parameters setfields in case haven't found anything.
where find list of possible parameters setfields in instance?
why above code fail when setfields set *
i'm using following dependency
<dependency> <groupid>com.google.apis</groupid> <artifactid>google-api-services-drive</artifactid> <version>v3-rev40-1.22.0</version> </dependency>
regards conteh
the setfield
drive api used partial responses, depend on data want part of returned object.
setting "*" on won't work since doesn't represent field in response
object. work, either not set fields values, or specify fields necessary (depends on api you're calling, changelist, can changes
, nextpagetoken
, newstartpagetoken
, kind
Comments
Post a Comment