0

I'm developing a calendar client using CalDAV. I'm trying to create an event on my Google calendar. What's wrong with the PUT request at the end causing Bad request error?

Here's log for my first two successful requests and the Bad! PUT request:

Request options:

OPTIONS https://apidata.googleusercontent.com/caldav/v2/altostratous@gmail.com/events/ HTTP/1.1
Authorization: Bearer ya29.Ci_5AnP1bx1kKPhytjF3axMpsMhqhYppH2RsRhgn64Nnpun8KW3Eb9PV2aT8vlsTyA
Host: apidata.googleusercontent.com
Content-Length: 0
Connection: Keep-Alive

Options response:

HTTP/1.1 200 OK
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Pragma: no-cache
Expires: Mon, 01 Jan 1990 00:00:00 GMT
Date: Mon, 06 Jun 2016 10:27:23 GMT
Allow: DELETE, GET, HEAD, OPTIONS, PROPFIND, PROPPATCH, PUT, REPORT
Content-Disposition: attachment
DAV: 1, calendar-access, calendar-schedule, calendar-auto-schedule, calendar-proxy
Vary: Origin
Vary: X-Origin
Content-Type: text/plain
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
X-XSS-Protection: 1; mode=block
Content-Length: 0
Server: GSE
Alternate-Protocol: 443:quic
Alt-Svc: quic=":443"; ma=2592000; v="34,33,32,31,30,29,28,27,26,25"

Request calendars:

PROPFIND https://apidata.googleusercontent.com/caldav/v2/altostratous@gmail.com/events/ HTTP/1.1
Authorization: Bearer ya29.Ci_5AnP1bx1kKPhytjF3axMpsMhqhYppH2RsRhgn64Nnpun8KW3Eb9PV2aT8vlsTyA
Depth: 0
Host: apidata.googleusercontent.com
Content-Type: text/xml
Content-Length: 103

<options xmlns="DAV:">
  <calendar-collection-set xmlns="urn:ietf:params:xml:ns:caldav" />
</options>

Calendars response:

HTTP/1.1 207 Multi-Status
Vary: X-Origin
Content-Type: text/xml; charset=UTF-8
Date: Mon, 06 Jun 2016 10:27:24 GMT
Expires: Mon, 06 Jun 2016 10:27:24 GMT
Cache-Control: private, max-age=0
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
X-XSS-Protection: 1; mode=block
Server: GSE
Alternate-Protocol: 443:quic
Alt-Svc: quic=":443"; ma=2592000; v="34,33,32,31,30,29,28,27,26,25"
Accept-Ranges: none
Vary: Origin,Accept-Encoding
Transfer-Encoding: chunked

39d
<?xml version="1.0" encoding="UTF-8"?>
<D:multistatus xmlns:D="DAV:" xmlns:caldav="urn:ietf:params:xml:ns:caldav" xmlns:cs="http://calendarserver.org/ns/" xmlns:ical="http://apple.com/ns/ical/">
 <D:response xmlns:carddav="urn:ietf:params:xml:ns:carddav" xmlns:cm="http://cal.me.com/_namespace/" xmlns:md="urn:mobileme:davservices">
  <D:href>/caldav/v2/altostratous@gmail.com/events/</D:href>
  <D:propstat>
   <D:status>HTTP/1.1 200 OK</D:status>
   <D:prop>
    <D:displayname>altostratous@gmail.com</D:displayname>
    <D:getcontenttype>text/calendar; component=vevent</D:getcontenttype>
    <cs:getctag>63600884682</cs:getctag>
    <ical:calendar-color>#2952A3FF</ical:calendar-color>
    <caldav:calendar-description>altostratous@gmail.com</caldav:calendar-description>
    <D:resourcetype>
     <D:collection/>
     <caldav:calendar/>
    </D:resourcetype>
   </D:prop>
  </D:propstat>
 </D:response>
</D:multistatus>

0

PUT request:

PUT https://apidata.googleusercontent.com/caldav/v2/altostratous@gmail.com/events/fc4eae83-a429-4cd0-8d1e-4adbf9771969.ics HTTP/1.1
Authorization: Bearer ya29.Ci_5AnP1bx1kKPhytjF3axMpsMhqhYppH2RsRhgn64Nnpun8KW3Eb9PV2aT8vlsTyA
Host: apidata.googleusercontent.com
If-None-Match: *
Content-Type: text/calendar
Content-Length: 283

BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//tracky/iCal//FUBU v1.0//EN
BEGIN:VEVENT
UID:fc4eae83-a429-4cd0-8d1e-4adbf9771969
DESCRIPTION:this is a description
DTSTAMP:20160606T102724Z
LAST-MODIFIED:20160606T102724Z
SEQUENCE:-2147483647
SUMMARY:summary
END:VEVENT
END:VCALENDAR

PUT response:

HTTP/1.1 400 Bad Request
Vary: X-Origin
Content-Type: text/xml; charset=UTF-8
Date: Mon, 06 Jun 2016 10:27:24 GMT
Expires: Mon, 06 Jun 2016 10:27:24 GMT
Cache-Control: private, max-age=0
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
X-XSS-Protection: 1; mode=block
Server: GSE
Alternate-Protocol: 443:quic
Alt-Svc: quic=":443"; ma=2592000; v="34,33,32,31,30,29,28,27,26,25"
Accept-Ranges: none
Vary: Origin,Accept-Encoding
Transfer-Encoding: chunked

41
<?xml version="1.0" encoding="UTF-8"?>
<D:error xmlns:D="DAV:"/>

0
Ali Asgari
  • 801
  • 7
  • 18

1 Answers1

2

Your VEVENT has an invalid SEQUENCE property:

SEQUENCE:-2147483647

That should be 1 if the event is fresh ...

But the primary issue is that it has no DTSTART property and no DTEND (or DURATION) property. What's an event w/o a time ;->

hnh
  • 13,957
  • 6
  • 30
  • 40