주 메뉴 열기

wwiki β

바뀜

NextCloud Developer

4,079 바이트 추가됨, 2023년 4월 5일 (수) 08:27
편집 요약 없음
==Client API=====Webdav=======Basic APIs==== ===== '''WebDAV basics''' =====base url: /remote.php/dav 모든 요청은 인증정보가 필요하다. ===== '''Testing requests with curl''' =====[[WebDAV]] 요청은 curl로 간단하게 테스트할 수 있다. 예를 들어, 폴더에서 파일들을 찾는 요청을 할 수 있다.<syntaxhighlight lang="bash">$ curl -u username:password 'https://cloud.example.com/remote.php/dav/files/username/folder' -X PROPFIND --data '<?xml version="1.0" encoding="UTF-8"?> <d:propfind xmlns:d="DAV:"> <d:prop xmlns:oc="http://owncloud.org/ns"> <d:getlastmodified/> <d:getcontentlength/> <d:getcontenttype/> <oc:permissions/> <d:resourcetype/> <d:getetag/> </d:prop> </d:propfind>'</syntaxhighlight> ===== <span> Listing folders ([rfc:4918 rfc4918])</span> =====폴더에 PROPFIND요청을 보내서 폴더의 컨텐츠를 리스트할 수 있다. PROPFIND remote.php/dav/files/user/path/to/folder ====== Requesting properties ======기본적으로 수정일시, 파일 크기, 폴더여부, eTag, mime type을 리턴한다.  PROPFIND요청을 보낼 때 추가속성을 요청할 수 있다.<syntaxhighlight lang="XML"><?xml version="1.0"?><d:propfind xmlns:d="DAV:" xmlns:oc="http://owncloud.org/ns" xmlns:nc="http://nextcloud.org/ns"> <d:prop> <d:getlastmodified /> <d:getetag /> <d:getcontenttype /> <d:resourcetype /> <oc:fileid /> <oc:permissions /> <oc:size /> <d:getcontentlength /> <nc:has-preview /> <oc:favorite /> <oc:comments-unread /> <oc:owner-display-name /> <oc:share-types /> <nc:contained-folder-count /> <nc:contained-file-count /> </d:prop></d:propfind></syntaxhighlight>지원되는 속성들 * <code>{DAV:}getlastmodified</code>* <code>{DAV:}getetag</code>* <code>{DAV:}getcontenttype</code>* <code>{DAV:}resourcetype</code>* <code>{DAV:}getcontentlength</code>* <code>{<nowiki>http://owncloud.org/ns}id</nowiki></code> The fileid namespaced by the instance id, globally unique* <code>{<nowiki>http://owncloud.org/ns}fileid</nowiki></code> The unique id for the file within the instance* <code>{<nowiki>http://owncloud.org/ns}favorite</nowiki></code>* <code>{<nowiki>http://owncloud.org/ns}comments-href</nowiki></code>* <code>{<nowiki>http://owncloud.org/ns}comments-count</nowiki></code>* <code>{<nowiki>http://owncloud.org/ns}comments-unread</nowiki></code>* <code>{<nowiki>http://owncloud.org/ns}owner-id</nowiki></code> The user id of the owner of a shared file* <code>{<nowiki>http://owncloud.org/ns}owner-display-name</nowiki></code> The display name of the owner of a shared file* <code>{<nowiki>http://owncloud.org/ns}share-types</nowiki></code>* <code>{<nowiki>http://owncloud.org/ns}checksums</nowiki></code>* <code>{<nowiki>http://nextcloud.org/ns}has-preview</nowiki></code>* <code>{<nowiki>http://owncloud.org/ns}size</nowiki></code> Unlike <code>getcontentlength</code>, this property also works for folders reporting the size of everything in the folder.* <code>{<nowiki>http://nextcloud.org/ns}rich-workspace</nowiki></code> this property is provided by the text app* <code>{<nowiki>http://nextcloud.org/ns}contained-folder-count</nowiki></code> The number of folders directly contained in the folder (not recursively)* <code>{<nowiki>http://nextcloud.org/ns}contained-file-count</nowiki></code> The number of files directly contained in the folder (not recursively) ====== Getting properties for just the folder ======요청헤더에 <code>Depth: 0</code> 을 추가하면 폴더 컨텐츠 없이 폴더 속성을 요청할 수 있다. ===== Downloading files ===== GET remote.php/dav/files/user/path/to/file ===== Uploading files ===== PUT remote.php/dav/files/user/path/to/file ===== Creating folders ([rfc:4918 rfc4918]) ===== MKCOL remote.php/dav/files/user/path/to/new/folder ===== Deleting files and folders ([rfc:4918 rfc4918]) ===== DELETE remote.php/dav/files/user/path/to/file
편집
2,431