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
-~----------~----~----~----~------~----~------~--~---