As we transition to the new Hyland Community, some post links may be temporarily disrupted as we finalize redirects. We apologize for the inconvenience and are working to resolve this as quickly as possible. Details.
../node/
../path/
paradigm shift
GET /alfresco/service/api/node/content{property}/{store_type}/{store_id}/{id}?a={attach?}&streamId={streamId?} GET /alfresco/service/api/path/content{property}/{store_type}/{store_id}/{nodepath}?a={attach?}&streamId={streamId?}
GET /alfresco/service/api/node/content{property}/{store_type}/{store_id}/{id}?a={attach?} GET /alfresco/service/api/path/content{property}/{store_type}/{store_id}/{id}?a={attach?}
/alfresco/service/api/node
/alfresco/service/api/path
public String login() { String ticket = null; HttpClient client = new HttpClient(); String apiurl = "http://localhost:8080/alfresco/service/api/login"; PostMethod post = new PostMethod(apiurl); try { JSONObject login = new JSONObject(); login.put("username", "admin"); login.put("password", "admin"); //System.out.println(login.toString()); post.setDoAuthentication(true); post.setRequestHeader("Content-Type", "application/json"); post.setRequestEntity(new StringRequestEntity(login.toString(), "application/json", "UTF-8")); int status = client.executeMethod(post); if (status != HttpStatus.SC_OK) { System.err.println("Method failed: " + post.getStatusLine()); } String responseData = post.getResponseBodyAsString(); System.out.println(responseData); JSONObject response = new JSONObject(responseData); ticket = response.getJSONObject("data").getString("ticket"); } catch (Exception e) { e.printStackTrace(); } finally { post.releaseConnection(); } return ticket; } public void getContent(String ticket){ HttpClient client = new HttpClient(); String uid = "e7d585dd-16f1-4b31-9cd5-a9f8e2869a17"; String apiurl = "http://localhost:8080/alfresco/service/api/node/content;cm:content/workspace/SpacesStore/" + uid + "?alf_ticket="+ticket; GetMethod get = new GetMethod(apiurl); try { get.setDoAuthentication(true); get.setRequestHeader("Content-Type", "application/json"); int status = client.executeMethod(get); if (status != HttpStatus.SC_OK) { System.err.println("Method failed: " + get.getStatusLine()); } String resultString = get.getResponseBodyAsString(); System.out.println(resultString); } catch (Exception e) { e.printStackTrace(); } finally { get.releaseConnection(); } } public static void main(String[] args) { LoginAddGetContentTest t = new LoginAddGetContentTest(); String ticket = t.login(); System.out.println(ticket); t.getContent(ticket); }