我正在使用CalDAV开发一个日历客户端。我正在尝试在 Google 日历上创建一个活动。最后的 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 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
放置响应:
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
您的 VEVENT 具有无效的 SEQUENCE
属性:
SEQUENCE:-2147483647
如果事件是新鲜的,那应该是 1 ...
但主要问题是它没有DTSTART
财产,也没有DTEND
(或DURATION
)财产。没有时间的事件是什么;->