Hi Edurado,
I saw your posting on the forum about the Google Quick add
functionality. I just have a small doubt. Which URL do you post the
quick-add XML (atom) data to. I did the authentication and I am
getting the auth Token, now I am trying to set the developer key and
posting it to
http://www.google.com/calendar/feeds/default/private/basic. But I am
getting a 401 error on the URL. If you remember the URL or any
problems that you think i have, could you please send me the link.
Below is the snippet.
RL googleDefaultURL = new URL("http://www.google.com/calendar/feeds/
default/private/basic");
HttpURLConnection googleDefaultURLCon =
(HttpURLConnection)googleDefaultURL.openConnection();
googleDefaultURLCon.setDoInput(true);
googleDefaultURLCon.setDoOutput(true);
googleDefaultURLCon.setUseCaches(false);
googleDefaultURLCon.setRequestMethod("POST");
googleDefaultURLCon.setRequestProperty("Content-Type", "application/
atom+xml");
//googleDefaultURLCon.setRequestProperty( "User-Agent", "Mozilla/4.0
(compatible; MSIE 5.5; Windows NT 5.0; H010818)");
googleDefaultURLCon.setRequestProperty("Authorization", "GoogleLogin
auth=" + authToken);
googleDefaultURLCon.setRequestProperty("X-Google-Key", "key=" +
developerKey);
DataOutputStream googleOutputStream = new
DataOutputStream(googleDefaultURLCon.getOutputStream());
DataInputStream googleInputStream = new
DataInputStream(googleDefaultURLCon.getInputStream());
String quickAddData_String = "<?xml version=\'1.0\'?>\n" +
"<atom:entry xmlns:atom='http://www.w3.org/2005/Atom'>\n" +
"<atom:category scheme='http://schemas.google.com/g/2005#kind' " +
"term='http://schemas.google.com/g/2005#event'></atom:category>\n" +
"<atom:content type='text'>meeting at university of virginia tomorrow
8am</atom:content>\n" +
"<gCal:quickadd xmlns:gCal='http://schemas.google.com/gCal/2005' " +
"value='true'></gCal:quickadd>\n</atom:entry>";
byte[] quickAddData_bytes = quickAddData_String.getBytes();
googleOutputStream.write(quickAddData_bytes);
googleOutputStream.close();
System.out.println(googleInputStream.readLine());
googleInputStream.close();
And the error I get is
Exception in thread "main" java.io.IOException: Server returned HTTP
response code: 401 for URL:
http://www.google.com/calendar/feeds/default/private/basic?gsessionid=gLfSiRPeYQ4
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown
Source)
at QuickAddTest.main(QuickAddTest.java:94)
Thank you,
Chandra Sekhar
On Mar 13, 9:45 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
wrote:
> Thanks so much!
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google Calendar Data API" 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-calendar-help-dataapi?hl=en
-~----------~----~----~----~------~----~------~--~---