I have an additional finding,

When I invoke getResourceId() on the created spreadsheetentry (through
the docsService) the api returns this:
0AlwWDkVdlmBedDR0VE5lejIzbWhmLUFEeDRsb1VYc2c
When I iterate through all SpreadSheets using the spreadsheetService
the getKey() method on the spreadsheetentry returns this: t4tTNez23mhf-
ADx4loUXsg

Why is this different and more importantly how to get the right
(second) keyValue through the docsService ?

Thanks

Michel



On 17 jan, 23:42, Michel Jonker <[email protected]> wrote:
> Hi,
>
> I can succesfull create a spreadsheet using the java api
>
> --- start doclist code ---
>
> DocsService docsService =new DocsService(applicationName);
> docsService.setProtocolVersion(DocsService.Versions.V3);
> docsService.setUserCredentials("AAA", "BBB");
> com.google.gdata.data.docs.SpreadsheetEntry newEntry  = new
> com.google.gdata.data.docs.SpreadsheetEntry();
> String spreadSheetTitle="test";
> newEntry.setTitle(new PlainTextConstruct(spreadSheetTitle));
> com.google.gdata.data.docs.SpreadsheetEntry spreadSheet =
> docsService.insert(new URL("https://docs.google.com/feeds/default/
> private/full/"), newEntry);
>
> --- end doclist code ---
> Next step would be to work with this spreadsheet using the spreadsheet
> API
>
> This code (I am trying to get a cellFeedUrl in two different ways):
> ---- start spreadsheet code -----------
>
> SpreadsheetService ssSvc = new SpreadsheetService(applicationName);
> ssSvc.setUserCredentials("AAA", "BBB");
> ssSvc.setProtocolVersion(SpreadsheetService.Versions.V3);
>
> FeedURLFactory urlFactory = FeedURLFactory.getDefault();
>
> URL cellFeedUrl =
> urlFactory.getCellFeedUrl(spreadSheet.getResourceId(), "od6",
> "private", "full"); //this is the spreadSheet object from above
>
> System.out.println(cellFeedUrl);
> cellFeedUrl = spreadSheet.getDefaultWorksheet().getCellFeedUrl(); //
> this is the spreadSheet object from above
> System.out.println(cellFeedUrl.toExternalForm());
> CellFeed cellFeed = ssSvc.getFeed(cellFeedUrl, CellFeed.class);
>
> ------------ end code ---------
> executing this code results in the log below.
> The first cellFeedUrl is wrong %3A doesnot make sense there, and even
> if it did, this URL doesn't in fact Locate a Unique Resource (I get an
> InvalidEntryException when I start working with this one)
> The second cellFeedUrl cannot be build, since aperently I the
> authentication is lost, but I just created the spreadsheet ?
> ----------- start log 
> ----------https://spreadsheets.google.com/feeds/cells/spreadsheet%3A0AlwWDkVdlm...
> 17-jan-2012 23:36:29
> com.google.appengine.repackaged.org.apache.http.impl.client.DefaultRequestD 
> irector
> handleResponse
> WARNING: Authentication error: Unable to respond to any of these
> challenges: {googlelogin=WWW-Authenticate: GoogleLogin 
> realm="https://www.google.com/accounts//ClientLogin";, service="wise"}
> com.google.gdata.util.AuthenticationException: OK
> <HTML>
> <HEAD>
> <TITLE>Token invalid</TITLE>
> </HEAD>
> <BODY BGCOLOR="#FFFFFF" TEXT="#000000">
> <H1>Token invalid</H1>
> <H2>Error 401</H2>
> </BODY>
> </HTML>
>
>         at
> com.google.gdata.client.http.HttpGDataRequest.handleErrorResponse(HttpGData 
> Request.java:
> 600)
>         at
> com.google.gdata.client.http.GoogleGDataRequest.handleErrorResponse(GoogleG 
> DataRequest.java:
> 563)
>         at
> com.google.gdata.client.http.HttpGDataRequest.checkResponse(HttpGDataReques 
> t.java:
> 552)
>         at
> com.google.gdata.client.http.HttpGDataRequest.execute(HttpGDataRequest.java :
> 530)
>         at
> com.google.gdata.client.http.GoogleGDataRequest.execute(GoogleGDataRequest. 
> java:
> 535)
>         at com.google.gdata.client.Service.getEntry(Service.java:1352)
>         at com.google.gdata.client.GoogleService.getEntry(GoogleService.java:
> 567)
>         at com.google.gdata.client.Service.getEntry(Service.java:1278)
>         at
> com.google.gdata.data.docs.SpreadsheetEntry.getDefaultWorksheet(Spreadsheet 
> Entry.java:
> 123)
>
> --- end log ---

Reply via email to