Source:
public Response exportApiByParams(String name, String version, String providerName, String format, Boolean preserveStatus) { ExportFormat exportFormat; String userName; APIIdentifier apiIdentifier; APIProvider apiProvider; String apiDomain; String apiRequesterDomain; File file; boolean isStatusPreserved = preserveStatus == null || preserveStatus; if (name == null || version == null || providerName == null) { RestApiUtil.handleBadRequest("None of 'name', 'version' or 'provider' should not be null", log); } try { exportFormat = StringUtils.isNotEmpty(format) ? ExportFormat.valueOf(format.toUpperCase()) : ExportFormat.YAML; userName = RestApiUtil.getLoggedInUsername(); apiDomain = MultitenantUtils.getTenantDomain(providerName); apiRequesterDomain = RestApiUtil.getLoggedInUserTenantDomain(); if (!StringUtils.equals(apiDomain, apiRequesterDomain)) { RestApiUtil.handleAuthorizationFailure(RestApiConstants.RESOURCE_API + " name:" + name + " version:" + version + " provider:" + providerName, log); } apiIdentifier = new APIIdentifier(APIUtil.replaceEmailDomain(providerName), name, version); apiProvider = RestApiUtil.getLoggedInUserProvider(); if (!apiProvider.isAPIAvailable(apiIdentifier)) { String errorMessage = "Error occurred while exporting. API: " + name + " version: " + version + " not found"; RestApiUtil.handleResourceNotFoundError(errorMessage, log); } file = APIExportUtil.exportApi(apiProvider, apiIdentifier, userName, exportFormat, preserveStatus); return Response.ok(file) .header(RestApiConstants.HEADER_CONTENT_DISPOSITION, "attachment; filename=\"" + file.getName() + "\"") .build(); } catch (APIManagementException | APIImportExportException e) { RestApiUtil.handleInternalServerError("Error while exporting " + RestApiConstants.RESOURCE_API, e, log); } return null; }

Target:
public Response exportApiByParams(String name, String version, String providerName, String format, Boolean preserveStatus) { ExportFormat exportFormat; String userName; APIIdentifier apiIdentifier; APIProvider apiProvider; String apiDomain; String apiRequesterDomain; File file; boolean isStatusPreserved = preserveStatus == null || preserveStatus; if (name == null || version == null || providerName == null) { RestApiUtil.handleBadRequest("'name', 'version' or 'provider' should not be null", log); } try { exportFormat = StringUtils.isNotEmpty(format) ? ExportFormat.valueOf(format.toUpperCase()) : ExportFormat.YAML; userName = RestApiUtil.getLoggedInUsername(); apiDomain = MultitenantUtils.getTenantDomain(providerName); apiRequesterDomain = RestApiUtil.getLoggedInUserTenantDomain(); if (!StringUtils.equals(apiDomain, apiRequesterDomain)) { RestApiUtil.handleAuthorizationFailure(RestApiConstants.RESOURCE_API + " name:" + name + " version:" + version + " provider:" + providerName, log); } apiIdentifier = new APIIdentifier(APIUtil.replaceEmailDomain(providerName), name, version); apiProvider = RestApiUtil.getLoggedInUserProvider(); if (!apiProvider.isAPIAvailable(apiIdentifier)) { String errorMessage = "Error occurred while exporting. API: " + name + " version: " + version + " not found"; RestApiUtil.handleResourceNotFoundError(errorMessage, log); } file = APIExportUtil.exportApi(apiProvider, apiIdentifier, userName, exportFormat, preserveStatus); return Response.ok(file) .header(RestApiConstants.HEADER_CONTENT_DISPOSITION, "attachment; filename=\"" + file.getName() + "\"") .build(); } catch (APIManagementException | APIImportExportException e) { RestApiUtil.handleInternalServerError("Error while exporting " + RestApiConstants.RESOURCE_API, e, log); } return null; }