Search code examples
xpageslotus-noteslotus-dominoxpages-extlib

XPages Extlib REST update (HTTP PUT) on calendar event is returning error code (cserror : 1028)


I am trying to update a calendar event in Domino Mail Calendar by using the REST data service "calendar" from the latest xpages extlib release "ExtensionLibraryOpenNTF-901v00_13.20150611-0803".

Has anybody done this with a successful return?

Unfortunately I haven't had any success trying to update a calendar event. I was successful getting the list of events, creating events, deleting an event, but to update an event seems to be somehow special. The PDF documentation for the calendar service is quite short on this point. My domino server is accepting all protocols including PUT. I am using the JSON format for my REST calls. The UPDATE I tried as described in the documentation with iCAL as well, but getting the same error.

I am using the Firefox REST Plugin for checking out the service, before I am implementing it.

Im using PUT, with content-type "text/calendar" as well "application/json".

My URL:

http://sitlap55.xyzgmbh.de:8080/mail/padmin.nsf/api/calendar/events/4D750E2B8159D254C1257E9C0066D48D

My Body looks like this, which is the easiest event type, a reminder (but I tried it with meeting and appointment as well):

{"events":[{"UID:"4D750E2B8159D254C1257E9C0066D48D","summary":"Ein Reminder update","start":{"date":"2015-08-13","time":"13:00:00","utc":true}}]}

This is how I return the event by a GET: { "href": "/mail/padmin.nsf/api/calendar/events/4D750E2B8159D254C1257E9C0066D48D-Lotus_Notes_Generated", "id": "4D750E2B8159D254C1257E9C0066D48D-Lotus_Notes_Generated", "summary": "Ein Reminder", "start": { "date": "2015-08-12", "time": "07:00:00", "utc": true }, "class": "public", "transparency": "transparent", "sequence": 0, "x-lotus-summarydataonly": { "data": "TRUE" }, "x-lotus-appttype": { "data": "4" } }

This is the error I get: { "code": 400, "text": "Bad Request", "cserror": 1028, "message": "Error updating event", "type": "text", "data": "com.ibm.domino.calendar.store.StoreException: Error updating event\r\n\tat com.ibm.domino.calendar.dbstore.NotesCalendarStore.updateEvent(NotesCalendarStore.java:229)\r\n\tat ... 65 more\r\n" }

The attributes in the body I tried a lot of different things, using the id, no id, an UID like in the calendar service doumentation, ...

What am I doing wrong here?



The solution:

Using the PUT method, the URL which worked looks like this:

 http://sitlap55.xyzgmbh.de:8080/mail/padmin.nsf/api/calendar/events/4D750E2B8159D254C1257E9C0066D48D-Lotus_Notes_Generated

the BODY looks like this:

{"events":[{"id":"4D750E2B8159D254C1257E9C0066D48D-Lotus_Notes_Generated","summary":"Some Reminder update #6","start":{"date":"2015-08-13","time":"10:00:00","utc":true}}]}

What I figured out was, that the "id" attribute is required ! a bit strange, because it is already in the URL.


Solution

  • I just checked against the documentation for Domino Access Services (DAS) 9.0.1 - and the example they have there actually works.

    I tried a few things before that, e.g. if I could PATCH (change individual fields) or PUT (change ALL fields) just specifying the non-system fields. None of these worked. But taking the response from creating (or getting) the event and put it into a PUT request and adjust e.g. start time works fine.

    Looking at your example I think the issue is similar as you do not include the end time in the request. But even so you seem to have to include the entire record as it is returned from the service - and please note that the url must end on the ENTIRE id (i.e. including "...-Lotus_Auto_Generated") :-)

    /John

    Edit:

    It seems you don't need to add all fields... But be aware of the side effects of not specifying fields... You need to test it for yourself!