Google CalDAV:对PUT事件的错误请求

时间:2016-06-06 11:07:25

标签: google-api icalendar caldav

我正在使用CalDAV开发日历客户端。我正在尝试在Google日历上创建活动。最后PUT请求有什么问题导致错误的请求错误?

这是我前两个成功请求和Bad的日志! PUT请求:

请求选项:

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

选项回复:

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"

请求日历:

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>

日历回复:

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请求:

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回复:

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

1 个答案:

答案 0 :(得分:2)

您的VEVENT属性无效SEQUENCE

SEQUENCE:-2147483647

如果事件是新的,那应该是1 ......

但主要问题是它没有DTSTART属性,也没有DTEND(或DURATION)属性。什么是一个没有时间的事件; - &gt;