AnsweredAssumed Answered

Rest delete content item

Question asked by erictice on Jun 1, 2009
Latest reply on Jun 8, 2009 by erictice
I am using the Restful API and calling to delete items.  It appears to be deleting the item, but for some reason the status code comes back as 204 - No Content.  While technically this is true because it deleted it, shouldn't it be returning 200 - Success?  Note I am using 3.1 Labs. 

Delete call is as follows:

   @DELETE
   @Consumes("text/plain")
   @Path("/delete/{id}")
   public String deleteContentItem(@PathParam("id") String id) throws Exception{
      //DELETE /alfresco/service/api/path/{store_type}/{store_id}/{id}?includeChildren={includeChildren?}
      HttpClient client = buildClient("admin", "admin");
      DeleteMethod method = new DeleteMethod("http://localhost:8080/alfresco/service/api/node/workspace/SpacesStore/'+ id);
            
      try {
         int statusCode = client.executeMethod(method);

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

         return method.getResponseBodyAsString();
      } catch (Exception e) {
         logger.error("exception while processing message", e);
         return "Exception while getting person";
      }
   }
   
I don't know if this a bug or what alfresco expects.

Outcomes