I'm new to Google web services and not sure why my request is not
going through. I'm able to get my Auth token no problem using the
following code:

HttpClient client = new DefaultHttpClient();
String postURL = "https://www.google.com/accounts/ClientLogin";;
HttpPost post = new HttpPost(postURL);
List<NameValuePair> params = new ArrayList<NameValuePair>();
params.add(new BasicNameValuePair("Email",
"[email protected]"));
params.add(new BasicNameValuePair("Passwd", "XXXXXX"));
params.add(new BasicNameValuePair("service", "cl"));
params.add(new BasicNameValuePair("accountType", "GOOGLE"));

UrlEncodedFormEntity ent = new
UrlEncodedFormEntity(params,HTTP.UTF_8);
post.setEntity(ent);
HttpResponse responsePOST = client.execute(post);
HttpEntity resEntity = responsePOST.getEntity();
if (resEntity != null) {
    String response = EntityUtils.toString(resEntity);
    authKey = response.substring( response.indexOf("Auth="),
response.length());
    authKey = authKey.replace( "Auth=","" );
 }


Then, I'm trying to make a simple call to get all the calendars for
[email protected]. As far as I know, it should be a simple GET to
https://www.google.com/calendar/feeds/default/allcalendars/full making
sure to set the header as get.setHeader("Authorization", "GoogleLogin
auth=" + authKey );. This is what I have:

HttpClient client = new DefaultHttpClient();
String getURL = "https://www.google.com/calendar/feeds/default/
allcalendars/full";
HttpGet get = new HttpGet(getURL);
get.setHeader("Authorization", "GoogleLogin auth=" + authKey );
get.setHeader("Content-Type", "application/atom+xml");
HttpResponse responseGet = client.execute(get);
HttpEntity resEntityGet = responseGet.getEntity();
if (resEntityGet != null) {
    String response = EntityUtils.toString( resEntityGet );
}

When this code is executed, however, I'm getting a "400 Bad Request"
and then farther down it says "Your client has issued a malformed or
illegal request." Can anybody please help me with this?

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" 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/android-developers?hl=en

Reply via email to