Я пытаюсь получить новые сообщения электронной почты на основе идентификатора истории из моего почтового ящика Gmail. Я делаю аутентификацию с использованием OAuth. Получено исключение неверного запроса с указанием причины сбойного условия. но я не могу понять, что мне нужно сделать здесь.
Ссылка - History.list
Вот фрагмент кода, получающий неправильное исключение запроса. Может ли кто-нибудь помочь мне в этом вопросе.
try {
History.List listRequest =
this.gmail
.users()
.history()
.list(userId)
.setMaxResults(SYNC_PAGE_SIZE)
.setStartHistoryId(new BigInteger(historyId))
.setHistoryTypes(Collections.singletonList(MESSAGE_ADDED_EVENT));
if (response != null) {
listRequest.setPageToken(((GmailPartialSyncResponse) response).getNextPageToken());
}
return new GmailPartialSyncResponse(listRequest.execute());
Я получаю исключение Bad RequestException с указанием причины «failedPrecondition», как показано ниже,
Подробности исключения: {"detailMessage": " myProject.exception.EmailMessageException: Не удалось получить сообщения электронной почты при частичной синхронизации c. "," причина ": {" detailMessage ":" Не удалось получить сообщения электронной почты при частичной синхронизации c. "," причина ": {" statusCode " : 400, "statusMessage": "Неверный запрос", "content": "{\ n \" code \ ": 400, \ n \" errors \ ": [{\ n \" domain \ ": \" global \ " ", \ n \" message \ ": \" Неверный запрос \ ", \ n \" причина \ ": \" failedPrecondition \ "\ n}], \ n \" message \ ": \" Неверный запрос \ "\ n} "," detailMessage ":" 400 неверных запросов \ n {\ n \ "code \": 400, \ n \ "errors \": [{\ n \ "domain \": \ "global \", \ n \ "message \": \ "Неверный запрос \", \ n \ "причина \": \ "failedPrecondition \" \ n}], \ n \ "message \": \ "Неверный запрос \" \ n} " , "stackTrace": [{"declaringClass": "com.google.api.client.googleapis. json .GoogleJsonResponseException", "methodName": "from", "fileName": "GoogleJsonResponseExcepti" on. java "," lineNumber ": 146}, {" declaringClass ":" com.google.api.client.googleapis.services. json .AbstractGoogleJsonClientRequest "," methodName ":" newExceptionOnError "," fileName " : "AbstractGoogleJsonClientRequest. java", "lineNumber": 113}, {"declaringClass": "com.google.api.client.googleapis.services. json .AbstractGoogleJsonClientRequest", "methodName": "newExceptionOnError", " fileName ":" AbstractGoogleJsonClientRequest. java "," lineNumber ": 40}, {" declaringClass ":" com.google.api.client.googleapis.services.AbstractGoogleClientRequest $ 1 "," methodName ":" interceptResponse "," fileName ":" AbstractGoogleClientRequest. java "," lineNumber ": 321}, {" declaringClass ":" com.google.api.client.http.HttpRequest "," methodName ":" execute "," fileName ":" HttpRequest . java "," li ...