code: @POST
     @RolesAllowed("administrators")
     @Path("/remove-workspace/{repositoryName}/{workspaceName}/{forseSessionClose}/")
     public Response removeWorkspace(@Context UriInfo uriInfo, @PathParam("repositoryName") String repositoryName,
        @PathParam("workspaceName") String workspaceName, @PathParam("forseSessionClose") Boolean forseSessionClose)
     {
        String errorMessage = new String();
        Status status;
  
        try
        {
           ManageableRepository repository = repositoryService.getRepository(repositoryName);
  
           if (forseSessionClose)
           {
              forceCloseSession(repositoryName, workspaceName);
           }
  
           if (repository.canRemoveWorkspace(workspaceName))
           {
              repository.removeWorkspace(workspaceName);
              repositoryService.getConfig().retain(); // save configuration to persistence (file or persister)
              return Response.ok().build();
           }
           return Response.status(Status.CONFLICT).entity(
              "Can't remove workspace " + workspaceName + " in repository " + repositoryName).cacheControl(NO_CACHE)
              .build();
        }
        catch (RepositoryException e)
        {
           if (log.isDebugEnabled())
           {
              log.error(e.getMessage(), e);
           }
           errorMessage = e.getMessage();
           status = Status.NOT_FOUND;
        }
        catch (RepositoryConfigurationException e)
        {
           if (log.isDebugEnabled())
           {
              log.error(e.getMessage(), e);
           }
           errorMessage = e.getMessage();
           status = Status.NOT_FOUND;
        }
        catch (Throwable e) //NOSONAR
        {
           if (log.isDebugEnabled())
           {
              log.error(e.getMessage(), e);
           }
           errorMessage = e.getMessage();
           status = Status.INTERNAL_SERVER_ERROR;
        }
  
        return Response.status(status).entity(errorMessage).type(MediaType.TEXT_PLAIN_TYPE).cacheControl(NO_CACHE)
           .build();
     }
docs: Removes an existing workspace from a given repository.
  
  @param uriInfo the uri location
  @param repositoryName the name of the repository
  @param workspaceName the name of the workspace
  @param forseSessionClose a flag indicating whether or not the current sessions must be closed
  @return Response return the Response
  @LevelAPI Experimental