2017-05-24 10 views
0

独自のクラウドOCS APIを使用するアプリケーションを開発しています。OCS独自のクラウドAPIを使用してフォルダとアップロードファイルを作成する方法

ユーザーの管理にOwncloud REST APIを使用しましたが、今は各ユーザーのファイルを管理したいと考えています。私はnodejsを使用しています。ユーザー管理のようなファイルを管理するためのAPIはありますか?私が見つけた何

は、共有ファイルのAPIのURLました:

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

これが唯一の共有ファイルを返します。私はすべてのファイルのために1つを望む

ありがとう。我々が使用するcurlコマンド使用

答えて

0

  • curl -X MKCOL <folder_URL>のためのファイルをアップロードするフォルダ
  • curl -X PUT <folder_URL>/<file_name> --data-binary @<file_location_in_pc>を作成します。

これは、コードの例である:

/** 
    * 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) 
     } 
    }) 
    } 
関連する問題