i am trying to add an event to my google calendar:
/*http post body*/
Request req = new Request();
/*an entry sample on google api websit , to represent the body of the
message*/
final StringBuilder builder = new StringBuilder();
builder.append("<entry xmlns='http://www.w3.org/2005/Atom' xmlns:gd='
http://schemas.google.com/g/2005'>");
builder.append("<category scheme='http://schemas.google.com/g/2005#kind'
term='http://schemas.google.com/g/2005#event'></category>");
builder.append("<title type='text'>Tennis with Beth</title>");
builder.append(" <content type='text'>Meet for a quick
lesson.</content><gd:transparency value='
http://schemas.google.com/g/2005#event.opaque'> </gd:transparency>");
builder.append(" <gd:eventStatus value='
http://schemas.google.com/g/2005#event.confirmed'> </gd:eventStatus>");
builder.append(" <gd:where valueString='Rolling Lawn Courts'></gd:where>");
builder.append(" <gd:when startTime='2010-03-17T15:00:00.000Z'
endTime='2010-04-17T17:00:00.000Z'></gd:when></entry>");
String b = builder.toString();
HashMap<String ,String> headers = new HashMap<String,String>();
/*including the authentication token to the message header*/
headers.put(Constant.GTOKEN_AUTH_HEADER_NAME ,
Constant.GTOKEN_AUTH_HEADER_VALUE_PREFIX+mTokenValue);
/* my post request containing the url, + media type + body and headers*/
Response re = req.postRequest ("
http://www.google.com/calendar/feeds/default/private/full",
"application/atom+xml", b , headers);
/*post request method*/
public Response postRequest (String url, String contentType, String body,
Map <String, String> headers) throws ClientProtocolException,IOException
{
HttpPost post = new HttpPost (url);
post.setHeader (HTTP.CONTENT_TYPE, contentType);
if (headers != null) {
for (Entry <String, String> e : headers.entrySet()) {
post.addHeader (e.getKey (), e.getValue ());
}
}
post.setEntity (new StringEntity (body));
return postRequest (post);
}
having sent the message to google server, i got status code 200 together
with a feed containing all the existing events and my event is not created,
according to the google api i suppose to get status code 201 created.
On Thu, Mar 4, 2010 at 6:28 PM, Hekki <[email protected]> wrote:
> Well don't thank me, we still don't have a clue what problem you are
> trying to solve.
>
> Yahel
>
> --
> 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]<android-developers%[email protected]>
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>
--
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