I know how to use curl to insert new events into a CalDAV calendar, if the event is saved as a local ics file by a previous command:
$command > $localfile curl -T "$localfile" $url That works perfectly, but I'd like to do this without the need for a local file, I want to pipe the result from $command into curl, something like this:
$command | curl -T - $url According to curl’s manual, the option "T -" should be what is required: it is supposed to read from stdin instead from a file. But if I use that option, I get this response:
<?xml version="1.0" encoding="utf-8"?> <d:error xmlns:d="DAV:" xmlns:s="http://sabredav.org/ns"> <s:exception>Sabre\DAV\Exception\Conflict</s:exception> <s:message>PUT is not allowed on non-files.</s:message> </d:error> I've tried different other parameter like "--data" and "--data-raw", but I haven't found the right combination yet. Could someone help me with this, please?
Actually, the complete command cycle I am trying to realize looks like this:
cat<<EOC | curl -T - $url BEGIN:VCALENDAR VERSION:2.0 BEGIN:VEVENT CREATED:${CREATED} UID:${RNDUID} CLASS:PUBLIC CATEGORIES:TV SUMMARY:${SUMMARY} LOCATION:${LOCATION} DTSTART:${DTSTART} DTEND:${DTEND} DESCRIPTION:${DESCRIPTION} END:VEVENT END:VCALENDAR EOC I tried "echo" instead of "cat", but that doesn't change the result.
echothat command ? Thereforeecho $command | curl -T - $url-H "Content-Type: text/plain"with a correct content type