06-13-2017 04:40 AM
Hi all,
I m using Alfresco Community 5.2. And I added some sites, folders and people by using REST API. But Alfresco Rest Api is running so slowly. For example When I updated just about 1000 site with rest api, This process takes about 40 minutes.
How can I do this issue or How can i speed this up ? Please help..
Thanks in advance.
06-13-2017 09:50 AM
Much more detail is needed before we can begin to help. For example:
06-14-2017 03:05 AM
private static void addMemebersToSites(String usid,String siteID,String role)
{
HttpClient client = new HttpClient();
String apiurl = api+"alfresco/service/api/sites/"+siteID+"/memberships";
PostMethod post = null;
try {
post = new PostMethod(URIUtil.encodePath(apiurl));
JsonObject person = new JsonObject();
person.addProperty("userName", usid); JsonObject member = new JsonObject();
member.addProperty("role", role);
member.add("person", person);
post.setDoAuthentication(true);
post.setRequestHeader("Content-Type", "application/json; charset=utf-8");
post.setRequestHeader(HttpHeaders.AUTHORIZATION, pass);
post.setRequestEntity(new StringRequestEntity(member.toString(), "application/json; charset=utf-8", "UTF-8"));
int status = client.executeMethod(post);
if(status == 200 || status==201)
{
System.out.println(status + " " +usid + " is added to this web site");}
elseSystem.out.println(status + " " + usid + " can not added to this web site(error)");
} catch (Exception e) {
e.printStackTrace();
} finally {
post.releaseConnection();
}
}
Explore our Alfresco products with the links below. Use labels to filter content by product module.