This morning I saw a question on StackOverflow that I had a look at. Basically, the person asking had tried to update an existing calendar entry – without success. As I have been playing a little with REST I thought I would give it a quick go. And correct, it couldn’t be done the way the person asking the question had tried.
So let’s get some basics in place:
- If you want to CREATE data you use a POST request.
- If you want to change INDIVIDUAL fields then you use a PATCH request
- If you want to update ALL fields in an extisting record/data set then you use a PUT request.
Being armed with this knowledge I started out trying with a PATCH approach… Long story short – the calendar service seem not to allow PATCH requests. So that one is out of the question. And having said that I have not found any places in the documentation stating that it would support PATCH methods. So all fine…
I then tried a PUT request and with a little playing around (and with the help of the documentation for Domino Access Services (DAS) 9.0.1) I made it work
First I specified the request with ALL fields from the result of either querying the event (or when creating it). Following subsequent tests I found that this is not necessary – but you have be aware of the defaults being added for the fields you do not specify – e.g. if you only specify a start time (as in the StackOwerflow question) you get the same end time… So you may want to specify all fields…
Example of a request:
“location”: “Main room”,
And then the important thing. In the PUT request you have to specify the FULL id (not just the UNID part) like:
And then it works!
If you want to know more about what you can do with REST services then come to ICON UK where I will give a presentation on REST Services.