03-03-2016 01:08 AM
Hi ,
I trying to create a site in alfresco share using a webscript in java and this i am doing with the help of below code:
HttpClient client = new HttpClient();
PostMethod httpPost = new PostMethod ("http://localhost:8080/share/service/modules/create-site?authority="+username+"&alf_ticket="+alf_tkt);
JSONObject site = new JSONObject();
try {
site.put("shortName", "java_test");
site.put("Visiblity", "Public");
site.put("sitePreset", "site-dashboard");
site.put("title", "java_test");
site.put("description", "test");
httpPost.setDoAuthentication(true);
httpPost.setRequestHeader("Content-Type", "application/json");
httpPost.setRequestEntity( new StringRequestEntity(site.toString(), "application/json", "UTF-8"));
int status1 = client.executeMethod(httpPost);
if (status1 != HttpStatus.SC_OK) {
System.err.println("Method failed: " + httpPost.getStatusLine());
}
} catch (JSONException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
It is giving me the error as HTTP/1.1 401 Unauthorized.
Please help me in this.
Regards,
Nancy
04-18-2016 05:33 AM
03-29-2016 04:44 AM
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.