I want to create a new folder into my Site MySiteABC and its first folder is "REALISATIONS". Now I want to create a new folder inside REALISATIONS, but when I ran the following code I got 404 error; { "status" : { "code" : 404, "name" : "Not Found", "description" : "Requested resource is not available." }, "message" : "", "exception" : "", "callstack" : [ ], "server" : "Community v5.0.0 (r86473-b92) schema 8 006", "time" : "16 déc. 2014 17:23:06" }
Can anyone tel me what I am doing wrong?? Do we require to create MultipartRequestEntity(parts, post.getParams())) for post here in this case??
I want to run the following script POST /alfresco/s/api/site/folder/{site}/{container} public static void makeDirectory( String host, int port, String login, String password, String filepath) throws Exception {
System.out.println(" url is ==" + url1 ); HttpClient client = new HttpClient(); client.getState().setCredentials( new AuthScope(host, 80),
new UsernamePasswordCredentials(login, password));
PostMethod post = new PostMethod(url1);
Part[] parts = {
new StringPart( "name", "bernard34"), new StringPart( "type", "cm:folder") };
try { post.setRequestEntity(new MultipartRequestEntity(parts, post.getParams())); post.setDoAuthentication(true);// int status = client.executeMethod(post);
Ignore the cloud/oauth stuff. Look at the createFolder() method. You'll see that using the OpenCMIS Java client from Apache Chemistry is a very simple way to create folders in Alfresco from Java code.