Google 스프레드 시트를 사용하려고하지만 이해할 수없는 문제가 있습니다.Google 스프레드 시트 getFeed 오류 및 이해
SpreadsheetService service =
new SpreadsheetService("MySpreadsheetIntegration-v1");
service.setOAuth2Credentials(credential);
//service.setHeader("Authorization", "Bearer "+credential.getRefreshToken());
// TODO: Authorize the service object for a specific user (see other sections)
// Define the URL to request. This should never change.
URL SPREADSHEET_FEED_URL = new URL(
"https://spreadsheets.google.com/feeds/spreadsheets/private/full");
// Make a request to the API and get all spreadsheets.
SpreadsheetFeed feed = null;
try {
feed = service.getFeed(SPREADSHEET_FEED_URL, SpreadsheetFeed.class);
} catch (ServiceException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
List<SpreadsheetEntry> spreadsheets = feed.getEntries();
// Iterate through all of the spreadsheets returned
for (SpreadsheetEntry spreadsheet : spreadsheets) {
// Print the title of this spreadsheet to the screen
System.out.println(spreadsheet.getTitle().getPlainText());
}
난 할 노력하고있어하면 해당 변수 자격 증명 포인트 계정에서 스프레드 시트를 사용할 읽는 것입니다 : 나는 내 자신을 설명하기 전에
아래는 코드입니다. 나는 거기에 AccessToken과 RefreshToken을 둘 다 가지고있다.
나는 코드가 시도 캐치 다음과 같은 오류와 함께 캐치로 전환한다는 것입니다 실행하면 어떻게됩니까 :
Exception in thread "main" java.lang.NullPointerException: No authentication header information
at com.google.gdata.util.AuthenticationException.initFromAuthHeader(AuthenticationException.java:96)
at com.google.gdata.util.AuthenticationException.<init>(AuthenticationException.java:67)
at com.google.gdata.client.http.HttpGDataRequest.handleErrorResponse(HttpGDataRequest.java:608)
at com.google.gdata.client.http.GoogleGDataRequest.handleErrorResponse(GoogleGDataRequest.java:564)
at com.google.gdata.client.http.HttpGDataRequest.checkResponse(HttpGDataRequest.java:560)
at com.google.gdata.client.http.HttpGDataRequest.execute(HttpGDataRequest.java:538)
at com.google.gdata.client.http.GoogleGDataRequest.execute(GoogleGDataRequest.java:536)
at com.google.gdata.client.Service.getFeed(Service.java:1135)
at com.google.gdata.client.Service.getFeed(Service.java:998)
at com.google.gdata.client.GoogleService.getFeed(GoogleService.java:645)
at com.google.gdata.client.Service.getFeed(Service.java:1017)
at DriveCommandLine.main(DriveCommandLine.java:69)
당신은 내가 한 줄을 볼 수있는 내가, 서비스 변수의 기능을 연주했습니다 댓글을 달았습니다. 나는 RefreshToken 대신에 AccessToken을 시도해 보았지만 여전히 위에서 쓴 오류를 제공한다.
나는이 오류를 이해할 수 없다 : 그것은 어디서 비롯된 것인가? 왜 이런 일이 발생합니까? 어떻게 해결할 수 있습니까?
누군가 나를 도울 수 있다면 좋을 것입니다. 내가 가진다면 더 많은 정보를 가지고 돌아올거야.
코드의 어딘가에'xoauth_requestor_id'를 사용하고 있습니까? –
잘 모르겠습니다. 내가 어떻게 말할 수 있니? – FPJ
다음 페이지를 참조하십시오. https://groups.google.com/forum/?fromgroups=#!topic/google-documents-list-api/BdzYdNz6I3Q –