Skip to content

Instantly share code, notes, and snippets.

@neingeist
Created November 28, 2018 01:22
Show Gist options
  • Save neingeist/d27699eeb885fd9725d9622232af1927 to your computer and use it in GitHub Desktop.
Save neingeist/d27699eeb885fd9725d9622232af1927 to your computer and use it in GitHub Desktop.
upload-oc, a start
#!/bin/sh -x
username="neini"
password="supersecret"
owncloud_url="https://my.domain.de/owncloud"
# FIXME parse
file="$1"
# FIXME urlencode
remote_file=`basename "$file"`
curl -X PUT -u "$username:$password" \
"$owncloud_url/remote.php/webdav/" \
-T "$file"
curl -u "$username:$password" \
"$owncloud_url/ocs/v1.php/apps/files_sharing/api/v1/shares" \
-d "path=/$remote_file&shareType=3&permissions=1"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment