CalDAV client for iClouds: MKCALEDAR requests stopped working and fail with 412 Precondition Failed











up vote
0
down vote

favorite












I developed a client for iCloud calendar service that uses CalDAV protocol. I use caldav4j library for Java, however the problem I encountered is language/library independent.
Several days ago creating of new calendars in my client stopped working. Now, I get 412 Precondition Failed status code while sending MKCALENDAR requests to iCloud. Other operations, like getting list of calendar resources, getting events, creating and updating events work the same as before.



I tried also to CURL it and to use Postman to send similar requests and results are always the same - 412 Precondition Failed.
Example request send by my client to create new calendar looks like this:



MKCALENDAR /xxxxxxxxxx/calendars/2321321CH34CHU35Y4UI5YVU31TIBCYTUIYBUI3 
HTTP/1.1
Host: caldav.icloud.com
Content-Type: text/xml
Authorization: Basic xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx==
cache-control: no-cache
<?xml version="1.0" encoding="UTF-8"?>
<C:mkcalendar xmlns:C="urn:ietf:params:xml:ns:caldav">
<D:set xmlns:D="DAV:">
<D:prop>
<D:displayname>new calendar</D:displayname>
<C:calendar-description xml:lang="en">my description</C:calendar-description>
</D:prop>
</D:set>
</C:mkcalendar>


Parts with xxxxx contains my proper principal id and authorization token.



Does anybody know if Apple has changed there something recently? I'm sure I didn't changed anything in my code and requests like the one in example above worked successfully a few days ago.










share|improve this question






















  • What does the 412 response body contain?
    – hnh
    yesterday










  • Looks like dupe of stackoverflow.com/questions/53305100/…
    – hnh
    yesterday










  • @hnh the response body is empty. The stackoverflow.com/questions/53305100/… is about different method (MKCOL vs. MKCALENDAR). In my case, MKCOL works flawlessly. I have problems only with MKCALENDAR requests. They used to work properly, but stopped some short time ago. According to RFC CalDAV document MKCALENDAR is a proper method for creating calendar resources. MKCOL is more general method related to WebDAV protocol and can be used to create different types of resources.
    – Bartek Małachowski
    yesterday












  • Are you hitting caldav.icloud.com or the proper partition? MKCALENDAR or MKCOL (w/ resource-type) should not matter, they are the same thing in both questions. I added an answer to the other question, that should fix it for you as well. Tried it w/ Calendar.app which uses MKCALENDAR and works just fine against the proper endpoint.
    – hnh
    yesterday










  • I have been using randomly chosen pXX-caldav.icloud.com partitions because I didn't know that I can use calendar-home-set property to get proper url (as you described it in the other topic). However, I quickly made some tests and even with properly obtained pXX I still receive 412 responses. I already changed my client to use MKCOL instead, but I just can't stop wondering why MKCALENDAR doesn't work as it should
    – Bartek Małachowski
    yesterday

















up vote
0
down vote

favorite












I developed a client for iCloud calendar service that uses CalDAV protocol. I use caldav4j library for Java, however the problem I encountered is language/library independent.
Several days ago creating of new calendars in my client stopped working. Now, I get 412 Precondition Failed status code while sending MKCALENDAR requests to iCloud. Other operations, like getting list of calendar resources, getting events, creating and updating events work the same as before.



I tried also to CURL it and to use Postman to send similar requests and results are always the same - 412 Precondition Failed.
Example request send by my client to create new calendar looks like this:



MKCALENDAR /xxxxxxxxxx/calendars/2321321CH34CHU35Y4UI5YVU31TIBCYTUIYBUI3 
HTTP/1.1
Host: caldav.icloud.com
Content-Type: text/xml
Authorization: Basic xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx==
cache-control: no-cache
<?xml version="1.0" encoding="UTF-8"?>
<C:mkcalendar xmlns:C="urn:ietf:params:xml:ns:caldav">
<D:set xmlns:D="DAV:">
<D:prop>
<D:displayname>new calendar</D:displayname>
<C:calendar-description xml:lang="en">my description</C:calendar-description>
</D:prop>
</D:set>
</C:mkcalendar>


Parts with xxxxx contains my proper principal id and authorization token.



Does anybody know if Apple has changed there something recently? I'm sure I didn't changed anything in my code and requests like the one in example above worked successfully a few days ago.










