04-25-2014 12:56 PM
org.apache.commons.httpclient.HttpClient
04-25-2014 09:00 PM
http://localhost:8080/alfresco/service/api/login
to login and get login ticket.
HttpClient client = new HttpClient();
String apiurl = "http://localhost:8080/alfresco/service/api/login";
PostMethod post = new PostMethod(apiurl);
JSONObject login = new JSONObject();
login.put("username", "admin");
login.put("password", "admin");
post.setDoAuthentication(true);
post.setRequestHeader("Content-Type", "application/json");
post.setRequestEntity(new StringRequestEntity(login.toString(),"application/json", "UTF-8"));
int status = client.executeMethod(post);
String responseData = post.getResponseBodyAsString();
JSONObject response = new JSONObject(responseData);
String ticket = response.getJSONObject("data").getString("ticket"); // get login ticket
String apiurl = other webscript url "+"?alf_ticket="+ticket; //pass ticket as parameter in following calls
PostMethod post = new PostMethod(apiurl);
04-26-2014 08:08 AM
05-07-2014 03:50 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.