diff --git a/components/apimgt/org.wso2.carbon.apimgt.rest.api.publisher.v1.common/src/main/java/org/wso2/carbon/apimgt/rest/api/publisher/v1/common/mappings/ExportUtils.java b/components/apimgt/org.wso2.carbon.apimgt.rest.api.publisher.v1.common/src/main/java/org/wso2/carbon/apimgt/rest/api/publisher/v1/common/mappings/ExportUtils.java index 2907ff35edf3..c4c0849a926d 100644 --- a/components/apimgt/org.wso2.carbon.apimgt.rest.api.publisher.v1.common/src/main/java/org/wso2/carbon/apimgt/rest/api/publisher/v1/common/mappings/ExportUtils.java +++ b/components/apimgt/org.wso2.carbon.apimgt.rest.api.publisher.v1.common/src/main/java/org/wso2/carbon/apimgt/rest/api/publisher/v1/common/mappings/ExportUtils.java @@ -87,6 +87,7 @@ import java.util.HashMap; import java.util.HashSet; import java.util.List; +import java.util.Map; import java.util.Set; import static org.wso2.carbon.apimgt.impl.APIConstants.API_DATA_PRODUCTION_ENDPOINTS; @@ -227,9 +228,24 @@ public static File exportApi(APIProvider apiProvider, APIIdentifier apiIdentifie String prodSequenceName = null; if (endpointConfig.get("sandbox") != null) { sandSequenceName = endpointConfig.get("sandbox").getAsString(); + } else { + sandSequenceName = apiProvider.getCustomBackendSequenceOfAPIByUUID(currentApiUuid, + APIConstants.API_KEY_TYPE_SANDBOX); } if (endpointConfig.get("production") != null) { prodSequenceName = endpointConfig.get("production").getAsString(); + } else { + prodSequenceName = apiProvider.getCustomBackendSequenceOfAPIByUUID(currentApiUuid, + APIConstants.API_KEY_TYPE_PRODUCTION); + } + if (apiDtoToReturn.getEndpointConfig() != null) { + Map endpointConf = (Map) apiDtoToReturn.getEndpointConfig(); + if (endpointConf != null && APIConstants.ENDPOINT_TYPE_SEQUENCE.equals( + endpointConf.get(API_ENDPOINT_CONFIG_PROTOCOL_TYPE))) { + endpointConf.put("sandbox", sandSequenceName); + endpointConf.put("production", prodSequenceName); + apiDtoToReturn.setEndpointConfig(endpointConf); + } } addCustomBackendToArchive(archivePath, apiProvider, currentApiUuid, sandSequenceName, prodSequenceName); }