share|improve this question






















  • What does the 412 response body contain?
    – hnh
    yesterday










  • Looks like dupe of stackoverflow.com/questions/53305100/…
    – hnh
    yesterday










  • @hnh the response body is empty. The stackoverflow.com/questions/53305100/… is about different method (MKCOL vs. MKCALENDAR). In my case, MKCOL works flawlessly. I have problems only with MKCALENDAR requests. They used to work properly, but stopped some short time ago. According to RFC CalDAV document MKCALENDAR is a proper method for creating calendar resources. MKCOL is more general method related to WebDAV protocol and can be used to create different types of resources.
    – Bartek Małachowski
    yesterday












  • Are you hitting caldav.icloud.com or the proper partition? MKCALENDAR or MKCOL (w/ resource-type) should not matter, they are the same thing in both questions. I added an answer to the other question, that should fix it for you as well. Tried it w/ Calendar.app which uses MKCALENDAR and works just fine against the proper endpoint.
    – hnh
    yesterday










  • I have been using randomly chosen pXX-caldav.icloud.com partitions because I didn't know that I can use calendar-home-set property to get proper url (as you described it in the other topic). However, I quickly made some tests and even with properly obtained pXX I still receive 412 responses. I already changed my client to use MKCOL instead, but I just can't stop wondering why MKCALENDAR doesn't work as it should
    – Bartek Małachowski
    yesterday















up vote
0
down vote

favorite









up vote
0
down vote

favorite











I developed a client for iCloud calendar service that uses CalDAV protocol. I use caldav4j library for Java, however the problem I encountered is language/library independent.
Several days ago creating of new calendars in my client stopped working. Now, I get 412 Precondition Failed status code while sending MKCALENDAR requests to iCloud. Other operations, like getting list of calendar resources, getting events, creating and updating events work the same as before.



I tried also to CURL it and to use Postman to send similar requests and results are always the same - 412 Precondition Failed.
Example request send by my client to create new calendar looks like this:



MKCALENDAR /xxxxxxxxxx/calendars/2321321CH34CHU35Y4UI5YVU31TIBCYTUIYBUI3 
HTTP/1.1
Host: caldav.icloud.com
Content-Type: text/xml
Authorization: Basic xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx==
cache-control: no-cache
<?xml version="1.0" encoding="UTF-8"?>
<C:mkcalendar xmlns:C="urn:ietf:params:xml:ns:caldav">
<D:set xmlns:D="DAV:">
<D:prop>
<D:displayname>new calendar</D:displayname>
<C:calendar-description xml:lang="en">my description</C:calendar-description>
</D:prop>
</D:set>
</C:mkcalendar>


Parts with xxxxx contains my proper principal id and authorization token.



Does anybody know if Apple has changed there something recently? I'm sure I didn't changed anything in my code and requests like the one in example above worked successfully a few days ago.










share|improve this question













I developed a client for iCloud calendar service that uses CalDAV protocol. I use caldav4j library for Java, however the problem I encountered is language/library independent.
Several days ago creating of new calendars in my client stopped working. Now, I get 412 Precondition Failed status code while sending MKCALENDAR requests to iCloud. Other operations, like getting list of calendar resources, getting events, creating and updating events work the same as before.



I tried also to CURL it and to use Postman to send similar requests and results are always the same - 412 Precondition Failed.
Example request send by my client to create new calendar looks like this:



MKCALENDAR /xxxxxxxxxx/calendars/2321321CH34CHU35Y4UI5YVU31TIBCYTUIYBUI3 
HTTP/1.1
Host: caldav.icloud.com
Content-Type: text/xml
Authorization: Basic xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx==
cache-control: no-cache
<?xml version="1.0" encoding="UTF-8"?>
<C:mkcalendar xmlns:C="urn:ietf:params:xml:ns:caldav">
<D:set xmlns:D="DAV:">
<D:prop>
<D:displayname>new calendar</D:displayname>
<C:calendar-description xml:lang="en">my description</C:calendar-description>
</D:prop>
</D:set>
</C:mkcalendar>


Parts with xxxxx contains my proper principal id and authorization token.



Does anybody know if Apple has changed there something recently? I'm sure I didn't changed anything in my code and requests like the one in example above worked successfully a few days ago.







java icloud caldav






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 18 at 19:32









Bartek Małachowski

385




