UnsupportedMediaType response

Hi All,
I would like to create Calendar event on nextcloud v. 13.0.6 via this command

curl -X PUT -u usr:psw ‘https://nextcloud_serve/remote.php/dav/calendars/user/personal/112233.ics’ -H “OCS-APIRequest: true” -d @b.ics -H “Content-Type: text/html; charset=utf-8”

content of b.ics is following:

BEGIN:VCALENDAR
VERSION:2.0
CALSCALE:GREGORIAN
PRODID:-//SabreDAV//SabreDAV//EN
X-WR-CALNAME:Personal
BEGIN:VTIMEZONE
TZID:Europe/Prague
BEGIN:DAYLIGHT
TZOFFSETFROM:+0100
TZOFFSETTO:+0200
TZNAME:CEST
DTSTART:19700329T020000
RRULE:FREQ=YEARLY;BYDAY=-1SU;BYMONTH=3
END:DAYLIGHT
BEGIN:STANDARD
TZOFFSETFROM:+0200
TZOFFSETTO:+0100
TZNAME:CET
DTSTART:19701025T030000
RRULE:FREQ=YEARLY;BYDAY=-1SU;BYMONTH=10
END:STANDARD
END:VTIMEZONE
BEGIN:VEVENT
CREATED:20181027T150358
DTSTAMP:20181027T150358
LAST-MODIFIED:20181027T150358
UID:7G31U5YQIHY1R7X95JA2TJ
SUMMARY:test
LOCATION:home
CLASS:PUBLIC
DESCRIPTION:description
STATUS:CONFIRMED
DTSTART;VALUE=DATE:20181030
DTEND;VALUE=DATE:20181031
END:VEVENT

and the respose is :

<?xml version="1.0" encoding="utf-8"?>

<d:error xmlns:d=“DAV:” xmlns:s=“http://sabredav.org/ns”>
<s:exception>Sabre\DAV\Exception\UnsupportedMediaType</s:exception>
<s:message>This resource only supports valid iCalendar 2.0 data. Parse error: This parser only supports VCARD and VCALENDAR files</s:message>
</d:error>

can you please advice?
Jan

Hello Jan,

I am facing the exact same issue ! Did you get any chance to solve it ?

Michel

@Jan_Schaumann There are multiple issues:

  • Your contents does not have the final END:VCALENDAR
  • Why are you sending this header? -H “Content-Type: text/html; charset=utf-8”
    • What you are sending is text/calendar, not text/html.

I hade the same problem, upon switching from “-d @name.ending” to -d ‘BEGIN …’ it worked, seems like it was a problem of curl