diff --git a/components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/APIProviderImpl.java b/components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/APIProviderImpl.java index 74bbaa33b8a8..5d0342dd06de 100644 --- a/components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/APIProviderImpl.java +++ b/components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/APIProviderImpl.java @@ -841,6 +841,14 @@ public API updateAPI(API api, API existingAPI) throws APIManagementException { apiLogObject.put(APIConstants.AuditLogConstants.CONTEXT, api.getContext()); apiLogObject.put(APIConstants.AuditLogConstants.VERSION, api.getId().getVersion()); apiLogObject.put(APIConstants.AuditLogConstants.PROVIDER, api.getId().getProviderName()); + try { + api.setCreatedTime(existingAPI.getCreatedTime()); + apiPersistenceInstance.updateAPI(new Organization(organization), APIMapper.INSTANCE.toPublisherApi(api)); + } catch (APIPersistenceException e) { + throw new APIManagementException("Error while updating API details", e); + } + APIUtil.logAuditMessage(APIConstants.AuditLogConstants.API, apiLogObject.toString(), + APIConstants.AuditLogConstants.UPDATED, this.username); //Validate Transports validateAndSetTransports(api); @@ -851,8 +859,7 @@ public API updateAPI(API api, API existingAPI) throws APIManagementException { } catch (APIPersistenceException e) { throw new APIManagementException("Error while updating API details", e); } - APIUtil.logAuditMessage(APIConstants.AuditLogConstants.API, apiLogObject.toString(), - APIConstants.AuditLogConstants.UPDATED, this.username); + //notify key manager with API update registerOrUpdateResourceInKeyManager(api, tenantDomain);