2014-05-21 51 views
1

我想使用後端webScript /alfresco/service/api/upload來上傳文件。但問題是,我不知道我必須在POST上發送的JSON應該是什麼樣的。但我知道什麼是參數:Alfresco上傳Webscript

- filedata, (mandatory) HTML type file You must specify one of: 
    destination (the folder NodeRef where the node will be created) 
    updateNodeRef (the NodeRef of an existing node that will be updated) 
- siteid and containerid (the Site name and the container in that site where the document will be created) 
- uploaddirectory : name of the folder (either in the site container or the destination) where the  document will be uploaded. This folder must already exist 
- description : Description for a version update (versionDescription) 
- contenttype : The content type that this document should be specialised to 
- majorversion 
- overwrite 
- thumbnails 

現在我需要的是JSON格式。文件內容應該是什麼樣子(流或純文本?)。任何幫助將不勝感激。

+0

你確定API需要JSON嗎?我認爲它適用於HTML表單文章? – Gagravarr

+0

是的,我。它肯定接受JSON作爲請求。 – deltascience

+0

你確定嗎?它支持通過JSON報告結果,但[查看源代碼](https://svn.alfresco.com/repos/alfresco-open-mirror/alfresco/HEAD/root/projects/remote-api/config /alfresco/templates/webscripts/org/alfresco/repository/upload/upload.post.js)我只在輸入端看到對HTML表單上傳的引用 – Gagravarr

回答

1

強制性字段是:

  • 「FILEDATA」:是一個FileSystemResource(JAVA)
  • 目的地:是該文件夾的nodeRef。
  • uploaddirectory:是該nodeRef內的目標目錄。

其他字段是可選的。

Upldate:

這裏是上載至露天repositoy在JAVA HERE的一個例子。在這個例子中,他們使用siteidcontainerid這些字段替換destination並且依次是該站點內的站點名稱和文件夾。

相關問題