2

I want to use the backend webScript /alfresco/service/api/upload to upload a file. But the problem is that I have no Idea what the JSON that I have to send on POST should looks like. However I know what are the parameters :

- 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

Now what I need is the JSON format. What the file content should look like (stream or plain/text?). Any help will be appreciated.

deltascience
  • 3,321
  • 5
  • 42
  • 71
  • Are you sure that API takes JSON? I thought it worked with HTML Form Posts? – Gagravarr May 21 '14 at 10:30
  • Yes I am. It definitely accept JSON as request. – deltascience May 21 '14 at 11:38
  • You sure? It supports reporting the result by JSON, but [looking at the source code for it](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) I only see references to HTML form uploads on the input side – Gagravarr May 21 '14 at 13:29

1 Answers1

1

The mandatory field are :

  • "filedata" : is a FileSystemResource (JAVA)
  • destination : is the nodeRef of the folder.
  • uploaddirectory : is the destination directory inside that nodeRef.

The other fields are optional.

Upldate :

Here is an example of an upload to alfresco repositoy in JAVA HERE. In the example they use siteid and containerid these field replace destination and are successively the site name and and the folder inside that site.

Community
  • 1
  • 1
deltascience
  • 3,321
  • 5
  • 42
  • 71