Dear All,

I am getting 401 error while adding a quick entry into google database
as explained in protocol guide.

But I could successfully get auth token and even get the calendar
entry feeds based on query parameters. Only problem is while trying to
create a new quick entry.

The following is the sample code with which I am trying to do. Can
anyone please help me where is problem.

Thanks & Regards
rainbow

sample code:
-----------------------------------------------------------
ttpURLConnection urlConnection = null;
                try {
                        urlConnection = (HttpURLConnection )new 
URL("http://www.google.com/
calendar/feeds/default/private/full").openConnection();
                } catch (MalformedURLException e) {
                        e.printStackTrace();
                } catch (IOException e) {
                        e.printStackTrace();
                }
                try {
                        urlConnection.setRequestMethod("POST");
                } catch (ProtocolException e) {
                        e.printStackTrace();
                }

                urlConnection.setRequestProperty("Authorization", "GoogleLogin
auth="+authToken);
                urlConnection.setRequestProperty("Content-Type", 
"application/atom
+xml");
                urlConnection.setRequestProperty("Content-Length", "5000");
                System.out.println("Opening output stream..");
                int responseCode = -1;
                try {
        urlConnection.setDoOutput(true);
        urlConnection.setDoInput(true);
        OutputStream outputStream = urlConnection.getOutputStream();
        outputStream.write(buf.toString().getBytes());
        outputStream.close();
             // Retrieve the output
             responseCode = urlConnection.getResponseCode();
             InputStream inputStream;
             if (responseCode == HttpURLConnection.HTTP_CREATED) {
      inputStream = urlConnection.getInputStream();
        System.out.println("Success..");
     } else {
      inputStream = urlConnection.getErrorStream();
      System.out.println("Failure.." + responseCode);
     }
--------------------------------------------------------


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

Reply via email to