Source:
public boolean updateApiFromString(String apiName, String apiData) throws APIException{ final Lock lock = getLock(); try { lock.lock(); assertNameNotEmpty(apiName); OMElement apiElement = AXIOMUtil.stringToOM(apiData); OMAttribute nameAttribute = apiElement.getAttribute(new QName("name")); if(nameAttribute == null || "".equals(nameAttribute.getAttributeValue().trim())){ apiElement.addAttribute("name", apiName, null); } API oldAPI = null; API api = APIFactory.createAPI(apiElement); SynapseConfiguration synapseConfiguration = getSynapseConfiguration(); oldAPI = synapseConfiguration.getAPI(apiName); if (oldAPI != null){ oldAPI.destroy(); api.setFileName(oldAPI.getFileName()); } synapseConfiguration.removeAPI(apiName); synapseConfiguration.addAPI(api.getName(),api); api.init(getSynapseEnvironment()); CAppArtifactDataService cAppArtifactDataService = ConfigHolder.getInstance(). getcAppArtifactDataService(); if (cAppArtifactDataService.isArtifactDeployedFromCApp(getTenantId(), ServiceBusConstants.API_TYPE + File.separator + apiName)) { cAppArtifactDataService.setEdited(getTenantId(), ServiceBusConstants.API_TYPE + File.separator + apiName); } else { MediationPersistenceManager pm = getMediationPersistenceManager(); String fileName = api.getFileName(); pm.deleteItem(apiName, fileName, ServiceBusConstants.ITEM_TYPE_REST_API); pm.saveItem(apiName, ServiceBusConstants.ITEM_TYPE_REST_API); } return true; } catch (XMLStreamException e) { handleException(log, "Could not parse String to OMElement", e); return false; } catch (Exception e) { e.printStackTrace(); return false; } finally { lock.unlock(); } }

Target:
public boolean updateApiFromString(String apiName, String apiData) throws APIException{ final Lock lock = getLock(); try { lock.lock(); assertNameNotEmpty(apiName); OMElement apiElement = AXIOMUtil.stringToOM(apiData); OMAttribute nameAttribute = apiElement.getAttribute(new QName("name")); if(nameAttribute == null || "".equals(nameAttribute.getAttributeValue().trim())){ apiElement.addAttribute("name", apiName, null); } API oldAPI = null; API api = APIFactory.createAPI(apiElement); SynapseConfiguration synapseConfiguration = getSynapseConfiguration(); oldAPI = synapseConfiguration.getAPI(apiName); if (oldAPI != null){ oldAPI.destroy(); api.setFileName(oldAPI.getFileName()); } synapseConfiguration.removeAPI(apiName); synapseConfiguration.addAPI(api.getName(),api); api.init(getSynapseEnvironment()); CAppArtifactDataService cAppArtifactDataService = ConfigHolder.getInstance(). getcAppArtifactDataService(); String artifactName = getArtifactName(artifactType, apiName); if (cAppArtifactDataService.isArtifactDeployedFromCApp(getTenantId(), artifactName)) { cAppArtifactDataService.setEdited(getTenantId(), artifactName); } else { MediationPersistenceManager pm = getMediationPersistenceManager(); String fileName = api.getFileName(); pm.deleteItem(apiName, fileName, ServiceBusConstants.ITEM_TYPE_REST_API); pm.saveItem(apiName, ServiceBusConstants.ITEM_TYPE_REST_API); } return true; } catch (XMLStreamException e) { handleException(log, "Could not parse String to OMElement", e); return false; } catch (Exception e) { handleException(log, "Unable to update API ", e); return false; } finally { lock.unlock(); } }