1.5 KiB
1.5 KiB
nextcloud
upload file https://docs.nextcloud.com/server/latest/developer_manual/client_apis/WebDAV/basic.html#uploading-files
curl -u username:password \
--request PUT \
--url https://nextcloud-fi.webo.hosting/remote.php/dav/files/<user_name>/alternative-front-ends-main.zip \
--header 'content-type: application/octet-stream' \
--data-binary @path/to/your/local/file
generating sharable link https://docs.nextcloud.com/server/latest/developer_manual/client_apis/OCS/ocs-share-api.html
-
auth
curl -u username:password -X GET 'https://cloud.example.com/ocs/v1.php/...' -H "OCS-APIRequest: true" -
get shareable items list
curl -u username:password -X GET 'https://cloud.example.com/ocs/v1.php/shares' -H "OCS-APIRequest: true" -
create sharable link
curl -u username:password --request POST \ --url https://nextcloud-fi.webo.hosting/ocs/v2.php/apps/files_sharing/api/v1/shares \ --header 'content-type: application/x-www-form-urlencoded' \ --header 'ocs-apirequest: true' \ --data path=/Photos/Birdie.jpg \ --data shareType=3
for nodejs fetch, -u username:password needs to be converted into basic auth header so convert username:password string to base64 and pass it header as authorization: Basic <base64_version>
- upload file
curl -u username:password --request PUT \ --url https://nextcloud-fi.webo.hosting/remote.php/dav/files/<username>/alternative-front-ends-main.zip \ --header 'content-type: application/octet-stream' \ --data-binary @path/to/your/local/file.zip