cancel
Showing results for 
Search instead for 
Did you mean: 

Restful api getContent returning ATOM

erictice
Champ in-the-making
Champ in-the-making
Based on the documentation it would appear that the get content should return a ByteArrayInputStream.  For some reason it is returning and Atom file with the following call:

http://localhost:8080/alfresco/service/api/node/workspace/SpacesStore/+id

I try it with path instead of node and no difference.  I assume that I should be able to have the following, but it doesn't return the stream as expected:

@GET
   @Produces( "application/octet-stream")
   @Path("/getContent/{id}")
   public InputStream getContent(@PathParam("id") String id) throws Exception {

      HttpClient client = buildClient("admin", "admin");

      GetMethod method = new GetMethod(
            "http://localhost:8080/alfresco/service/api/node/workspace/SpacesStore/'+id);

      try {
         // Send GET request
         int statusCode = client.executeMethod(method);

         if (statusCode != HttpStatus.SC_OK) {
            System.err.println("Method failed: " + method.getStatusLine());
         }

         return method.getResponseBodyAsStream();
      } catch (Exception e) {
         logger.error("exception while processing message", e);
         //return "Exception while getting person";
         return null;
      }
      
   }
1 REPLY 1

mikeh
Star Contributor
Star Contributor
I think the API you want is at: /api/node/{store_type}/{store_id}/{id}/content

Mike