use of org.wso2.carbon.apimgt.api.dto.EnvironmentPropertiesDTO in project carbon-apimgt by wso2.
the class ApisApiServiceImpl method apisApiIdEnvironmentsEnvIdKeysGet.
@Override
public Response apisApiIdEnvironmentsEnvIdKeysGet(String apiId, String envId, MessageContext messageContext) throws APIManagementException {
// validate api UUID
validateAPIExistence(apiId);
// validate environment UUID
validateEnvironment(envId);
APIProvider apiProvider = RestApiCommonUtil.getLoggedInUserProvider();
// get properties
EnvironmentPropertiesDTO properties = apiProvider.getEnvironmentSpecificAPIProperties(apiId, envId);
// convert to string to remove null values
String jsonContent = new Gson().toJson(properties);
return Response.ok().entity(jsonContent).build();
}
use of org.wso2.carbon.apimgt.api.dto.EnvironmentPropertiesDTO in project carbon-apimgt by wso2.
the class ApisApiServiceImpl method apisApiIdEnvironmentsEnvIdKeysPut.
@Override
public Response apisApiIdEnvironmentsEnvIdKeysPut(String apiId, String envId, Map<String, String> requestBody, MessageContext messageContext) throws APIManagementException {
// validate api UUID
validateAPIExistence(apiId);
// validate environment UUID
validateEnvironment(envId);
APIProvider apiProvider = RestApiCommonUtil.getLoggedInUserProvider();
// adding properties
EnvironmentPropertiesDTO properties = validateRequestPayload(requestBody);
apiProvider.addEnvironmentSpecificAPIProperties(apiId, envId, properties);
// get properties
properties = apiProvider.getEnvironmentSpecificAPIProperties(apiId, envId);
// convert to string to remove null values
String jsonContent = new Gson().toJson(properties);
return Response.ok().entity(jsonContent).build();
}
Aggregations