Hi, Is this ClientLogin or AuthSub?
You'll need an auth token that is valid for the Spreadsheets and Documents List API to download both documents/presentations AND spreadssheets. In AuthSub, that's just requesting a token with: scope=http://spreadsheets.google.com/feeds+http://docs.google.com/ feeds/ and hitting the appropriate Export URI. With ClientLogin, it's a bit tricker. You need to instantiate a service object for both DocsService and SpreadsheetsService. The sample app does that: http://code.google.com/p/gdata-java-client/source/browse/trunk/java/sample/docs/DocumentList.java#156 See the download code where it switches between services (and therefore, tokens): http://code.google.com/p/gdata-java-client/source/browse/trunk/java/sample/docs/DocumentList.java#553 Eric On Mar 2, 1:03 am, "[email protected]" <[email protected]> wrote: > I build this http call to download a generic file. > It works with documents and presentations but not with spreadsheets. > I know that spreadsheets have a different address > (spreadsheets.google.com). > I control the entire url and it's correct and equal to API. > When I try to download I retrieve a pages that suggests me to make an > account. > The response code is 200. > I try to substitute the part where I retrieve the Input stream from > the call with service.getStreamFromLink(link) but the response is a > moved error from something that I don't know what it is because the > file exits. > Please help me because I don't understand where the problem is. > Sorry for my English. > > // Retrieve connection to the feed of the document to download > conn = (HttpURLConnection) > documentFeedUrl.openConnection(); > > /* > * The HttpAuthToken represents a token used to > authenticate an > HTTP > * request. It encapsulates the functionality to > create the > * "Authorization" header to be appended to a HTTP > request. Here we > * retieve this token, which is related to the service > */ > HttpAuthToken authToken = (HttpAuthToken) service > .getAuthTokenFactory().getAuthToken(); > > // Create the "Authorization" header related to this > feed to be > // appended to HTTP request > String header = > authToken.getAuthorizationHeader(documentFeedUrl, > "GET"); > > // Attach the header > conn.setRequestProperty("Authorization", header); > // Attach user agent > conn.setRequestProperty("User-Agent", > DEFAULT_USER_AGENT); > > // Send the http request > conn.connect(); > > // Map the connection to a stream > InputStream is = conn.getInputStream(); > > // Read the response, download implementation > httpToFile(is); > > // Retrieve response code > responseCode = conn.getResponseCode(); > > conn.disconnect(); --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google Docs Data APIs" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/Google-Docs-Data-APIs?hl=en -~----------~----~----~----~------~----~------~--~---
