Curl commands are failing

curl -u username:password -X MLCOL “https://10.1.85.219/remote.php/dav/files/ukreddy/testing

curl: (35) schannel: SNI or certificate check failed: SEC_E_WRONG_PRINCIPAL (0x80090322) - The target principal name is incorrect.

Even I imported the certificate files to Trusted root of my machine where I am executing the above curl command, but still same issue.

try to use -k, e.g. curl -k -u username... this will tell curl to ignore certificate.

Root cause is that Certificate ether Self Signed, or belongs to domain, but your accessing via IP.

ok, but now I am getting this error.

curl -k -u ukreddy:password -X MLCOL “https://10.1.85.219/remote.php/dav/files/ukreddy/testing

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

<d:error xmlns:d=“DAV:” xmlns:s=“http://sabredav.org/ns”>
<s:exception>Sabre\DAV\Exception\NotImplemented</s:exception>
<s:message>There was no plugin in the system that was willing to handle this MLCOL method.</s:message>
</d:error>

Thats it:) You are in nextcloud and it says that it could not work with MLCOL, try to use GET or PUT, e.g. to upload the file:

curl -k --user "$webdavlogin:$webdavpass" -T $LocalDir/$FileName $WEBDAVlink/$Filename

Or install plugin that will give you MLCOL support.

Just find out that it is a part of official docu, but as MKCOL, but not MLCOL: https://docs.nextcloud.com/server/15/developer_manual/client_apis/WebDAV/basic.html#creating-folders-rfc4918

Try to run:

curl -k -u ukreddy:password -X MKCOL “https://10.1.85.219/remote.php/webdav/testing”

I tried this command

C:\Users\uday>curl -k -u ukreddy:password -T “C:\Users\uday\Downloads\gif.gif” “https://10.1.85.219/remote.php/webdav/files/ukreddy/t/gif.gif

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

<d:error xmlns:d=“DAV:” xmlns:s=“http://sabredav.org/ns”>
<s:exception>Sabre\DAV\Exception\NotFound</s:exception>
<s:message>File with name files/ukreddy/t could not be located</s:message>
</d:error>

There is folder “t” in my account root folder “ukreddy” can you suggest why this error comes.

You do not need to specify user in webdav link. It should be in your case as following:

curl -k -u ukreddy:password -T “C:\Users\uday\Downloads\gif.gif” “https://10.1.85.219/remote.php/webdav/t/gif.gif”