385












  • What does the 412 response body contain?
    – hnh
    yesterday










  • Looks like dupe of stackoverflow.com/questions/53305100/…
    – hnh
    yesterday










  • @hnh the response body is empty. The stackoverflow.com/questions/53305100/… is about different method (MKCOL vs. MKCALENDAR). In my case, MKCOL works flawlessly. I have problems only with MKCALENDAR requests. They used to work properly, but stopped some short time ago. According to RFC CalDAV document MKCALENDAR is a proper method for creating calendar resources. MKCOL is more general method related to WebDAV protocol and can be used to create different types of resources.
    – Bartek Małachowski
    yesterday












  • Are you hitting caldav.icloud.com or the proper partition? MKCALENDAR or MKCOL (w/ resource-type) should not matter, they are the same thing in both questions. I added an answer to the other question, that should fix it for you as well. Tried it w/ Calendar.app which uses MKCALENDAR and works just fine against the proper endpoint.
    – hnh
    yesterday










  • I have been using randomly chosen pXX-caldav.icloud.com partitions because I didn't know that I can use calendar-home-set property to get proper url (as you described it in the other topic). However, I quickly made some tests and even with properly obtained pXX I still receive 412 responses. I already changed my client to use MKCOL instead, but I just can't stop wondering why MKCALENDAR doesn't work as it should
    – Bartek Małachowski
    yesterday




















  • What does the 412 response body contain?
    – hnh
    yesterday










  • Looks like dupe of stackoverflow.com/questions/53305100/…
    – hnh
    yesterday










  • @hnh the response body is empty. The stackoverflow.com/questions/53305100/… is about different method (MKCOL vs. MKCALENDAR). In my case, MKCOL works flawlessly. I have problems only with MKCALENDAR requests. They used to work properly, but stopped some short time ago. According to RFC CalDAV document MKCALENDAR is a proper method for creating calendar resources. MKCOL is more general method related to WebDAV protocol and can be used to create different types of resources.
    – Bartek Małachowski
    yesterday












  • Are you hitting caldav.icloud.com or the proper partition? MKCALENDAR or MKCOL (w/ resource-type) should not matter, they are the same thing in both questions. I added an answer to the other question, that should fix it for you as well. Tried it w/ Calendar.app which uses MKCALENDAR and works just fine against the proper endpoint.
    – hnh
    yesterday










  • I have been using randomly chosen pXX-caldav.icloud.com partitions because I didn't know that I can use calendar-home-set property to get proper url (as you described it in the other topic). However, I quickly made some tests and even with properly obtained pXX I still receive 412 responses. I already changed my client to use MKCOL instead, but I just can't stop wondering why MKCALENDAR doesn't work as it should
    – Bartek Małachowski
    yesterday


















What does the 412 response body contain?
– hnh
yesterday




What does the 412 response body contain?
– hnh
yesterday












Looks like dupe of stackoverflow.com/questions/53305100/…
– hnh
yesterday




Looks like dupe of stackoverflow.com/questions/53305100/…
– hnh
yesterday












@hnh the response body is empty. The stackoverflow.com/questions/53305100/… is about different method (MKCOL vs. MKCALENDAR). In my case, MKCOL works flawlessly. I have problems only with MKCALENDAR requests. They used to work properly, but stopped some short time ago. According to RFC CalDAV document MKCALENDAR is a proper method for creating calendar resources. MKCOL is more general method related to WebDAV protocol and can be used to create different types of resources.
– Bartek Małachowski
yesterday






@hnh the response body is empty. The stackoverflow.com/questions/53305100/… is about different method (MKCOL vs. MKCALENDAR). In my case, MKCOL works flawlessly. I have problems only with MKCALENDAR requests. They used to work properly, but stopped some short time ago. According to RFC CalDAV document MKCALENDAR is a proper method for creating calendar resources. MKCOL is more general method related to WebDAV protocol and can be used to create different types of resources.
– Bartek Małachowski
yesterday














Are you hitting caldav.icloud.com or the proper partition? MKCALENDAR or MKCOL (w/ resource-type) should not matter, they are the same thing in both questions. I added an answer to the other question, that should fix it for you as well. Tried it w/ Calendar.app which uses MKCALENDAR and works just fine against the proper endpoint.
– hnh
yesterday




Are you hitting caldav.icloud.com or the proper partition? MKCALENDAR or MKCOL (w/ resource-type) should not matter, they are the same thing in both questions. I added an answer to the other question, that should fix it for you as well. Tried it w/ Calendar.app which uses MKCALENDAR and works just fine against the proper endpoint.
– hnh
yesterday












I have been using randomly chosen pXX-caldav.icloud.com partitions because I didn't know that I can use calendar-home-set property to get proper url (as you described it in the other topic). However, I quickly made some tests and even with properly obtained pXX I still receive 412 responses. I already changed my client to use MKCOL instead, but I just can't stop wondering why MKCALENDAR doesn't work as it should
– Bartek Małachowski
yesterday






I have been using randomly chosen pXX-caldav.icloud.com partitions because I didn't know that I can use calendar-home-set property to get proper url (as you described it in the other topic). However, I quickly made some tests and even with properly obtained pXX I still receive 412 responses. I already changed my client to use MKCOL instead, but I just can't stop wondering why MKCALENDAR doesn't work as it should
– Bartek Małachowski
yesterday



















active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














 

draft saved


draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53364701%2fcaldav-client-for-iclouds-mkcaledar-requests-stopped-working-and-fail-with-412%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown






























active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes
















 

draft saved


draft discarded



















































 


draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53364701%2fcaldav-client-for-iclouds-mkcaledar-requests-stopped-working-and-fail-with-412%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

"Incorrect syntax near the keyword 'ON'. (on update cascade, on delete cascade,)

Alcedinidae

RAC Tourist Trophy