As we transition to the new Hyland Community, some post links may be temporarily disrupted as we finalize redirects. We apologize for the inconvenience and are working to resolve this as quickly as possible. Details.
URL: http://localhost:8080/alfresco/service/api/upload/?alf_ticket = {User's ticket} parameters: [filedata, filename, description, siteid, containerId]
URL: http://localhost:8080/alfresco/service/api/upload/?alf_ticket = {User's ticket} File file = new File("C:/Test_Upload.pdf"); String filetype = "application/pdf" String filename="Test_Upload.pdf"; HttpClient client = new HttpClient(); PostMethod post = new PostMethod(URL); Part[] parts = { new FilePart("filedata", filename, file, filetype, null), new StringPart("filename", filename), new StringPart("description", "description"), new StringPart("siteid", "yoursite"), new StringPart("containerid", "documentLibrary"), // your can add more paramter here //new StringPart("uploaddirectory", "documentLibrary"), //new StringPart("updatenoderef", "updatenoderef"), //new StringPart("contenttype", "contenttype"), //new StringPart("aspects", "aspects") ….. }; post.setRequestEntity(new MultipartRequestEntity(parts, post.getParams())); int status = client.executeMethod(post); System.out.println(post.getResponseBodyAsString()); post.releaseConnection();
Part[] parts = { new FilePart("filedata", filename, file, filetype, null), new StringPart("filename", filename), new StringPart("description", "description"), // new StringPart("siteid", "yoursite"), // new StringPart("containerid", "documentLibrary"), new StringPart("destination", "workspace://SpacesStore/7118e242-86b1-489a-ac2e-193364ccf6e4"), }
POST localhost:8080/alfresco/service/api/node/workspace/SpacesStore/15fc9618-56a5-4037-ac25-508899d5ba28/children
{"alf_destination":"workspace://SpacesStore/15fc9618-56a5-4037-ac25-508899d5ba28","prop_cm_name":"test","prop_cm_title":"","prop_cm_description":""}
http://localhost:8080/alfresco/service/api/upload
$json = (' { "filename":"HAHA.PDF", "destination":"workspace://SpacesStore/'.$parentID.'", "filedata":"'.$file.'" } '); $curl = curl_init(); curl_setopt($curl, CURLOPT_HTTPHEADER, Array("Content-Type: application/json")); curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC) ; curl_setopt($curl, CURLOPT_USERPWD, "admin:admin"); curl_setopt($curl, CURLOPT_POST, 1); curl_setopt($curl, CURLOPT_URL, $submit_url); curl_setopt($curl, CURLOPT_POSTFIELDS, $json); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); $rs = curl_exec($curl);
siteid
containerid
uploaddirectory
documentLibrary
siteid = "repo", containerid = "documentLibrary", uploaddirectory = "raps"
repo/documentLibrary
repo/documentLibrary/raps
destination