initial
This commit is contained in:
commit
74ae93a96e
1 changed files with 94691 additions and 0 deletions
39
joplin notion extension/Web Development/API/nextcloud.md
Normal file
39
joplin notion extension/Web Development/API/nextcloud.md
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
nextcloud
|
||||
|
||||
upload file
|
||||
https://docs.nextcloud.com/server/latest/developer_manual/client_apis/WebDAV/basic.html#uploading-files
|
||||
```bash
|
||||
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
|
||||
```bash
|
||||
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
|
||||
```bash
|
||||
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
|
||||
```
|
||||
Loading…
Reference in a new issue