01-22-2014 10:52 AM
01-22-2014 12:42 PM
POST /api/node/{store_type}/{store_id}/{id}/children
POST /api/path/{store_type}/{store_id}/{nodepath}/children
01-23-2014 05:25 AM
01-23-2014 06:27 AM
package com.kayne.cmis.webscript;
import java.io.File;
import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.HttpStatus;
import org.apache.commons.httpclient.UsernamePasswordCredentials;
import org.apache.commons.httpclient.auth.AuthScope;
import org.apache.commons.httpclient.methods.GetMethod;
import org.apache.commons.httpclient.methods.PostMethod;
import org.apache.commons.httpclient.methods.StringRequestEntity;
import org.apache.commons.io.FileUtils;
public class CMISTest {
private void testAddNode(){
HttpClient client = new HttpClient();
client.getState().setCredentials(
new AuthScope("localhost", 8080, "Alfresco"),
new UsernamePasswordCredentials("admin", "admin"));
String apiurl = "http://localhost:8080/alfresco/service/api/path/workspace/SpacesStore/Company%20Home/TESTFOLDER1/chi...";
PostMethod post = new PostMethod(apiurl);
try {
String test = FileUtils.readFileToString(new File("E:\\KayneZhang\\test2.xml"));
System.out.println(test);
post.setDoAuthentication(true);
post.setRequestHeader("Content-Type", "application/atom+xml");
post.setRequestEntity(new StringRequestEntity(test,
"application/json", "UTF-8"));
int status = client.executeMethod(post);
if (status != HttpStatus.SC_OK) {
System.err.println("Method failed: " + post.getStatusLine());
}
String resultString = post.getResponseBodyAsString();
System.out.println(resultString);
} catch (Exception e) {
e.printStackTrace();
} finally {
post.releaseConnection();
}
}
public static void main(String[] args) {
CMISTest test = new CMISTest();
test.testAddNode();
}
}
<entry xmlns="http://www.w3.org/2005/Atom" xmlns:cmisra="http://docs.oasis-open.org/ns/cmis/restatom/200908/" xmlns:cmis="http://docs.oasis-open.org/ns/cmis/core/200908/" xmlns:alf="http://www.alfresco.org">
<author>
<name>admin</name>
</author>
<summary>Presentation.</summary>
<title>test_add_custom_type</title>
<cmisra:object>
<cmis:properties>
<cmis:propertyId propertyDefinitionId="cmis:objectTypeId">
<cmis:value>D:ca:customContent</cmis:value>
</cmis:propertyId>
<cmis:propertyInteger propertyDefinitionId="cmis:contentStreamLength" displayName="Content Stream Length" queryName="cmis:contentStreamLength">
<cmis:value>98495335</cmis:value>
</cmis:propertyInteger>
<cmis:propertyString propertyDefinitionId="cmis:description" displayName="Titre" queryName="cmis:description">
<cmis:value>cmis:description</cmis:value>
</cmis:propertyString>
<cmis:propertyString propertyDefinitionId="ca:anotherText2" displayName="ca:anotherText2" queryName="ca:anotherText2">
<cmis:value>another text</cmis:value>
</cmis:propertyString>
</cmis:properties>
</cmisra:object>
<cmisra:content>
<cmisra:mediatype>text/plain</cmisra:mediatype>
<cmisra:base64>VGhlIHF1aWNrIGJyb3duIGZveCBqdW1wcyBvdmVyIHRoZSBsYXp5IGRvZy4=</cmisra:base64>
</cmisra:content>
</entry>
01-23-2014 06:48 AM
01-23-2014 10:22 AM
<cmis:propertyId propertyDefinitionId="cmis:objectTypeId">
<cmis:value>D:ca:customContent</cmis:value>
</cmis:propertyId>
<cmis:propertyString propertyDefinitionId="ca:anotherText2" displayName="ca:anotherText2" queryName="ca:anotherText2">
<cmis:value>another text</cmis:value>
</cmis:propertyString>
01-24-2014 04:25 AM
public static synchronized void testPost (String strName,String strPath) throws Exception
{
String url="http://localhost:8080/share/proxy/alfresco/api/type/prs%3amydocument/formprocessor";
String param="{";
param+="\"alf_destination\":\"workspace://SpacesStore/2198ff48-de64-4800-98c9-389136439153\",";
param+=",\"prop_cm_name\":\"HELLO MY NEW DOCUMENT\"";
param+=",\"prop_prs_department\":\"CORPORATIVE FINANCE\"";
param+="}";
org.apache.http.impl.client.DefaultHttpClient client = new org.apache.http.impl.client.DefaultHttpClient();
client.setCookieStore(cookieStore);
org.apache.http.client.methods.HttpPost post = new org.apache.http.client.methods.HttpPost(url);
post.setHeader("Content-Type", "application/json");
post.setEntity(new StringEntity(param,"UTF-8"));
org.apache.http.client.ResponseHandler<String> responseHandler = new org.apache.http.impl.client.BasicResponseHandler();
client.execute(post, responseHandler);
}
File f=new File ("D:/temp/mydocument.pdf");
post.setEntity (new FileEntity (f, "application/pdf"));
01-24-2014 12:54 PM
<cmisra:content>
<cmisra:mediatype>text/plain</cmisra:mediatype>
<cmisra:base64>VGhlIHF1aWNrIGJyb3duIGZveCBqdW1wcyBvdmVyIHRoZSBsYXp5IGRvZy4=</cmisra:base64>
</cmisra:content>
07-17-2015 01:38 PM
http://localhost:8080/alfresco/service/api/path/workspace/SpacesStore/Company%20Home/TESTFOLDER1/chi...
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.