Google documentationから次のコードを取得しました。以下の不正な要求応答を引き起こしGoogleドライブAPIのsetFieldsの有効な値
public static void detectDriveChanges() throws IOException {
StartPageToken response = DRIVE.changes()
.getStartPageToken().execute();
String savedStartPageToken = response.getStartPageToken();
System.out.println("Start token: " + savedStartPageToken);
// Begin with our last saved start token for this user or the
// current token from getStartPageToken()
String pageToken = savedStartPageToken;
while (pageToken != null) {
ChangeList changes = DRIVE.changes().list(pageToken)
.setFields("*")
.execute();
for (Change change : changes.getChanges()) {
// Process change
System.out.println("Change found for file: " + change.getFileId());
}
if (changes.getNewStartPageToken() != null) {
// Last page, save this token for the next polling interval
savedStartPageToken = changes.getNewStartPageToken();
}
pageToken = changes.getNextPageToken();
}
}
.setFields( "*")。
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"
setfieldsの*をtextに変更すると、無効なパラメータが返されます。私がそれを完全に取り除くと、私は間違いがない。私は可能なパラメータがこのケースではsetFieldsのためにあるものを決定しようとしましたが、私は何も見つけられませんでした。
このインスタンスでは、setFieldsの可能なパラメータのリストはどこにありますか?
setFieldsがに設定されているのに、なぜ上記のコードは失敗しない*
私は、ドライブのAPIのためのsetField
が部分的に使用され、次の依存関係
<dependency>
<groupId>com.google.apis</groupId>
<artifactId>google-api-services-drive</artifactId>
<version>v3-rev40-1.22.0</version>
</dependency>
よろしく Conteh
どこで答えますか? – xenteros