2017-05-24 3 views
0

owncloud OCS API를 사용하는 앱을 개발 중입니다.OCS owncloud API를 사용하여 폴더를 만들고 업로드하는 방법

사용자 관리에 Owncloud REST API을 사용 했으므로 각 사용자의 파일을 관리하고 싶습니다. nodejs를 사용하고 있습니다. 사용자 관리와 같은 파일을 관리하기위한 API가 있습니까?

owncloud/ocs/v1.php/apps/files_sharing/api/v1/shares 

이 만 공유 파일을 반환 : 나는 무엇을 발견

공유 파일에 대한 API의 URL이었다. 모든 파일에 대해 하나를 원합니다.

고마워요.

답변

0

CURL 명령을 사용하여 우리는 사용 : 폴더 업로드

  • curl -X PUT <folder_URL>/<file_name> --data-binary @<file_location_in_pc> 파일을 생성

    • curl -X MKCOL <folder_URL>을 위해.

      /** 
          * Upload a file to an user folder 
          * @param userId 
          * @param fileName 
          * @param fileLocation 
          * @param callback 
          */ 
          function fnUploadDocument(userId, fileName, fileLocation, callback) { 
          var json = { 
           done: false 
          } 
          var command = 'curl -X PUT "' 
          command += srv.ownclouddirUtil.getUrlUser() 
          command += srv.h3apifolder + userId + '/' 
          command += fileName + '"' 
          command += ' --data-binary @"' + fileLocation + '"' 
          console.log('Command--: ', command) 
          srv.fileSystemService.runScript(command, function (stdout, error, stderr) { 
           if (error === null) { 
           json.done = true 
           callback(json) 
           } else { 
           json.error = error 
           json.stderr = stderr 
           callback(json) 
           } 
          }) 
          } 
      
      :

  • 코드의 예