@POST
  @Path("/remove")
  @Consumes(MediaType.APPLICATION_JSON)
  @Produces(MediaType.APPLICATION_JSON)
  public Response remove(MultiRemoveRequest request, @Context HttpHeaders headers,
                         @Context UriInfo ui) {
    try {
      HdfsApi api = getApi();
      ResponseBuilder result;
      String message = "";
      if(request.paths.size() == 0) {
        result = Response.ok(new FileOperationResult(false, "No path entries provided."));
      } else {
        int index = 0;
        for (MultiRemoveRequest.PathEntry entry : request.paths) {
          try {
            if (api.delete(entry.path, entry.recursive)) {
              index++;
            } else {
              message = "Failed to remove '" + entry.path + "'";
              break;
            }
          } catch (IOException exception) {
            message = exception.getMessage();
            logger.error("Failed to remove '{}'. Exception: {}", entry.path, exception.getMessage());
            break;
          }

        }
        if (index == request.paths.size()) {
          result = Response.ok(new FileOperationResult(true)).status(200);
        } else {
          FileOperationResult errorResult = getFailureFileOperationResult(getPathsFromPathsEntries(request.paths), index, message);
          result = Response.ok(errorResult).status(422);
        }
      }
      return result.build();
    } catch (Exception ex) {
      throw new ServiceFormattedException(ex.getMessage(), ex);
    }
  }
Remove
@param request remove request
@return response with success
contrib/views/commons/src/main/java/org/apache/ambari/view/commons/hdfs/FileOperationService.java