Hello Alain,

Problem solved. I used HTTP PUT instead of HTTP PATCH in Atom, and modified
the original event instead of create another instance of the object.

Thank you very much.

Best,
Chao Yang

On 6 September 2011 15:59, Alain Vongsouvanh <[email protected]> wrote:

> Hello,
>
> Please let me try to summarize what you are trying to do:
>   [1] Retrieve an entry from the Google Calendar API.
>   [2] Copy this entry to another instance and modify its start and end
> time.
>   [3] Send a PATCH request to modify the event.
>
> If this is correct, this is what you should do instead:
>   [1] Retrieve the entry from the Google Calendar API using the entry's
> self or edit link instead of the Atom ID.
>
>       CalendarEventEntry entry = myService.getEntry(new URL("<entry's self
> or edit link"), CalendarEventEntry.class);
>
>   [2] Modify the event without having to create another instance of the
> object.
>
>       entry.getTimes().get(0).setStartTime(DateTime.parseRfc822("<RFC833
> start time>"));
>
>       entry.getTimes().get(0).setEndTime(DateTime.parseRfc822("<RFC833
> start time>"));
>
>   [3] Send an 
> UPDATE<http://code.google.com/apis/calendar/data/2.0/developers_guide_java.html#UpdatingEvents>request
>  to the API using the updated event and the event's self or edit
> link.
>
>       CalendarEventEntry updatedEntry =
>
>           myService.update(new URL(entry.getEditLink().getHref()), entry);
>
> If you still want to use a PATCH request instead of an UPDATE request.
> please refer to the "Making a partial 
> update<http://code.google.com/apis/calendar/data/2.0/developers_guide_java.html#PartialUpdate>"
> section of the Java developer's guide.
>
> Best,
> Alain
>
> On Tue, Sep 6, 2011 at 7:32 AM, C. Yang <[email protected]> wrote:
>
>> Hello,
>>
>> I use the entry id of the event to retrieve the original event, which works 
>> well, clone it to a patch event, set start time and end time of the patch 
>> event, update the patch event to the original one. It occurs an error, which 
>> is printed in logcat of Eclipse as 
>> 'com.google.api.client.http.HttpResponseException: 500 Internal Server 
>> Error'.
>> Any operation of a event without time update is fine so far.
>>
>> But as long as the request contains an update of start time or end time, it 
>> returns a 500 Internal Server Error.
>> According to the documentation
>> http://code.google.com/apis/gdata/docs/2.0/reference.html#PartialUpdate, a 
>> PATCH request is available instead of PUT request,
>>
>> I have attached the Java file, the method with problem is 
>> executePatchEventRelativeToOriginal(). This problem is reported by many 
>> developers since April of this year.
>>
>> Please help.
>>
>> Thank you
>>
>>  --
>> 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://code.google.com/apis/calendar/community/forum.html
>>
>
>
>
> --
> Alain Vongsouvanh
>
>
>
>  --
> 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://code.google.com/apis/calendar/community/forum.html
>

-- 
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://code.google.com/apis/calendar/community/forum.html

Reply via email to