public String partialUpdate(Request request, Response response) { String environmentName = request.params("name"); JsonReader jsonReader = GsonTransformer.getInstance().jsonReaderFrom(request.body()); PatchEnvironmentRequest patchRequest = PatchEnvironmentRequestRepresenter.fromJSON(jsonReader); HttpLocalizedOperationResult operationResult = new HttpLocalizedOperationResult(); EnvironmentConfig environmentConfig = fetchEntityFromConfig(environmentName); environmentConfigService.patchEnvironment(environmentConfig, patchRequest.getPipelineToAdd(), patchRequest.getPipelineToRemove(), patchRequest.getAgentsToAdd(), patchRequest.getAgentsToRemove(), patchRequest.getEnvironmentVariablesToAdd(), patchRequest.getEnvironmentVariablesToRemove(), currentUsername(), operationResult ); EnvironmentConfig updateConfigElement = fetchEntityFromConfig(environmentName); setEtagHeader(updateConfigElement, response); return handleCreateOrUpdateResponse(request, response, updateConfigElement, operationResult); }