diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.annotations/pom.xml b/components/apimgt-extensions/org.wso2.carbon.apimgt.annotations/pom.xml index 4c32e6f2ae..a530cbcfa1 100644 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.annotations/pom.xml +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.annotations/pom.xml @@ -73,8 +73,8 @@ org.wso2.carbon.apimgt.annotations.* - org.osgi.framework, - org.osgi.service.component, + org.osgi.framework.*;version="${imp.package.version.osgi.framework}", + org.osgi.service.*;version="${imp.package.version.osgi.service}", org.apache.commons.logging, javax.servlet, javax.xml.*, diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension.api/pom.xml b/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension.api/pom.xml index a77543fc93..9ec68e7315 100644 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension.api/pom.xml +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension.api/pom.xml @@ -34,42 +34,56 @@ http://wso2.org - - org.apache.cxf - cxf-rt-frontend-jaxws - provided + io.swagger + swagger-annotations - org.apache.cxf - cxf-rt-frontend-jaxrs + org.springframework + spring-web provided org.apache.cxf - cxf-rt-transports-http + cxf-bundle-jaxrs provided + + + + + + + + + + + + + + + + - - org.codehaus.jackson - jackson-core-asl - + + + + org.codehaus.jackson jackson-jaxrs - - javax - javaee-web-api - provided - - - javax.ws.rs - jsr311-api - provided - + + + + + + + + + + commons-httpclient.wso2 commons-httpclient diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension.api/src/main/java/org/wso2/carbon/apimgt/application/extension/api/ApiApplicationRegistrationServiceImpl.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension.api/src/main/java/org/wso2/carbon/apimgt/application/extension/api/ApiApplicationRegistrationServiceImpl.java index aec0df4a16..96d3c8e059 100644 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension.api/src/main/java/org/wso2/carbon/apimgt/application/extension/api/ApiApplicationRegistrationServiceImpl.java +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension.api/src/main/java/org/wso2/carbon/apimgt/application/extension/api/ApiApplicationRegistrationServiceImpl.java @@ -27,8 +27,8 @@ import org.wso2.carbon.apimgt.application.extension.api.util.RegistrationProfile import org.wso2.carbon.apimgt.application.extension.constants.ApiApplicationConstants; import org.wso2.carbon.apimgt.application.extension.dto.ApiApplicationKey; import org.wso2.carbon.apimgt.application.extension.exception.APIManagerException; -import org.wso2.carbon.apimgt.integration.client.OAuthRequestInterceptor; -import org.wso2.carbon.apimgt.integration.client.store.StoreClient; +//import org.wso2.carbon.apimgt.integration.client.OAuthRequestInterceptor; +//import org.wso2.carbon.apimgt.integration.client.store.StoreClient; import org.wso2.carbon.base.MultitenantConstants; import org.wso2.carbon.context.PrivilegedCarbonContext; import org.wso2.carbon.device.mgt.common.exceptions.DeviceManagementException; @@ -110,12 +110,10 @@ public class ApiApplicationRegistrationServiceImpl implements ApiApplicationRegi if (username.equals(registrationProfile.getUsername())) { synchronized (ApiApplicationRegistrationServiceImpl.class) { - StoreClient storeClient = new StoreClient(new OAuthRequestInterceptor(registrationProfile.getUsername(), - registrationProfile.getPassword())); ApiApplicationKey apiApplicationKey = apiManagementProviderService.generateAndRetrieveApplicationKeys( applicationName, registrationProfile.getTags(), ApiApplicationConstants.DEFAULT_TOKEN_TYPE, username, - registrationProfile.isAllowedToAllDomains(), validityPeriod, storeClient); + registrationProfile.isAllowedToAllDomains(), validityPeriod); return Response.status(Response.Status.CREATED).entity(apiApplicationKey.toString()).build(); } } diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension.api/src/main/java/org/wso2/carbon/apimgt/application/extension/api/filter/ApiPermissionFilter.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension.api/src/main/java/org/wso2/carbon/apimgt/application/extension/api/filter/ApiPermissionFilter.java index 0c78488a2d..fc3efadb42 100644 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension.api/src/main/java/org/wso2/carbon/apimgt/application/extension/api/filter/ApiPermissionFilter.java +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension.api/src/main/java/org/wso2/carbon/apimgt/application/extension/api/filter/ApiPermissionFilter.java @@ -25,7 +25,12 @@ import org.wso2.carbon.user.api.UserRealm; import org.wso2.carbon.user.api.UserStoreException; import org.wso2.carbon.utils.multitenancy.MultitenantUtils; -import javax.servlet.*; +import javax.servlet.Filter; +import javax.servlet.FilterChain; +import javax.servlet.FilterConfig; +import javax.servlet.ServletException; +import javax.servlet.ServletRequest; +import javax.servlet.ServletResponse; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.xml.bind.JAXBContext; diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension.api/src/main/webapp/META-INF/webapp-classloading.xml b/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension.api/src/main/webapp/META-INF/webapp-classloading.xml index b410b42670..5cb6aa6282 100644 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension.api/src/main/webapp/META-INF/webapp-classloading.xml +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension.api/src/main/webapp/META-INF/webapp-classloading.xml @@ -31,5 +31,5 @@ Tomcat environment is the default and every webapps gets it even if they didn't specify it. e.g. If a webapps requires CXF, they will get both Tomcat and CXF. --> - CXF,Carbon + CXF3,Carbon diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension/pom.xml b/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension/pom.xml index a04bf65bb9..9e70ed3009 100644 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension/pom.xml +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension/pom.xml @@ -51,14 +51,25 @@ org.wso2.carbon org.wso2.carbon.logging - - org.wso2.carbon.devicemgt - org.wso2.carbon.apimgt.integration.client - - - org.wso2.carbon.devicemgt - org.wso2.carbon.apimgt.integration.generated.client - + + + + + + + + + + org.wso2.carbon.apimgt + org.wso2.carbon.apimgt.api + 9.0.5 + + + org.wso2.carbon.apimgt + org.wso2.carbon.apimgt.impl + 9.0.5 + provided + com.googlecode.json-simple.wso2 json-simple @@ -72,6 +83,11 @@ org.wso2.carbon.identity.jwt.client.extension provided + + org.wso2.carbon.devicemgt + org.wso2.carbon.device.mgt.core + provided + @@ -100,24 +116,26 @@ ${carbon.device.mgt.version} API Management Application Bundle org.wso2.carbon.apimgt.application.extension.internal - - org.osgi.framework, - org.osgi.service.component, - org.apache.commons.logging.*, - org.wso2.carbon.user.core.*, - org.wso2.carbon.user.api, - org.wso2.carbon.utils.multitenancy, - org.json.simple, - org.wso2.carbon.context, - org.wso2.carbon.base, - org.wso2.carbon.registry.core.*;resolution:=optional, - org.wso2.carbon.registry.indexing.*; version="${carbon.registry.imp.pkg.version.range}", - org.wso2.carbon.apimgt.integration.client.*, - org.wso2.carbon.apimgt.integration.generated.client.store.api, - org.wso2.carbon.apimgt.integration.generated.client.store.model, - org.wso2.carbon.identity.jwt.client.extension.*, - feign - + + org.apache.commons.lang;version="[2.6,3)",org.apache.c + ommons.logging;version="[1.2,2)",org.json.simple,org.osgi.framework;v + ersion="${imp.package.version.osgi.framework}",org.osgi.service.component;version="${imp.package.version.osgi.service}",org.wso + 2.carbon.apimgt.api;version="[9.0,10)",org.wso2.carbon.apimgt.api.dto + ;version="[9.0,10)",org.wso2.carbon.apimgt.api.model;version="[9.0,10 + )",org.wso2.carbon.apimgt.application.extension.bean,org.wso2.carbon. + apimgt.application.extension.dto,org.wso2.carbon.apimgt.application.e + xtension.exception,org.wso2.carbon.apimgt.impl;version="[9.0,10)",org + .wso2.carbon.apimgt.impl.utils;version="[9.0,10)",org.wso2.carbon.con + text;version="[4.6,5)",org.wso2.carbon.device.mgt.core.config.ui;vers + ion="[4.1,5)",org.wso2.carbon.identity.jwt.client.extension,org.wso2. + carbon.identity.jwt.client.extension.dto,org.wso2.carbon.identity.jwt + .client.extension.exception,org.wso2.carbon.identity.jwt.client.exten + sion.service,org.wso2.carbon.registry.core.exceptions;version="[1.0,2 + )",org.wso2.carbon.registry.core.service;version="[1.0,2)",org.wso2.c + arbon.registry.indexing.service;version="[4.7,5)",org.wso2.carbon.use + r.api;version="[1.0,2)",org.wso2.carbon.user.core.service;version="[4 + .6,5)",org.wso2.carbon.user.core.tenant;version="[4.6,5)" + !org.wso2.carbon.apimgt.application.extension.internal, org.wso2.carbon.apimgt.application.extension.* diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension/src/main/java/org/wso2/carbon/apimgt/application/extension/APIManagementProviderService.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension/src/main/java/org/wso2/carbon/apimgt/application/extension/APIManagementProviderService.java index 62d353d0fd..67fe9e2583 100644 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension/src/main/java/org/wso2/carbon/apimgt/application/extension/APIManagementProviderService.java +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension/src/main/java/org/wso2/carbon/apimgt/application/extension/APIManagementProviderService.java @@ -20,8 +20,9 @@ package org.wso2.carbon.apimgt.application.extension; import org.wso2.carbon.apimgt.application.extension.dto.ApiApplicationKey; import org.wso2.carbon.apimgt.application.extension.exception.APIManagerException; -import org.wso2.carbon.apimgt.integration.client.store.StoreClient; import org.wso2.carbon.identity.jwt.client.extension.dto.AccessTokenInfo; +//import org.wso2.carbon.apimgt.integration.client.store.StoreClient; +//import org.wso2.carbon.identity.jwt.client.extension.dto.AccessTokenInfo; /** * This comprise on operation that is been done with api manager from CDMF. This service needs to be implemented in APIM. @@ -61,17 +62,17 @@ public interface APIManagementProviderService { * @param username to whom the application is created * @param isAllowedAllDomains application is allowed to all the tenants * @param validityTime validity period of the application - * @param storeClient Specified store client +// * @param storeClient Specified store client * @return consumerkey and secrete of the created application. * @throws APIManagerException */ + ApiApplicationKey generateAndRetrieveApplicationKeys(String apiApplicationName, String tags[], String keyType, String username, boolean isAllowedAllDomains, - String validityTime, - StoreClient storeClient) throws APIManagerException; + String validityTime, String scopes) throws APIManagerException; /** * Remove APIM Application. diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension/src/main/java/org/wso2/carbon/apimgt/application/extension/APIManagementProviderServiceImpl.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension/src/main/java/org/wso2/carbon/apimgt/application/extension/APIManagementProviderServiceImpl.java index 0c957fd4e7..cc385dff44 100644 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension/src/main/java/org/wso2/carbon/apimgt/application/extension/APIManagementProviderServiceImpl.java +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension/src/main/java/org/wso2/carbon/apimgt/application/extension/APIManagementProviderServiceImpl.java @@ -18,19 +18,46 @@ package org.wso2.carbon.apimgt.application.extension; -import feign.FeignException; +//import feign.FeignException; +import org.apache.commons.lang.StringUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.wso2.carbon.apimgt.api.APIAdmin; +import org.wso2.carbon.apimgt.api.APIConsumer; +import org.wso2.carbon.apimgt.api.APIManagementException; +import org.wso2.carbon.apimgt.api.APIProvider; +import org.wso2.carbon.apimgt.api.dto.KeyManagerConfigurationDTO; +import org.wso2.carbon.apimgt.api.model.API; +import org.wso2.carbon.apimgt.api.model.APIKey; +import org.wso2.carbon.apimgt.api.model.ApiTypeWrapper; +import org.wso2.carbon.apimgt.api.model.Application; +import org.wso2.carbon.apimgt.api.model.KeyManagerConfiguration; +import org.wso2.carbon.apimgt.api.model.SubscribedAPI; +import org.wso2.carbon.apimgt.api.model.Subscriber; import org.wso2.carbon.apimgt.application.extension.bean.APIRegistrationProfile; import org.wso2.carbon.apimgt.application.extension.constants.ApiApplicationConstants; import org.wso2.carbon.apimgt.application.extension.dto.ApiApplicationKey; import org.wso2.carbon.apimgt.application.extension.exception.APIManagerException; import org.wso2.carbon.apimgt.application.extension.internal.APIApplicationManagerExtensionDataHolder; import org.wso2.carbon.apimgt.application.extension.util.APIManagerUtil; -import org.wso2.carbon.apimgt.integration.client.OAuthRequestInterceptor; -import org.wso2.carbon.apimgt.integration.client.store.StoreClient; -import org.wso2.carbon.apimgt.integration.generated.client.store.model.*; +import org.wso2.carbon.apimgt.impl.APIAdminImpl; +import org.wso2.carbon.apimgt.impl.APIConstants; +import org.wso2.carbon.apimgt.impl.APIManagerFactory; +//import org.wso2.carbon.apimgt.integration.client.OAuthRequestInterceptor; +//import org.wso2.carbon.apimgt.integration.client.store.StoreClient; +//import org.wso2.carbon.apimgt.integration.generated.client.store.model.APIInfo; +//import org.wso2.carbon.apimgt.integration.generated.client.store.model.APIList; +//import org.wso2.carbon.apimgt.integration.generated.client.store.model.Application; +//import org.wso2.carbon.apimgt.integration.generated.client.store.model.ApplicationInfo; +//import org.wso2.carbon.apimgt.integration.generated.client.store.model.ApplicationKey; +//import org.wso2.carbon.apimgt.integration.generated.client.store.model.ApplicationKeyGenerateRequest; +//import org.wso2.carbon.apimgt.integration.generated.client.store.model.ApplicationList; +//import org.wso2.carbon.apimgt.integration.generated.client.store.model.Subscription; +//import org.wso2.carbon.apimgt.integration.generated.client.store.model.SubscriptionList; +import org.wso2.carbon.apimgt.impl.utils.APIUtil; import org.wso2.carbon.context.PrivilegedCarbonContext; +import org.wso2.carbon.device.mgt.core.config.ui.UIConfiguration; +import org.wso2.carbon.device.mgt.core.config.ui.UIConfigurationManager; import org.wso2.carbon.identity.jwt.client.extension.JWTClient; import org.wso2.carbon.identity.jwt.client.extension.dto.AccessTokenInfo; import org.wso2.carbon.identity.jwt.client.extension.exception.JWTClientException; @@ -39,7 +66,11 @@ import org.wso2.carbon.user.api.UserStoreException; import org.wso2.carbon.utils.multitenancy.MultitenantConstants; import java.util.ArrayList; +import java.util.HashMap; +import java.util.HashSet; import java.util.List; +import java.util.Map; +import java.util.Set; /** * This class represents an implementation of APIManagementProviderService. @@ -50,48 +81,66 @@ public class APIManagementProviderServiceImpl implements APIManagementProviderSe private static final String CONTENT_TYPE = "application/json"; private static final int MAX_API_PER_TAG = 200; private static final String APP_TIER_TYPE = "application"; + public static final APIManagerFactory API_MANAGER_FACTORY = APIManagerFactory.getInstance(); + @Override public boolean isTierLoaded() { - StoreClient storeClient = APIApplicationManagerExtensionDataHolder.getInstance().getIntegrationClientService() - .getStoreClient(); +// StoreClient storeClient = APIApplicationManagerExtensionDataHolder.getInstance().getIntegrationClientService() +// .getStoreClient(); String tenantDomain = PrivilegedCarbonContext.getThreadLocalCarbonContext() .getTenantDomain(); +// String username = PrivilegedCarbonContext.getThreadLocalCarbonContext().getUsername(); +// try { try { - storeClient.getIndividualTier().tiersTierLevelTierNameGet(ApiApplicationConstants.DEFAULT_TIER, - APP_TIER_TYPE, - tenantDomain, CONTENT_TYPE, null, null); - return true; - } catch (FeignException e) { - log.error("Feign Exception", e); - if (e.status() == 401) { - OAuthRequestInterceptor oAuthRequestInterceptor = new OAuthRequestInterceptor(); - String username = PrivilegedCarbonContext.getThreadLocalCarbonContext().getUsername(); - oAuthRequestInterceptor.removeToken(username, tenantDomain); - try { - storeClient.getIndividualTier().tiersTierLevelTierNameGet(ApiApplicationConstants.DEFAULT_TIER, - APP_TIER_TYPE, tenantDomain, CONTENT_TYPE, null, null); - } catch (FeignException ex) { - log.error("Invalid Attempt : " + ex); - } - } - } catch (Exception e) { + APIUtil.getTiers(APIConstants.TIER_APPLICATION_TYPE, tenantDomain); + } catch (APIManagementException e) { log.error("APIs not ready", e); } - return false; + // storeClient.getIndividualTier().tiersTierLevelTierNameGet(ApiApplicationConstants.DEFAULT_TIER, +// APP_TIER_TYPE, +// tenantDomain, CONTENT_TYPE, null, null); + return true; +// } catch (FeignException e) { +// log.error("Feign Exception", e); +// if (e.status() == 401) { +// OAuthRequestInterceptor oAuthRequestInterceptor = new OAuthRequestInterceptor(); +// String username = PrivilegedCarbonContext.getThreadLocalCarbonContext().getUsername(); +// oAuthRequestInterceptor.removeToken(username, tenantDomain); +// try { +// storeClient.getIndividualTier().tiersTierLevelTierNameGet(ApiApplicationConstants.DEFAULT_TIER, +// APP_TIER_TYPE, tenantDomain, CONTENT_TYPE, null, null); +// } catch (FeignException ex) { +// log.error("Invalid Attempt : " + ex); +// } +// } +// } catch (Exception e) { +// log.error("APIs not ready", e); +// } +// return false; } @Override public void removeAPIApplication(String applicationName, String username) throws APIManagerException { - StoreClient storeClient = APIApplicationManagerExtensionDataHolder.getInstance().getIntegrationClientService() - .getStoreClient(); - ApplicationList applicationList = storeClient.getApplications() - .applicationsGet("", applicationName, 1, 0, CONTENT_TYPE, null); - if (applicationList.getList() != null && applicationList.getList().size() > 0) { - ApplicationInfo applicationInfo = applicationList.getList().get(0); - storeClient.getIndividualApplication().applicationsApplicationIdDelete(applicationInfo.getApplicationId(), - null, null); +// StoreClient storeClient = APIApplicationManagerExtensionDataHolder.getInstance().getIntegrationClientService() +// .getStoreClient(); +// ApplicationList applicationList = storeClient.getApplications() +// .applicationsGet("", applicationName, 1, 0, CONTENT_TYPE, null); + try { + APIConsumer apiConsumer = API_MANAGER_FACTORY.getAPIConsumer(username); + Application application = apiConsumer.getApplicationsByName(username, applicationName, ""); + if (application != null) { +// ApplicationInfo applicationInfo = applicationList.getList().get(0); +// storeClient.getIndividualApplication().applicationsApplicationIdDelete(applicationInfo.getApplicationId(), +// null, null); + apiConsumer.removeApplication(application, username); + } + } catch (APIManagementException e) { + //todo:amalka + e.printStackTrace(); } + + } /** @@ -100,94 +149,80 @@ public class APIManagementProviderServiceImpl implements APIManagementProviderSe @Override public synchronized ApiApplicationKey generateAndRetrieveApplicationKeys(String applicationName, String tags[], String keyType, String username, - boolean isAllowedAllDomains, String validityTime, - StoreClient sClient) throws APIManagerException { - - StoreClient storeClient; + boolean isAllowedAllDomains, + String validityTime, String scopes) throws APIManagerException { - if (sClient == null) { - storeClient = APIApplicationManagerExtensionDataHolder.getInstance().getIntegrationClientService() - .getStoreClient(); - } else { - storeClient = sClient; + String tenantDomain = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantDomain(); + if (StringUtils.isEmpty(username)) { + username = PrivilegedCarbonContext.getThreadLocalCarbonContext().getUsername(); } - - String tenantDomain = PrivilegedCarbonContext.getThreadLocalCarbonContext() - .getTenantDomain(); try { - ApplicationList applicationList = storeClient.getApplications() - .applicationsGet("", applicationName, 1, 0, CONTENT_TYPE, null); - Application application; - if (applicationList == null || applicationList.getList() == null || applicationList.getList().size() == 0) { - //create application; - application = new Application(); - application.setName(applicationName); - application.setSubscriber(username); - application.setDescription(""); - application.setThrottlingTier(ApiApplicationConstants.DEFAULT_TIER); + APIConsumer apiConsumer = API_MANAGER_FACTORY.getAPIConsumer(username); + Application application = apiConsumer.getApplicationsByName(username, applicationName, ""); + + int applicationId = 0; + Subscriber subscriber = null; + if (application == null) { + subscriber = apiConsumer.getSubscriber(username); + if (subscriber == null) { + // create subscriber + apiConsumer.addSubscriber(username, ""); + subscriber = apiConsumer.getSubscriber(username); + } + //create application + application = new Application(applicationName, subscriber); + application.setTier(ApiApplicationConstants.DEFAULT_TIER); application.setGroupId(""); - application = storeClient.getIndividualApplication().applicationsPost(application, CONTENT_TYPE); + applicationId = apiConsumer.addApplication(application, username); } else { - ApplicationInfo applicationInfo = applicationList.getList().get(0); - application = storeClient.getIndividualApplication() - .applicationsApplicationIdGet(applicationInfo.getApplicationId(), CONTENT_TYPE, null, null); - } - if (application == null) { - throw new APIManagerException( - "Api application creation failed for " + applicationName + " to the user " + username); + applicationId = application.getId(); + subscriber = apiConsumer.getSubscriber(username); } - SubscriptionList subscriptionList = storeClient.getSubscriptions().subscriptionsGet - (null, application.getApplicationId(), "", 0, 100, CONTENT_TYPE, null); - List needToSubscribe = new ArrayList<>(); + Set subscribedAPIs = + apiConsumer.getSubscribedAPIsByApplicationId(subscriber, applicationId, ""); + + log.info("Already subscribed API count: " + subscribedAPIs.size()); + // subscribe to apis. + Set tempApiIds = new HashSet<>(); if (tags != null && tags.length > 0) { for (String tag : tags) { - APIList apiList = storeClient.getApis().apisGet(MAX_API_PER_TAG, 0, tenantDomain, "tag:" + tag - , CONTENT_TYPE, null); - if (apiList.getList() == null || apiList.getList().size() == 0) { - apiList = storeClient.getApis().apisGet(MAX_API_PER_TAG, 0 - , MultitenantConstants.SUPER_TENANT_DOMAIN_NAME, "tag:" + tag, CONTENT_TYPE, null); + Set apisWithTag = apiConsumer.getAPIsWithTag(tag, tenantDomain); + if (apisWithTag == null || apisWithTag.size() == 0) { + apisWithTag = apiConsumer.getAPIsWithTag(tag, MultitenantConstants.SUPER_TENANT_DOMAIN_NAME); } - if (apiList.getList() != null && apiList.getList().size() > 0) { - for (APIInfo apiInfo : apiList.getList()) { - String id = apiInfo.getProvider().replace("@", "-AT-") - + "-" + apiInfo.getName() + "-" + apiInfo.getVersion(); - id = id.replace(" ", "+"); + if (apisWithTag != null && apisWithTag.size() > 0) { + for (API apiInfo : apisWithTag) { + String id = apiInfo.getId().getProviderName().replace("@", "-AT-") + + "-" + apiInfo.getId().getName() + "-" + apiInfo.getId().getVersion(); + // todo: amalka will this break old apis? boolean subscriptionExist = false; - if (subscriptionList.getList() != null && subscriptionList.getList().size() > 0) { - for (Subscription subs : subscriptionList.getList()) { - if (subs.getApiIdentifier().equals(id)) { + if (subscribedAPIs.size() > 0) { + for (SubscribedAPI subscribedAPI : subscribedAPIs) { + if (String.valueOf(subscribedAPI.getApiId().toString()).equals(id)) { subscriptionExist = true; break; } } } - if (!subscriptionExist) { - Subscription subscription = new Subscription(); - //fix for APIMANAGER-5566 admin-AT-tenant1.com-Tenant1API1-1.0.0 - - subscription.setApiIdentifier(id); - subscription.setApplicationId(application.getApplicationId()); - subscription.tier(ApiApplicationConstants.DEFAULT_TIER); - if (!needToSubscribe.contains(subscription)) { - needToSubscribe.add(subscription); - } + if (!subscriptionExist && !tempApiIds.contains(id)) { + ApiTypeWrapper apiTypeWrapper = new ApiTypeWrapper(apiInfo); + apiTypeWrapper.setTier(ApiApplicationConstants.DEFAULT_TIER); + apiConsumer.addSubscription(apiTypeWrapper, username, applicationId, ""); + tempApiIds.add(id); } } } } } - if (!needToSubscribe.isEmpty()) { - storeClient.getSubscriptionMultitpleApi().subscriptionsMultiplePost(needToSubscribe, CONTENT_TYPE); - } //end of subscription - List applicationKeys = application.getKeys(); + List applicationKeys = application.getKeys(); if (applicationKeys != null) { - for (ApplicationKey applicationKey : applicationKeys) { - if (keyType.equals(applicationKey.getKeyType().toString())) { + for (APIKey applicationKey : applicationKeys) { + if (keyType.equals(applicationKey.getType())) { if (applicationKey.getConsumerKey() != null && !applicationKey.getConsumerKey().isEmpty()) { ApiApplicationKey apiApplicationKey = new ApiApplicationKey(); apiApplicationKey.setConsumerKey(applicationKey.getConsumerKey()); @@ -198,33 +233,74 @@ public class APIManagementProviderServiceImpl implements APIManagementProviderSe } } - ApplicationKeyGenerateRequest applicationKeyGenerateRequest = new ApplicationKeyGenerateRequest(); List allowedDomains = new ArrayList<>(); if (isAllowedAllDomains) { allowedDomains.add(ApiApplicationConstants.ALLOWED_DOMAINS); } else { allowedDomains.add(APIManagerUtil.getTenantDomain()); } - applicationKeyGenerateRequest.setAccessAllowDomains(allowedDomains); - applicationKeyGenerateRequest.setCallbackUrl(""); - applicationKeyGenerateRequest.setKeyType(ApplicationKeyGenerateRequest.KeyTypeEnum.PRODUCTION); - applicationKeyGenerateRequest.setValidityTime(validityTime); - - ApplicationKey applicationKey = storeClient.getIndividualApplication().applicationsGenerateKeysPost( - application.getApplicationId(), applicationKeyGenerateRequest, CONTENT_TYPE, null, null); - if (applicationKey.getConsumerKey() != null && !applicationKey.getConsumerKey().isEmpty()) { - ApiApplicationKey apiApplicationKey = new ApiApplicationKey(); - apiApplicationKey.setConsumerKey(applicationKey.getConsumerKey()); - apiApplicationKey.setConsumerSecret(applicationKey.getConsumerSecret()); - return apiApplicationKey; + + APIAdmin apiAdmin = new APIAdminImpl(); + String keyManagerId = null; + try { + List keyManagerConfigurations = apiAdmin + .getKeyManagerConfigurationsByTenant(tenantDomain); + if (keyManagerConfigurations != null) { + for (KeyManagerConfigurationDTO keyManagerConfigurationDTO : keyManagerConfigurations) { + keyManagerId = keyManagerConfigurationDTO.getUuid(); + } + } + String jsonString = "{\"grant_types\":\"refresh_token,urn:ietf:params:oauth:grant-type:saml2-bearer," + + "password,client_credentials,iwa:ntlm,urn:ietf:params:oauth:grant-type:jwt-bearer\"," + + "\"additionalProperties\":\"{\\\"application_access_token_expiry_time\\\":\\\"N\\/A\\\"," + + "\\\"user_access_token_expiry_time\\\":\\\"N\\/A\\\"," + + "\\\"refresh_token_expiry_time\\\":\\\"N\\/A\\\"," + + "\\\"id_token_expiry_time\\\":\\\"N\\/A\\\"}\"," + + "\"username\":\"" + username + "\"}"; + + // if scopes not defined + if (StringUtils.isEmpty(scopes)) { + UIConfigurationManager uiConfigurationManager = UIConfigurationManager.getInstance(); + UIConfiguration uiConfiguration = uiConfigurationManager.getUIConfig(); + List scopeList = uiConfiguration.getScopes(); + + if (scopeList != null && scopeList.size() > 0) { + StringBuilder builder = new StringBuilder(); + for (String scope : scopeList) { + String tmpScope = scope + " "; + builder.append(tmpScope); + } + scopes = builder.toString(); + } + + if (StringUtils.isEmpty(scopes)) { + scopes = scopes.trim(); + } else { + scopes = "default"; + } + } + + Map keyDetails = apiConsumer + .requestApprovalForApplicationRegistration(username, applicationName, keyType, "", + allowedDomains.toArray(new String[allowedDomains.size()]), validityTime, scopes, "", + jsonString, keyManagerId, tenantDomain); + + if (keyDetails != null) { + ApiApplicationKey apiApplicationKey = new ApiApplicationKey(); + apiApplicationKey.setConsumerKey((String) keyDetails.get("consumerKey")); + apiApplicationKey.setConsumerSecret((String) keyDetails.get("consumerSecret")); + return apiApplicationKey; + } + throw new APIManagerException("Failed to generate keys for tenant: " + tenantDomain); + } catch (APIManagementException e) { + throw new APIManagerException("Failed to create api application for tenant: " + tenantDomain, e); } - throw new APIManagerException("Failed to generate keys for tenant: " + tenantDomain); - } catch (FeignException e) { + } catch (APIManagementException e) { throw new APIManagerException("Failed to create api application for tenant: " + tenantDomain, e); } } - /** + /** * {@inheritDoc} */ @Override @@ -311,7 +387,7 @@ public class APIManagementProviderServiceImpl implements APIManagementProviderSe if (registrationProfile.getUsername() == null || registrationProfile.getUsername().isEmpty()) { info = generateAndRetrieveApplicationKeys(registrationProfile.getApplicationName(), - registrationProfile.getTags(), tokenType, registrationProfile.getApplicationName(), + registrationProfile.getTags(), tokenType, null, registrationProfile.isAllowedToAllDomains(), validityPeriod); } } finally { diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension/src/main/java/org/wso2/carbon/apimgt/application/extension/internal/APIApplicationManagerExtensionDataHolder.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension/src/main/java/org/wso2/carbon/apimgt/application/extension/internal/APIApplicationManagerExtensionDataHolder.java index 90f297e6d3..368fda3a3b 100644 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension/src/main/java/org/wso2/carbon/apimgt/application/extension/internal/APIApplicationManagerExtensionDataHolder.java +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension/src/main/java/org/wso2/carbon/apimgt/application/extension/internal/APIApplicationManagerExtensionDataHolder.java @@ -18,7 +18,7 @@ package org.wso2.carbon.apimgt.application.extension.internal; import org.wso2.carbon.apimgt.application.extension.APIManagementProviderService; -import org.wso2.carbon.apimgt.integration.client.service.IntegrationClientService; +//import org.wso2.carbon.apimgt.integration.client.service.IntegrationClientService; import org.wso2.carbon.context.PrivilegedCarbonContext; import org.wso2.carbon.identity.jwt.client.extension.service.JWTClientManagerService; import org.wso2.carbon.registry.core.service.TenantRegistryLoader; @@ -35,7 +35,7 @@ public class APIApplicationManagerExtensionDataHolder { private TenantManager tenantManager; private TenantRegistryLoader tenantRegistryLoader; private TenantIndexingLoader indexLoader; - private IntegrationClientService integrationClientService; +// private IntegrationClientService integrationClientService; private JWTClientManagerService jwtClientManagerService; private APIApplicationManagerExtensionDataHolder() { @@ -94,14 +94,14 @@ public class APIApplicationManagerExtensionDataHolder { return indexLoader; } - public IntegrationClientService getIntegrationClientService() { - return integrationClientService; - } - - public void setIntegrationClientService( - IntegrationClientService integrationClientService) { - this.integrationClientService = integrationClientService; - } +// public IntegrationClientService getIntegrationClientService() { +// return integrationClientService; +// } +// +// public void setIntegrationClientService( +// IntegrationClientService integrationClientService) { +// this.integrationClientService = integrationClientService; +// } public JWTClientManagerService getJwtClientManagerService() { if (jwtClientManagerService == null) { diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension/src/main/java/org/wso2/carbon/apimgt/application/extension/internal/APIApplicationManagerExtensionServiceComponent.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension/src/main/java/org/wso2/carbon/apimgt/application/extension/internal/APIApplicationManagerExtensionServiceComponent.java index 9d28c89f16..4d98527956 100644 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension/src/main/java/org/wso2/carbon/apimgt/application/extension/internal/APIApplicationManagerExtensionServiceComponent.java +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension/src/main/java/org/wso2/carbon/apimgt/application/extension/internal/APIApplicationManagerExtensionServiceComponent.java @@ -23,7 +23,7 @@ import org.osgi.framework.BundleContext; import org.osgi.service.component.ComponentContext;; import org.wso2.carbon.apimgt.application.extension.APIManagementProviderService; import org.wso2.carbon.apimgt.application.extension.APIManagementProviderServiceImpl; -import org.wso2.carbon.apimgt.integration.client.service.IntegrationClientService; +//import org.wso2.carbon.apimgt.integration.client.service.IntegrationClientService; import org.wso2.carbon.registry.core.service.TenantRegistryLoader; import org.wso2.carbon.registry.indexing.service.TenantIndexingLoader; import org.wso2.carbon.user.core.service.RealmService; @@ -49,12 +49,6 @@ import org.wso2.carbon.user.core.service.RealmService; * policy="dynamic" * bind="setRealmService" * unbind="unsetRealmService" - * @scr.reference name="integration.client.service" - * interface="org.wso2.carbon.apimgt.integration.client.service.IntegrationClientService" - * cardinality="1..1" - * policy="dynamic" - * bind="setIntegrationClientService" - * unbind="unsetIntegrationClientService" */ public class APIApplicationManagerExtensionServiceComponent { @@ -97,16 +91,16 @@ public class APIApplicationManagerExtensionServiceComponent { APIApplicationManagerExtensionDataHolder.getInstance().setIndexLoaderService(null); } - protected void setIntegrationClientService(IntegrationClientService integrationClientService) { - if (integrationClientService != null && log.isDebugEnabled()) { - log.debug("integrationClientService initialized"); - } - APIApplicationManagerExtensionDataHolder.getInstance().setIntegrationClientService(integrationClientService); - } - - protected void unsetIntegrationClientService(IntegrationClientService integrationClientService) { - APIApplicationManagerExtensionDataHolder.getInstance().setIntegrationClientService(null); - } +// protected void setIntegrationClientService(IntegrationClientService integrationClientService) { +// if (integrationClientService != null && log.isDebugEnabled()) { +// log.debug("integrationClientService initialized"); +// } +// APIApplicationManagerExtensionDataHolder.getInstance().setIntegrationClientService(integrationClientService); +// } +// +// protected void unsetIntegrationClientService(IntegrationClientService integrationClientService) { +// APIApplicationManagerExtensionDataHolder.getInstance().setIntegrationClientService(null); +// } /** * Sets Realm Service. diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/pom.xml b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/pom.xml index eeddf628a5..0784f282aa 100644 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/pom.xml +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/pom.xml @@ -47,46 +47,39 @@ org.wso2.carbon.apimgt.integration.client.*, !org.wso2.carbon.apimgt.integration.client.internal - - org.osgi.framework, - org.osgi.service.component, - feign, - feign.codec, - feign.auth, - feign.gson, - feign.slf4j, - org.wso2.carbon.apimgt.integration.generated.client.publisher.api, - org.wso2.carbon.apimgt.integration.generated.client.store.api, - javax.xml.bind, - javax.xml.bind.annotation, - javax.xml.parsers;resolution:=optional, - org.apache.commons.logging, - org.w3c.dom, - org.wso2.carbon.context, - org.wso2.carbon.identity.jwt.client.*, - org.wso2.carbon.user.api, - org.wso2.carbon.utils, - com.fasterxml.jackson.annotation, - io.swagger.annotations, - org.wso2.carbon.core.util, - javax.xml, - org.wso2.carbon.base, - javax.net.ssl, - org.apache.commons.lang, - android.util;resolution:=optional, - javax.annotation;resolution:=optional, - javax.net;resolution:=optional, - javax.security.auth.x500;resolution:=optional, - javax.crypto;resolution:=optional, - javax.crypto.spec;resolution:=optional - - - jsr311-api, - feign-jaxrs, - feign-okhttp, - okhttp, - okio - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -120,55 +113,60 @@ - - com.squareup.okhttp3 - okhttp - - - com.squareup.okio - okio - + + + + + + + + io.github.openfeign feign-okhttp - - org.wso2.carbon - org.wso2.carbon.logging - - - org.eclipse.osgi - org.eclipse.osgi - - - org.eclipse.osgi - org.eclipse.osgi.services - - - com.google.code.gson - gson - - - javax.ws.rs - jsr311-api - + + io.github.openfeign + feign-slf4j + 10.7.2 + + + + + + + + + + + + + + + + + + + + + - - io.swagger - swagger-annotations - - - junit - junit - + + + + + + + + io.github.openfeign feign-core - - io.github.openfeign - feign-jackson - + + + + io.github.openfeign feign-jaxrs @@ -178,10 +176,10 @@ feign-gson - - org.testng - testng - + + + + org.wso2.carbon.devicemgt org.wso2.carbon.identity.jwt.client.extension diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/publisher/PublisherClient.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/publisher/PublisherClient.java index 3887d59c66..73a4234a91 100644 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/publisher/PublisherClient.java +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/publisher/PublisherClient.java @@ -27,7 +27,8 @@ import feign.slf4j.Slf4jLogger; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.wso2.carbon.apimgt.integration.client.configs.APIMConfigReader; -import org.wso2.carbon.apimgt.integration.generated.client.publisher.api.*; +import org.wso2.carbon.apimgt.integration.generated.client.publisher.api.ApIsApi; +import org.wso2.carbon.apimgt.integration.generated.client.publisher.api.ApiLifecycleApi; import org.wso2.carbon.core.util.Utils; /** @@ -36,13 +37,15 @@ import org.wso2.carbon.core.util.Utils; public class PublisherClient { private static final Log log = LogFactory.getLog(PublisherClient.class); - private APIIndividualApi api = null; - private APICollectionApi apis = null; - private DocumentIndividualApi document = null; - private ApplicationIndividualApi application = null; - private EnvironmentCollectionApi environments = null; - private SubscriptionCollectionApi subscriptions = null; - private ThrottlingTierCollectionApi tiers = null; + private ApIsApi apIsApi = null; + private ApiLifecycleApi apiLifecycleApi = null; +// private APIIndividualApi api = null; +// private APICollectionApi apis = null; +// private DocumentIndividualApi document = null; +// private ApplicationIndividualApi application = null; +// private EnvironmentCollectionApi environments = null; +// private SubscriptionApi subscriptions = null; +// private ThrottlingTierCollectionApi tiers = null; /** @@ -57,40 +60,50 @@ public class PublisherClient { .requestInterceptor(requestInterceptor).encoder(new GsonEncoder()).decoder(new GsonDecoder()); String basePath = Utils.replaceSystemProperty(APIMConfigReader.getInstance().getConfig().getPublisherEndpoint()); - api = builder.target(APIIndividualApi.class, basePath); - apis = builder.target(APICollectionApi.class, basePath); - document = builder.target(DocumentIndividualApi.class, basePath); - application = builder.target(ApplicationIndividualApi.class, basePath); - environments = builder.target(EnvironmentCollectionApi.class, basePath); - subscriptions = builder.target(SubscriptionCollectionApi.class, basePath); - tiers = builder.target(ThrottlingTierCollectionApi.class, basePath); + apIsApi = builder.target(ApIsApi.class, basePath); + apiLifecycleApi = builder.target(ApiLifecycleApi.class, basePath); +// api = builder.target(APIIndividualApi.class, basePath); +// apis = builder.target(APICollectionApi.class, basePath); +// document = builder.target(DocumentIndividualApi.class, basePath); +// application = builder.target(ApplicationIndividualApi.class, basePath); +// environments = builder.target(EnvironmentCollectionApi.class, basePath); +// subscriptions = builder.target(SubscriptionCollectionApi.class, basePath); +// tiers = builder.target(ThrottlingTierCollectionApi.class, basePath); } - public APIIndividualApi getApi() { - return api; + public ApIsApi getApIsApi() { + return apIsApi; } - public APICollectionApi getApis() { - return apis; + public ApiLifecycleApi getApiLifecycleApi() { + return apiLifecycleApi; } - public DocumentIndividualApi getDocument() { - return document; - } - - public ApplicationIndividualApi getApplication() { - return application; - } - - public EnvironmentCollectionApi getEnvironments() { - return environments; - } - - public SubscriptionCollectionApi getSubscriptions() { - return subscriptions; - } - - public ThrottlingTierCollectionApi getTiers() { - return tiers; - } + // public APIIndividualApi getApi() { +// return api; +// } +// +// public APICollectionApi getApis() { +// return apis; +// } +// +// public DocumentIndividualApi getDocument() { +// return document; +// } +// +// public ApplicationIndividualApi getApplication() { +// return application; +// } +// +// public EnvironmentCollectionApi getEnvironments() { +// return environments; +// } +// +// public SubscriptionCollectionApi getSubscriptions() { +// return subscriptions; +// } +// +// public ThrottlingTierCollectionApi getTiers() { +// return tiers; +// } } diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/store/StoreClient.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/store/StoreClient.java index db751f204e..5d8a46d586 100644 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/store/StoreClient.java +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/store/StoreClient.java @@ -39,16 +39,17 @@ import java.util.concurrent.TimeUnit; public class StoreClient { private static final org.apache.commons.logging.Log log = LogFactory.getLog(StoreClient.class); - private APICollectionApi apis = null; - private APIIndividualApi individualApi = null; - private ApplicationCollectionApi applications = null; - private ApplicationIndividualApi individualApplication = null; - private SubscriptionCollectionApi subscriptions = null; - private SubscriptionIndividualApi individualSubscription = null; - private SubscriptionMultitpleApi subscriptionMultitpleApi = null; - private ThrottlingTierIndividualApi individualTier = null; - private TagCollectionApi tags = null; - private ThrottlingTierCollectionApi tiers = null; + private ApplicationsApi applicationsApi = null; +// private APICollectionApi apis = null; +// private ApIsApi individualApi = null; +// private ApplicationsApi applications = null; +// private ApplicationIndividualApi individualApplication = null; +// private SubscriptionCollectionApi subscriptions = null; +// private SubscriptionIndividualApi individualSubscription = null; +// private SubscriptionMultitpleApi subscriptionMultitpleApi = null; +// private ThrottlingTierIndividualApi individualTier = null; +// private TagsApi tags = null; +// private ThrottlingTierCollectionApi tiers = null; public StoreClient(RequestInterceptor requestInterceptor) { @@ -60,58 +61,59 @@ public class StoreClient { .requestInterceptor(requestInterceptor).encoder(new GsonEncoder()).decoder(new GsonDecoder()); String basePath = Utils.replaceSystemProperty(APIMConfigReader.getInstance().getConfig().getStoreEndpoint()); - apis = builder.target(APICollectionApi.class, basePath); - individualApi = builder.target(APIIndividualApi.class, basePath); - applications = builder.target(ApplicationCollectionApi.class, basePath); - individualApplication = builder.target(ApplicationIndividualApi.class, basePath); - subscriptions = builder.target(SubscriptionCollectionApi.class, basePath); - individualSubscription = builder.target(SubscriptionIndividualApi.class, basePath); - subscriptionMultitpleApi = builder.target(SubscriptionMultitpleApi.class, basePath); - tags = builder.target(TagCollectionApi.class, basePath); - individualTier = builder.target(ThrottlingTierIndividualApi.class, basePath); - tiers = builder.retryer(new Retryer.Default(100L, TimeUnit.SECONDS.toMillis(1L), 1)) - .options(new Request.Options(10000, 5000)) - .target(ThrottlingTierCollectionApi.class, basePath); + applicationsApi = builder.target(ApplicationsApi.class, basePath); +// apis = builder.target(APICollectionApi.class, basePath); +// individualApi = builder.target(ApIsApi.class, basePath); +// applications = builder.target(ApplicationCollectionApi.class, basePath); +// individualApplication = builder.target(ApplicationIndividualApi.class, basePath); +// subscriptions = builder.target(SubscriptionCollectionApi.class, basePath); +// individualSubscription = builder.target(SubscriptionIndividualApi.class, basePath); +// subscriptionMultitpleApi = builder.target(SubscriptionMultitpleApi.class, basePath); +// tags = builder.target(TagCollectionApi.class, basePath); +// individualTier = builder.target(ThrottlingTierIndividualApi.class, basePath); +// tiers = builder.retryer(new Retryer.Default(100L, TimeUnit.SECONDS.toMillis(1L), 1)) +// .options(new Request.Options(10000, 5000)) +// .target(ThrottlingTierCollectionApi.class, basePath); } - public APICollectionApi getApis() { - return apis; - } - - public APIIndividualApi getIndividualApi() { - return individualApi; - } - - public ApplicationCollectionApi getApplications() { - return applications; - } - - public ApplicationIndividualApi getIndividualApplication() { - return individualApplication; - } - - public SubscriptionCollectionApi getSubscriptions() { - return subscriptions; - } - - public SubscriptionIndividualApi getIndividualSubscription() { - return individualSubscription; - } - - public ThrottlingTierIndividualApi getIndividualTier() { - return individualTier; - } - - public TagCollectionApi getTags() { - return tags; - } - - public ThrottlingTierCollectionApi getTiers() { - return tiers; - } - - public SubscriptionMultitpleApi getSubscriptionMultitpleApi() { - return subscriptionMultitpleApi; - } +// public APICollectionApi getApis() { +// return apis; +// } +// +// public APIIndividualApi getIndividualApi() { +// return individualApi; +// } +// +// public ApplicationCollectionApi getApplications() { +// return applications; +// } +// +// public ApplicationIndividualApi getIndividualApplication() { +// return individualApplication; +// } +// +// public SubscriptionCollectionApi getSubscriptions() { +// return subscriptions; +// } +// +// public SubscriptionIndividualApi getIndividualSubscription() { +// return individualSubscription; +// } +// +// public ThrottlingTierIndividualApi getIndividualTier() { +// return individualTier; +// } +// +// public TagCollectionApi getTags() { +// return tags; +// } +// +// public ThrottlingTierCollectionApi getTiers() { +// return tiers; +// } +// +// public SubscriptionMultitpleApi getSubscriptionMultitpleApi() { +// return subscriptionMultitpleApi; +// } } diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.generated.client/pom.xml b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.generated.client/pom.xml index 22c399e5b7..cc300b8014 100644 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.generated.client/pom.xml +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.generated.client/pom.xml @@ -26,61 +26,59 @@ http://wso2.org + - - - io.swagger - swagger-codegen-maven-plugin - 2.2.1 - - - process-resources - publisher - - generate - - - ${project.basedir}/src/main/resources/publisher-api.yaml - java - - ${project.artifactId}.publisher.api - ${project.artifactId}.publisher.model - - feign - - - - process-resources - store - - generate - - - ${project.basedir}/src/main/resources/store-api.yaml - java - - ${project.artifactId}.store.api - ${project.artifactId}.store.model - - feign - - - - + + org.openapitools + openapi-generator-maven-plugin + 5.0.0 + + + process-resources + publisher + + generate + + + ${project.basedir}/src/main/resources/publisher-api.yaml + java + + ${project.artifactId}.publisher.api + ${project.artifactId}.publisher.model + + + + + process-resources + store + + generate + + + ${project.basedir}/src/main/resources/devportal-api.yaml + java + + ${project.artifactId}.store.api + ${project.artifactId}.store.model + + + + + com.google.code.maven-replacer-plugin replacer 1.5.2 - + process-resources - replace-for-swagger-genenerated-code-publisher + replace-for-openapi-genenerated-code-publisher replace - ${project.basedir}/target/generated-sources/swagger/src/main/java/org/wso2/carbon/apimgt/integration/generated/client/publisher/model/API.java + ${project.basedir}/target/generated-sources/openapi/src/main/java/org/wso2/carbon/apimgt/integration/generated/client/publisher/model/API.java CURRENT_TENANT @@ -115,28 +113,33 @@ org.wso2.carbon.apimgt.integration.generated.client.store.api.*, org.wso2.carbon.apimgt.integration.generated.client.store.model.* - - feign;version="${io.github.openfeign.version.range}", - feign.jackson;version="${io.github.openfeign.version.range}", - feign.codec;version="${io.github.openfeign.version.range}", - feign.auth;version="${io.github.openfeign.version.range}", - feign.gson;version="${io.github.openfeign.version.range}", - feign.slf4j;version="${io.github.openfeign.version.range}", - com.google.gson, - com.fasterxml.jackson.core;resolution:=optional, - com.fasterxml.jackson.annotation, - com.fasterxml.jackson.databind;resolution:=optional, - io.swagger.annotations, - javax.net.ssl, - com.fasterxml.jackson.datatype.joda;resolution:=optional, - org.apache.oltu.oauth2.client.*;resolution:=optional, - org.apache.oltu.oauth2.common.*;resolution:=optional, - org.junit;resolution:=optional, - - - jsr311-api, - feign-jaxrs - + + com.google.gson;version="[2.8,3)", + com.google.gson.annotations;version="[2.8,3)", + com.google.gson.internal.bind.util, + com.google.gson.reflect;version="[2.8,3)", + com.google.gson.stream;version="[2.8,3)", + io.gsonfire;version="[1.8,2)", + io.swagger.annotations;version="[1.5,2)", + javax.annotation;version="[3.0,4)", + javax.net.ssl, + okhttp3, + okhttp3.internal.http, + okhttp3.internal.tls, + okhttp3.logging, + okio, + org.apache.oltu.oauth2.client;version="[1.0,2)", + org.apache.oltu.oauth2.client.request;version="[1.0,2)", + org.apache.oltu.oauth2.client.response;version="[1.0,2)", + org.apache.oltu.oauth2.common.exception;version="[1.0,2)", + org.apache.oltu.oauth2.common.message.types;version="[1.0,2)", + org.threeten.bp;version="[1.5,2)", + org.threeten.bp.format;version="[1.5,2)", + org.threeten.bp.temporal;version="[1.5,2)", + org.wso2.carbon.apimgt.integration.generated.client.publisher.model, + org.wso2.carbon.apimgt.integration.generated.client.store.model + + @@ -145,60 +148,105 @@ + + + io.swagger.core.v3 + swagger-annotations + 2.1.7 + + + com.google.code.gson gson + 2.8.5 - - javax.ws.rs - jsr311-api - + + + + io.swagger swagger-annotations - - junit - junit - - - io.github.openfeign - feign-core - - - io.github.openfeign - feign-jackson - - - io.github.openfeign - feign-jaxrs - - - io.github.openfeign - feign-gson - - - org.testng - testng - - - org.apache.oltu.oauth2 - org.apache.oltu.oauth2.client - - - io.github.openfeign - feign-slf4j - - - org.wso2.orbit.com.fasterxml.jackson.core - jackson-databind - ${jackson-databind.version} - - - com.fasterxml.jackson.datatype - jackson-datatype-joda - + + com.squareup.okhttp3 + okhttp + 4.9.1 + + + + org.apache.oltu.oauth2 + org.apache.oltu.oauth2.client + 1.0.1 + + + + com.squareup.okhttp3 + logging-interceptor + 4.9.1 + + + + org.threeten + threetenbp + 1.5.0 + + + + io.gsonfire + gson-fire + 1.8.5 + + + io.swagger.parser.v3 + swagger-parser + 2.0.25 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + true diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.generated.client/src/main/resources/publisher-api.yaml b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.generated.client/src/main/resources/publisher-api.yaml index b2068857a7..76fdb6f92d 100644 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.generated.client/src/main/resources/publisher-api.yaml +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.generated.client/src/main/resources/publisher-api.yaml @@ -1,115 +1,122 @@ - -swagger: '2.0' -###################################################### -# Prolog -###################################################### +# Copyright (c) 2020, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +################################################################################ +openapi: 3.0.1 info: - version: "0.12.0" - title: "WSO2 API Manager - Publisher API" + title: WSO2 API Manager - Publisher API description: | - This specifies a **RESTful API** for WSO2 **API Manager** - Publisher. - - Please see [full swagger definition](https://raw.githubusercontent.com/wso2/carbon-apimgt/v6.1.66/components/apimgt/org.wso2.carbon.apimgt.rest.api.publisher/src/main/resources/publisher-api.yaml) of the API which is written using [swagger 2.0](http://swagger.io/) specification. + This document specifies a **RESTful API** for WSO2 **API Manager** - **Publisher**. + + # Authentication + Our REST APIs are protected using OAuth2 and access control is achieved through scopes. Before you start invoking + the the API you need to obtain an access token with the required scopes. This guide will walk you through the steps + that you will need to follow to obtain an access token. + First you need to obtain the consumer key/secret key pair by calling the dynamic client registration (DCR) endpoint. You can add your preferred grant types + in the payload. A Sample payload is shown below. + ``` + { + "callbackUrl":"www.google.lk", + "clientName":"rest_api_publisher", + "owner":"admin", + "grantType":"client_credentials password refresh_token", + "saasApp":true + } + ``` + Create a file (payload.json) with the above sample payload, and use the cURL shown bellow to invoke the DCR endpoint. Authorization header of this should contain the + base64 encoded admin username and password. + **Format of the request** + ``` + curl -X POST -H "Authorization: Basic Base64(admin_username:admin_password)" -H "Content-Type: application/json" + \ -d @payload.json https://:/client-registration/v0.17/register + ``` + **Sample request** + ``` + curl -X POST -H "Authorization: Basic YWRtaW46YWRtaW4=" -H "Content-Type: application/json" + \ -d @payload.json https://localhost:9443/client-registration/v0.17/register + ``` + Following is a sample response after invoking the above curl. + ``` + { + "clientId": "fOCi4vNJ59PpHucC2CAYfYuADdMa", + "clientName": "rest_api_publisher", + "callBackURL": "www.google.lk", + "clientSecret": "a4FwHlq0iCIKVs2MPIIDnepZnYMa", + "isSaasApplication": true, + "appOwner": "admin", + "jsonString": "{\"grant_types\":\"client_credentials password refresh_token\",\"redirect_uris\":\"www.google.lk\",\"client_name\":\"rest_api123\"}", + "jsonAppAttribute": "{}", + "tokenType": null + } + ``` + Next you must use the above client id and secret to obtain the access token. + We will be using the password grant type for this, you can use any grant type you desire. + You also need to add the proper **scope** when getting the access token. All possible scopes for publisher REST API can be viewed in **OAuth2 Security** section + of this document and scope for each resource is given in **authorization** section of resource documentation. + Following is the format of the request if you are using the password grant type. + ``` + curl -k -d "grant_type=password&username=&password=" + \ -H "Authorization: Basic base64(cliet_id:client_secret)" + \ https://:/token + ``` + **Sample request** + ``` + curl https://localhost:8243/token -k \ + -H "Authorization: Basic Zk9DaTR2Tko1OVBwSHVjQzJDQVlmWXVBRGRNYTphNEZ3SGxxMGlDSUtWczJNUElJRG5lcFpuWU1h" \ + -d "grant_type=password&username=admin&password=admin&scope=apim:api_view apim:api_create" + ``` + Shown below is a sample response to the above request. + ``` + { + "access_token": "e79bda48-3406-3178-acce-f6e4dbdcbb12", + "refresh_token": "a757795d-e69f-38b8-bd85-9aded677a97c", + "scope": "apim:api_create apim:api_view", + "token_type": "Bearer", + "expires_in": 3600 + } + ``` + Now you have a valid access token, which you can use to invoke an API. + Navigate through the API descriptions to find the required API, obtain an access token as described above and invoke the API with the authentication header. + If you use a different authentication mechanism, this process may change. + + # Try out in Postman + If you want to try-out the embedded postman collection with "Run in Postman" option, please follow the guidelines listed below. + * All of the OAuth2 secured endpoints have been configured with an Authorization Bearer header with a parameterized access token. Before invoking any REST API resource make sure you run the `Register DCR Application` and `Generate Access Token` requests to fetch an access token with all required scopes. + * Make sure you have an API Manager instance up and running. + * Update the `basepath` parameter to match the hostname and port of the APIM instance. + + [![Run in Postman](https://run.pstmn.io/button.svg)](https://app.getpostman.com/run-collection/a09044034b5c3c1b01a9) contact: - name: "WSO2" - url: "http://wso2.com/products/api-manager/" - email: "architecture@wso2.com" + name: WSO2 + url: http://wso2.com/products/api-manager/ + email: architecture@wso2.com license: - name: "Apache 2.0" - url: "http://www.apache.org/licenses/LICENSE-2.0.html" - -###################################################### -# The fixed parts of the URLs of the API -###################################################### - -# The schemes supported by the API -schemes: - - https - -# The domain of the API. -# This is configured by the customer during deployment. -# The given host is just an example. -host: apis.wso2.com - -# The base path of the API. -# Will be prefixed to all paths. -basePath: /api/am/publisher/v0.12 - -# The following media types can be passed as input in message bodies of the API. -# The actual media type must be specified in the Content-Type header field of the request. -# The default is json, i.e. the Content-Type header is not needed to -# be set, but supporting it serves extensibility. -consumes: - - application/json - -# The following media types may be passed as output in message bodies of the API. -# The media type(s) consumable by the requestor is specified in the Accept header field -# of the corresponding request. -# The actual media type returned will be specfied in the Content-Type header field -# of the of the response. -# The default of the Accept header is json, i.e. there is not needed to -# set the value, but supporting it serves extensibility. -produces: - - application/json - - -x-wso2-security: - apim: - x-wso2-scopes: - - description: "" - roles: admin - name: apim:api_view - key: apim:api_view - - description: "" - roles: admin - name: apim:api_create - key: apim:api_create - - description: "" - roles: admin - name: apim:api_publish - key: apim:api_publish - - description: "" - roles: admin - name: apim:tier_view - key: apim:tier_view - - description: "" - roles: admin - name: apim:tier_manage - key: apim:tier_manage - - description: "" - roles: admin - name: apim:subscription_view - key: apim:subscription_view - - description: "" - roles: admin - name: apim:subscription_block - key: apim:subscription_block - - description: "" - roles: admin - name: apim:mediation_policy_view - key: apim:mediation_policy_view - - description: "" - roles: admin - name: apim:api_workflow - key: apim:api_workflow - - -###################################################### -# The "API Collection" resource APIs -###################################################### + name: Apache 2.0 + url: http://www.apache.org/licenses/LICENSE-2.0.html + version: v2 +servers: + - url: https://apis.wso2.com/api/am/publisher/v2 +security: + - OAuth2Security: + - apim:api_view paths: + ###################################################### + # The "API Collection" resource APIs + ###################################################### /apis: - -#----------------------------------------------------- -# Retrieving the list of all APIs qualifying under a given search condition -#----------------------------------------------------- get: - x-scope: apim:api_view - x-wso2-curl: "curl -k -H \"Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8\" https://localhost:9443/api/am/publisher/v0.12/apis" - x-wso2-request: | - GET https://localhost:9443/api/am/publisher/v0.12/apis - Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8 - x-wso2-response: "HTTP/1.1 200 OK\nContent-Type: application/json\n\n{\n \"previous\": \"\",\n \"list\": [\n {\n \"provider\": \"admin\",\n \"version\": \"1.0.0\",\n \"description\": \"This sample API provides Account Status Validation\",\n \"name\": \"AccountVal\",\n \"context\": \"/account\",\n \"id\": \"2e81f147-c8a8-4f68-b4f0-69e0e7510b01\",\n \"status\": \"PUBLISHED\"\n },\n {\n \"provider\": \"admin\",\n \"version\": \"1.0.0\",\n \"description\": null,\n \"name\": \"api1\",\n \"context\": \"/api1\",\n \"id\": \"3e22d2fb-277a-4e9e-8c7e-1c0f7f73960e\",\n \"status\": \"PUBLISHED\"\n }\n ],\n \"next\": \"\",\n \"count\": 2\n}" + tags: + - APIs summary: | Retrieve/Search APIs description: | @@ -117,9 +124,10 @@ paths: Each retrieved API is represented with a minimal amount of attributes. If you want to get complete details of an API, you need to use **Get details of an API** operation. parameters: - - $ref : '#/parameters/limit' - - $ref : '#/parameters/offset' - - name : query + - $ref: '#/components/parameters/limit' + - $ref: '#/components/parameters/offset' + - $ref: '#/components/parameters/requestedTenant' + - name: query in: query description: | **Search condition**. @@ -127,3565 +135,11542 @@ paths: You can search in attributes by using an **":"** modifier. Eg. - "provider:wso2" will match an API if the provider of the API is exactly "wso2". - - Additionally you can use wildcards. + "provider:wso2" will match an API if the provider of the API contains "wso2". + "provider:"wso2"" will match an API if the provider of the API is exactly "wso2". + "status:PUBLISHED" will match an API if the API is in PUBLISHED state. + "label:external" will match an API if it contains a Microgateway label called "external". + Also you can use combined modifiers Eg. - "provider:wso2*" will match an API if the provider of the API starts with "wso2". + name:pizzashack version:v1 will match an API if the name of the API is pizzashack and version is v1. - Supported attribute modifiers are [**version, context, status, - description, subcontext, doc, provider**] + Supported attribute modifiers are [**version, context, name, status, + description, subcontext, doc, provider, label**] If no advanced attribute modifier has been specified, the API names containing the search term will be returned as a result. - type: string - - $ref : "#/parameters/Accept" - - $ref : "#/parameters/If-None-Match" - tags: - - API (Collection) + Please note that you need to use encoded URL (URL encoding) if you are using a client which does not support URL encoding (such as curl) + schema: + type: string + - $ref: '#/components/parameters/If-None-Match' + - $ref: '#/components/parameters/expand' + - $ref: '#/components/parameters/Accept' responses: 200: description: | OK. List of qualifying APIs is returned. - schema: - $ref: '#/definitions/APIList' headers: - Content-Type: - description: The content type of the body. - type: string ETag: description: | Entity Tag of the response resource. Used by caches, or in conditional requests (Will be supported in future). - type: string + schema: + type: string + Content-Type: + description: The content type of the body. + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/APIList' 304: description: | Not Modified. Empty body because the client has already the latest version of the requested resource (Will be supported in future). + content: {} 406: - description: | - Not Acceptable. - The requested media type is not supported - schema: - $ref: '#/definitions/Error' + $ref: '#/components/responses/NotAcceptable' + security: + - OAuth2Security: + - apim:api_view + - apim:api_import_export + x-code-samples: + - lang: Curl + source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" + "https://127.0.0.1:9443/api/am/publisher/v2/apis"' + x-examples: + $ref: docs/examples/apis/apis_get.yaml + operationId: getAllAPIs -#----------------------------------------------------- -# Create a new API -API (Individual) -#----------------------------------------------------- post: - x-scope: apim:api_create - x-wso2-curl: "curl -k -H \"Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8\" -H \"Content-Type: application/json\" -X POST -d @data.json https://localhost:9443/api/am/publisher/v0.12/apis" - x-wso2-request: "POST https://localhost:9443/api/am/publisher/v0.12/apis\nAuthorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8\n\n{\r\n \"name\": \"PizzaShackAPI\",\r\n \"description\": \"This document describe a RESTFul API for Pizza Shack online pizza delivery store.\\r\\n\",\r\n \"context\": \"/pizzashack\",\r\n \"version\": \"1.0.0\",\r\n \"provider\": \"admin\",\r\n \"apiDefinition\": \"{\\\"paths\\\":{\\\"/order\\\":{\\\"post\\\":{\\\"x-auth-type\\\":\\\"Application & Application User\\\",\\\"x-throttling-tier\\\":\\\"Unlimited\\\",\\\"description\\\":\\\"Create a new Order\\\",\\\"parameters\\\":[{\\\"schema\\\":{\\\"$ref\\\":\\\"#/definitions/Order\\\"},\\\"description\\\":\\\"Order object that needs to be added\\\",\\\"name\\\":\\\"body\\\",\\\"required\\\":true,\\\"in\\\":\\\"body\\\"}],\\\"responses\\\":{\\\"201\\\":{\\\"headers\\\":{\\\"Location\\\":{\\\"description\\\":\\\"The URL of the newly created resource.\\\",\\\"type\\\":\\\"string\\\"}},\\\"schema\\\":{\\\"$ref\\\":\\\"#/definitions/Order\\\"},\\\"description\\\":\\\"Created.\\\"}}}},\\\"/menu\\\":{\\\"get\\\":{\\\"x-auth-type\\\":\\\"Application & Application User\\\",\\\"x-throttling-tier\\\":\\\"Unlimited\\\",\\\"description\\\":\\\"Return a list of available menu items\\\",\\\"parameters\\\":[],\\\"responses\\\":{\\\"200\\\":{\\\"headers\\\":{},\\\"schema\\\":{\\\"title\\\":\\\"Menu\\\",\\\"properties\\\":{\\\"list\\\":{\\\"items\\\":{\\\"$ref\\\":\\\"#/definitions/MenuItem\\\"},\\\"type\\\":\\\"array\\\"}},\\\"type\\\":\\\"object\\\"},\\\"description\\\":\\\"OK.\\\"}}}}},\\\"schemes\\\":[\\\"https\\\"],\\\"produces\\\":[\\\"application/json\\\"],\\\"swagger\\\":\\\"2.0\\\",\\\"definitions\\\":{\\\"MenuItem\\\":{\\\"title\\\":\\\"Pizza menu Item\\\",\\\"properties\\\":{\\\"price\\\":{\\\"type\\\":\\\"string\\\"},\\\"description\\\":{\\\"type\\\":\\\"string\\\"},\\\"name\\\":{\\\"type\\\":\\\"string\\\"},\\\"image\\\":{\\\"type\\\":\\\"string\\\"}},\\\"required\\\":[\\\"name\\\"]},\\\"Order\\\":{\\\"title\\\":\\\"Pizza Order\\\",\\\"properties\\\":{\\\"customerName\\\":{\\\"type\\\":\\\"string\\\"},\\\"delivered\\\":{\\\"type\\\":\\\"boolean\\\"},\\\"address\\\":{\\\"type\\\":\\\"string\\\"},\\\"pizzaType\\\":{\\\"type\\\":\\\"string\\\"},\\\"creditCardNumber\\\":{\\\"type\\\":\\\"string\\\"},\\\"quantity\\\":{\\\"type\\\":\\\"number\\\"},\\\"orderId\\\":{\\\"type\\\":\\\"string\\\"}},\\\"required\\\":[\\\"orderId\\\"]}},\\\"consumes\\\":[\\\"application/json\\\"],\\\"info\\\":{\\\"title\\\":\\\"PizzaShackAPI\\\",\\\"description\\\":\\\"This document describe a RESTFul API for Pizza Shack online pizza delivery store.\\\\n\\\",\\\"license\\\":{\\\"name\\\":\\\"Apache 2.0\\\",\\\"url\\\":\\\"http://www.apache.org/licenses/LICENSE-2.0.html\\\"},\\\"contact\\\":{\\\"email\\\":\\\"architecture@pizzashack.com\\\",\\\"name\\\":\\\"John Doe\\\",\\\"url\\\":\\\"http://www.pizzashack.com\\\"},\\\"version\\\":\\\"1.0.0\\\"}}\",\r\n \"wsdlUri\": null,\r\n \"status\": \"PUBLISHED\",\r\n \"responseCaching\": \"Disabled\",\r\n \"cacheTimeout\": 300,\r\n \"destinationStatsEnabled\": false,\r\n \"isDefaultVersion\": false,\r\n \"type\": \"HTTP\",\r\n \"transport\": [\r\n \"http\",\r\n \"https\"\r\n ],\r\n \"tags\": [\"pizza\"],\r\n \"tiers\": [\"Unlimited\"],\r\n \"maxTps\": {\r\n \"sandbox\": 5000,\r\n \"production\": 1000\r\n },\r\n \"visibility\": \"PUBLIC\",\r\n \"visibleRoles\": [],\\r\n \"endpointConfig\": \"{\\\"production_endpoints\\\":{\\\"url\\\":\\\"https://localhost:9443/am/sample/pizzashack/v1/api/\\\",\\\"config\\\":null},\\\"sandbox_endpoints\\\":{\\\"url\\\":\\\"https://localhost:9443/am/sample/pizzashack/v1/api/\\\",\\\"config\\\":null},\\\"endpoint_type\\\":\\\"http\\\"}\",\r\n \"endpointSecurity\": {\r\n \"username\": \"user\",\r\n \"type\": \"basic\",\r\n \"password\": \"pass\"\r\n },\r\n \"gatewayEnvironments\": \"Production and Sandbox\",\r\n \"sequences\": [{\"name\":\"json_validator\",\"type\": \"in\"},{\"name\":\"log_out_message\",\"type\": \"out\"}],\r\n \"subscriptionAvailability\": null,\r\n \"subscriptionAvailableTenants\": [],\r\n \"businessInformation\": {\r\n \"businessOwnerEmail\": \"marketing@pizzashack.com\",\r\n \"technicalOwnerEmail\": \"architecture@pizzashack.com\",\r\n \"technicalOwner\": \"John Doe\",\r\n \"businessOwner\": \"Jane Roe\"\r\n },\r\n \"corsConfiguration\": {\r\n \"accessControlAllowOrigins\": [\"*\"],\r\n \"accessControlAllowHeaders\": [\r\n \"authorization\",\r\n \"Access-Control-Allow-Origin\",\r\n \"Content-Type\",\r\n \"SOAPAction\"\r\n ],\r\n \"accessControlAllowMethods\": [\r\n \"GET\",\r\n \"PUT\",\r\n \"POST\",\r\n \"DELETE\",\r\n \"PATCH\",\r\n \"OPTIONS\"\r\n ],\r\n \"accessControlAllowCredentials\": false,\r\n \"corsConfigurationEnabled\": false\r\n }\r\n}" - x-wso2-response: "HTTP/1.1 201 Created\nLocation: https://localhost:9443/api/am/publisher/v0.12/apis/7a2298c4-c905-403f-8fac-38c73301631f\nContent-Type: application/json\n\n{\r\n \"id\": \"7a2298c4-c905-403f-8fac-38c73301631f\",\r\n \"name\": \"PizzaShackAPI\",\r\n \"description\": \"This document describe a RESTFul API for Pizza Shack online pizza delivery store.\\r\\n\",\r\n \"context\": \"/pizzashack\",\r\n \"version\": \"1.0.0\",\r\n \"provider\": \"admin\",\r\n \"apiDefinition\": \"{\\\"paths\\\":{\\\"/order\\\":{\\\"post\\\":{\\\"x-auth-type\\\":\\\"Application & Application User\\\",\\\"x-throttling-tier\\\":\\\"Unlimited\\\",\\\"description\\\":\\\"Create a new Order\\\",\\\"parameters\\\":[{\\\"schema\\\":{\\\"$ref\\\":\\\"#/definitions/Order\\\"},\\\"description\\\":\\\"Order object that needs to be added\\\",\\\"name\\\":\\\"body\\\",\\\"required\\\":true,\\\"in\\\":\\\"body\\\"}],\\\"responses\\\":{\\\"201\\\":{\\\"headers\\\":{\\\"Location\\\":{\\\"description\\\":\\\"The URL of the newly created resource.\\\",\\\"type\\\":\\\"string\\\"}},\\\"schema\\\":{\\\"$ref\\\":\\\"#/definitions/Order\\\"},\\\"description\\\":\\\"Created.\\\"}}}},\\\"/menu\\\":{\\\"get\\\":{\\\"x-auth-type\\\":\\\"Application & Application User\\\",\\\"x-throttling-tier\\\":\\\"Unlimited\\\",\\\"description\\\":\\\"Return a list of available menu items\\\",\\\"parameters\\\":[],\\\"responses\\\":{\\\"200\\\":{\\\"headers\\\":{},\\\"schema\\\":{\\\"title\\\":\\\"Menu\\\",\\\"properties\\\":{\\\"list\\\":{\\\"items\\\":{\\\"$ref\\\":\\\"#/definitions/MenuItem\\\"},\\\"type\\\":\\\"array\\\"}},\\\"type\\\":\\\"object\\\"},\\\"description\\\":\\\"OK.\\\"}}}}},\\\"schemes\\\":[\\\"https\\\"],\\\"produces\\\":[\\\"application/json\\\"],\\\"swagger\\\":\\\"2.0\\\",\\\"definitions\\\":{\\\"MenuItem\\\":{\\\"title\\\":\\\"Pizza menu Item\\\",\\\"properties\\\":{\\\"price\\\":{\\\"type\\\":\\\"string\\\"},\\\"description\\\":{\\\"type\\\":\\\"string\\\"},\\\"name\\\":{\\\"type\\\":\\\"string\\\"},\\\"image\\\":{\\\"type\\\":\\\"string\\\"}},\\\"required\\\":[\\\"name\\\"]},\\\"Order\\\":{\\\"title\\\":\\\"Pizza Order\\\",\\\"properties\\\":{\\\"customerName\\\":{\\\"type\\\":\\\"string\\\"},\\\"delivered\\\":{\\\"type\\\":\\\"boolean\\\"},\\\"address\\\":{\\\"type\\\":\\\"string\\\"},\\\"pizzaType\\\":{\\\"type\\\":\\\"string\\\"},\\\"creditCardNumber\\\":{\\\"type\\\":\\\"string\\\"},\\\"quantity\\\":{\\\"type\\\":\\\"number\\\"},\\\"orderId\\\":{\\\"type\\\":\\\"integer\\\"}},\\\"required\\\":[\\\"orderId\\\"]}},\\\"consumes\\\":[\\\"application/json\\\"],\\\"info\\\":{\\\"title\\\":\\\"PizzaShackAPI\\\",\\\"description\\\":\\\"This document describe a RESTFul API for Pizza Shack online pizza delivery store.\\\\n\\\",\\\"license\\\":{\\\"name\\\":\\\"Apache 2.0\\\",\\\"url\\\":\\\"http://www.apache.org/licenses/LICENSE-2.0.html\\\"},\\\"contact\\\":{\\\"email\\\":\\\"architecture@pizzashack.com\\\",\\\"name\\\":\\\"John Doe\\\",\\\"url\\\":\\\"http://www.pizzashack.com\\\"},\\\"version\\\":\\\"1.0.0\\\"}}\",\r\n \"wsdlUri\": null,\r\n \"responseCaching\": \"Disabled\",\r\n \"cacheTimeout\": 300,\r\n \"destinationStatsEnabled\": null,\r\n \"isDefaultVersion\": false,\r\n \"type\": \"HTTP\",\r\n \"transport\": [\r\n \"http\",\r\n \"https\"\r\n ],\r\n \"tags\": [\"pizza\"],\r\n \"tiers\": [\"Unlimited\"],\r\n \"maxTps\": {\r\n \"sandbox\": 5000,\r\n \"production\": 1000\r\n },\r\n \"thumbnailUri\": null,\r\n \"visibility\": \"PUBLIC\",\r\n \"visibleRoles\": [],\\r\n \"endpointConfig\": \"{\\\"production_endpoints\\\":{\\\"url\\\":\\\"https://localhost:9443/am/sample/pizzashack/v1/api/\\\",\\\"config\\\":null},\\\"sandbox_endpoints\\\":{\\\"url\\\":\\\"https://localhost:9443/am/sample/pizzashack/v1/api/\\\",\\\"config\\\":null},\\\"endpoint_type\\\":\\\"http\\\"}\",\r\n \"endpointSecurity\": {\r\n \"username\": \"user\",\r\n \"type\": \"basic\",\r\n \"password\": \"pass\"\r\n },\r\n \"gatewayEnvironments\": \"Production and Sandbox\",\r\n \"sequences\": [{\"name\":\"json_validator\",\"type\":\"in\",\"id\":\"142ece76-b208-4aab-b29a-f382045ed066\",\"shared\":false},{\"name\":\"log_out_message\",\"type\":\"out\",\"id\":\"b3527be8-95e6-41e0-8097-3276987b7d4b\",\"shared\":false}],\r\n \"subscriptionAvailability\": null,\r\n \"subscriptionAvailableTenants\": [],\r\n \"businessInformation\": {\r\n \"businessOwnerEmail\": \"marketing@pizzashack.com\",\r\n \"technicalOwnerEmail\": \"architecture@pizzashack.com\",\r\n \"technicalOwner\": \"John Doe\",\r\n \"businessOwner\": \"Jane Roe\"\r\n },\r\n \"corsConfiguration\": {\r\n \"accessControlAllowOrigins\": [\"*\"],\r\n \"accessControlAllowHeaders\": [\r\n \"authorization\",\r\n \"Access-Control-Allow-Origin\",\r\n \"Content-Type\",\r\n \"SOAPAction\"\r\n ],\r\n \"accessControlAllowMethods\": [\r\n \"GET\",\r\n \"PUT\",\r\n \"POST\",\r\n \"DELETE\",\r\n \"PATCH\",\r\n \"OPTIONS\"\r\n ],\r\n \"accessControlAllowCredentials\": false,\r\n \"corsConfigurationEnabled\": false\r\n }\r\n}" - summary: Create a new API + tags: + - APIs + summary: Create a New API description: | This operation can be used to create a new API specifying the details of the API in the payload. The new API will be in `CREATED` state. There is a special capability for a user who has `APIM Admin` permission such that he can create APIs on behalf of other users. For that he can to specify `"provider" : "some_other_user"` in the payload so that the API's creator will be shown as `some_other_user` in the UI. parameters: - - in: body - name: body - description: | - API object that needs to be added - required: true + - name: openAPIVersion + in: query + description: Open api version schema: - $ref: '#/definitions/API' - - $ref: '#/parameters/Content-Type' - - $ref: '#/parameters/Authorization' - tags: - - API (Individual) + type: string + default: v3 + enum: + - v2 + - v3 + requestBody: + description: API object that needs to be added + content: + application/json: + schema: + $ref: '#/components/schemas/API' + required: true responses: 201: description: | Created. Successful response with the newly created object as entity in the body. Location header contains URL of newly created entity. - schema: - $ref: '#/definitions/API' headers: + ETag: + description: | + Entity Tag of the response resource. Used by caches, or in conditional requests (Will be supported in future). + schema: + type: string Location: description: | The URL of the newly created resource. - type: string + schema: + type: string Content-Type: description: | The content type of the body. - type: string - Authorization: - description: | - The brearer token. - type: string - ETag: - description: | - Entity Tag of the response resource. Used by caches, or in conditional requests (Will be supported in future). - type: string + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/API' 400: - description: | - Bad Request. - Invalid request or validation error. - schema: - $ref: '#/definitions/Error' + $ref: '#/components/responses/BadRequest' 415: - description: | - Unsupported Media Type. - The entity of the request was in a not supported format. - schema: - $ref: '#/definitions/Error' - -###################################################### -# The "Individual API" resource APIs -###################################################### + $ref: '#/components/responses/UnsupportedMediaType' + security: + - OAuth2Security: + - apim:api_create + x-code-samples: + - lang: Curl + source: 'curl -k -X POST -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" + -H "Content-Type: application/json" -d @data.json "https://127.0.0.1:9443/api/am/publisher/v2/apis"' + x-examples: + $ref: docs/examples/apis/apis_post.yaml + operationId: createAPI + + ###################################################### + # The "Individual API" resource APIs + ###################################################### /apis/{apiId}: - -#----------------------------------------------------- -# Retrieve the details of an API definition -#----------------------------------------------------- get: - x-scope: apim:api_view - x-wso2-curl: "curl -k -H \"Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8\" https://localhost:9443/api/am/publisher/v0.12/apis/7a2298c4-c905-403f-8fac-38c73301631f" - x-wso2-request: | - GET https://localhost:9443/api/am/publisher/v0.12/apis/7a2298c4-c905-403f-8fac-38c73301631f - Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8 - x-wso2-response: "HTTP/1.1 200 OK\nContent-Type: application/json\n\n{\r\n \"id\": \"7a2298c4-c905-403f-8fac-38c73301631f\",\r\n \"name\": \"PizzaShackAPI\",\r\n \"description\": \"This document describe a RESTFul API for Pizza Shack online pizza delivery store.\\r\\n\",\r\n \"context\": \"/pizzashack\",\r\n \"version\": \"1.0.0\",\r\n \"provider\": \"admin\",\r\n \"apiDefinition\": \"{\\\"paths\\\":{\\\"/order\\\":{\\\"post\\\":{\\\"x-auth-type\\\":\\\"Application & Application User\\\",\\\"x-throttling-tier\\\":\\\"Unlimited\\\",\\\"description\\\":\\\"Create a new Order\\\",\\\"parameters\\\":[{\\\"schema\\\":{\\\"$ref\\\":\\\"#/definitions/Order\\\"},\\\"description\\\":\\\"Order object that needs to be added\\\",\\\"name\\\":\\\"body\\\",\\\"required\\\":true,\\\"in\\\":\\\"body\\\"}],\\\"responses\\\":{\\\"201\\\":{\\\"headers\\\":{\\\"Location\\\":{\\\"description\\\":\\\"The URL of the newly created resource.\\\",\\\"type\\\":\\\"string\\\"}},\\\"schema\\\":{\\\"$ref\\\":\\\"#/definitions/Order\\\"},\\\"description\\\":\\\"Created.\\\"}}}},\\\"/menu\\\":{\\\"get\\\":{\\\"x-auth-type\\\":\\\"Application & Application User\\\",\\\"x-throttling-tier\\\":\\\"Unlimited\\\",\\\"description\\\":\\\"Return a list of available menu items\\\",\\\"parameters\\\":[],\\\"responses\\\":{\\\"200\\\":{\\\"headers\\\":{},\\\"schema\\\":{\\\"title\\\":\\\"Menu\\\",\\\"properties\\\":{\\\"list\\\":{\\\"items\\\":{\\\"$ref\\\":\\\"#/definitions/MenuItem\\\"},\\\"type\\\":\\\"array\\\"}},\\\"type\\\":\\\"object\\\"},\\\"description\\\":\\\"OK.\\\"}}}}},\\\"schemes\\\":[\\\"https\\\"],\\\"produces\\\":[\\\"application/json\\\"],\\\"swagger\\\":\\\"2.0\\\",\\\"definitions\\\":{\\\"MenuItem\\\":{\\\"title\\\":\\\"Pizza menu Item\\\",\\\"properties\\\":{\\\"price\\\":{\\\"type\\\":\\\"string\\\"},\\\"description\\\":{\\\"type\\\":\\\"string\\\"},\\\"name\\\":{\\\"type\\\":\\\"string\\\"},\\\"image\\\":{\\\"type\\\":\\\"string\\\"}},\\\"required\\\":[\\\"name\\\"]},\\\"Order\\\":{\\\"title\\\":\\\"Pizza Order\\\",\\\"properties\\\":{\\\"customerName\\\":{\\\"type\\\":\\\"string\\\"},\\\"delivered\\\":{\\\"type\\\":\\\"boolean\\\"},\\\"address\\\":{\\\"type\\\":\\\"string\\\"},\\\"pizzaType\\\":{\\\"type\\\":\\\"string\\\"},\\\"creditCardNumber\\\":{\\\"type\\\":\\\"string\\\"},\\\"quantity\\\":{\\\"type\\\":\\\"number\\\"},\\\"orderId\\\":{\\\"type\\\":\\\"string\\\"}},\\\"required\\\":[\\\"orderId\\\"]}},\\\"consumes\\\":[\\\"application/json\\\"],\\\"info\\\":{\\\"title\\\":\\\"PizzaShackAPI\\\",\\\"description\\\":\\\"This document describe a RESTFul API for Pizza Shack online pizza delivery store.\\\\n\\\",\\\"license\\\":{\\\"name\\\":\\\"Apache 2.0\\\",\\\"url\\\":\\\"http://www.apache.org/licenses/LICENSE-2.0.html\\\"},\\\"contact\\\":{\\\"email\\\":\\\"architecture@pizzashack.com\\\",\\\"name\\\":\\\"John Doe\\\",\\\"url\\\":\\\"http://www.pizzashack.com\\\"},\\\"version\\\":\\\"1.0.0\\\"}}\",\r\n \"wsdlUri\": null,\r\n \"status\": \"CREATED\",\r\n \"responseCaching\": \"Disabled\",\r\n \"cacheTimeout\": 300,\r\n \"destinationStatsEnabled\": null,\r\n \"isDefaultVersion\": false,\r\n \"type\": \"HTTP\",\r\n \"transport\": [\r\n \"http\",\r\n \"https\"\r\n ],\r\n \"tags\": [\"pizza\"],\r\n \"tiers\": [\"Unlimited\"],\r\n \"maxTps\": {\r\n \"sandbox\": 5000,\r\n \"production\": 1000\r\n },\r\n \"thumbnailUri\": null,\r\n \"visibility\": \"PUBLIC\",\r\n \"visibleRoles\": [],\\r\n \"endpointConfig\": \"{\\\"production_endpoints\\\":{\\\"url\\\":\\\"https://localhost:9443/am/sample/pizzashack/v1/api/\\\",\\\"config\\\":null},\\\"sandbox_endpoints\\\":{\\\"url\\\":\\\"https://localhost:9443/am/sample/pizzashack/v1/api/\\\",\\\"config\\\":null},\\\"endpoint_type\\\":\\\"http\\\"}\",\r\n \"endpointSecurity\": {\r\n \"username\": \"user\",\r\n \"type\": \"basic\",\r\n \"password\": \"pass\"\r\n },\r\n \"gatewayEnvironments\": \"Production and Sandbox\",\r\n \"sequences\": [],\r\n \"subscriptionAvailability\": null,\r\n \"subscriptionAvailableTenants\": [],\r\n \"businessInformation\": {\r\n \"businessOwnerEmail\": \"marketing@pizzashack.com\",\r\n \"technicalOwnerEmail\": \"architecture@pizzashack.com\",\r\n \"technicalOwner\": \"John Doe\",\r\n \"businessOwner\": \"Jane Roe\"\r\n },\r\n \"corsConfiguration\": {\r\n \"accessControlAllowOrigins\": [\"*\"],\r\n \"accessControlAllowHeaders\": [\r\n \"authorization\",\r\n \"Access-Control-Allow-Origin\",\r\n \"Content-Type\",\r\n \"SOAPAction\"\r\n ],\r\n \"accessControlAllowMethods\": [\r\n \"GET\",\r\n \"PUT\",\r\n \"POST\",\r\n \"DELETE\",\r\n \"PATCH\",\r\n \"OPTIONS\"\r\n ],\r\n \"accessControlAllowCredentials\": false,\r\n \"corsConfigurationEnabled\": false\r\n }\r\n}" - summary: Get details of an API + tags: + - APIs + summary: Get Details of an API description: | Using this operation, you can retrieve complete details of a single API. You need to provide the Id of the API to retrive it. parameters: - - $ref: '#/parameters/apiId' - - $ref: '#/parameters/Accept' - - $ref: '#/parameters/If-None-Match' - - $ref: '#/parameters/If-Modified-Since' - tags: - - API (Individual) + - $ref: '#/components/parameters/apiId' + - $ref: '#/components/parameters/requestedTenant' + - $ref: '#/components/parameters/If-None-Match' responses: 200: description: | OK. Requested API is returned headers: - Content-Type: - description: | - The content type of the body. - type: string ETag: description: | Entity Tag of the response resource. Used by caches, or in conditional requests (Will be supported in future). - type: string + schema: + type: string Last-Modified: description: | Date and time the resource has been modifed the last time. Used by caches, or in conditional requests (Will be supported in future). - type: string - schema: - $ref: '#/definitions/API' + schema: + type: string + Content-Type: + description: | + The content type of the body. + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/API' 304: description: | Not Modified. Empty body because the client has already the latest version of the requested resource (Will be supported in future). + content: {} 404: - description: | - Not Found. - Requested API does not exist. - schema: - $ref: '#/definitions/Error' + $ref: '#/components/responses/NotFound' 406: - description: | - Not Acceptable. - The requested media type is not supported - schema: - $ref: '#/definitions/Error' + $ref: '#/components/responses/NotAcceptable' + security: + - OAuth2Security: + - apim:api_view + - apim:api_import_export + - apim:api_product_import_export + x-code-samples: + - lang: Curl + source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" + "https://127.0.0.1:9443/api/am/publisher/v2/apis/7a2298c4-c905-403f-8fac-38c73301631f"' + x-examples: + $ref: docs/examples/apis/apis_id_get.yaml + operationId: getAPI -#----------------------------------------------------- -# Update the definition of an API -#----------------------------------------------------- put: - x-scope: apim:api_create - x-wso2-curl: "curl -k -H \"Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8\" -H \"Content-Type: application/json\" -X PUT -d @data.json https://localhost:9443/api/am/publisher/v0.12/apis/7a2298c4-c905-403f-8fac-38c73301631f" - x-wso2-request: "PUT https://localhost:9443/api/am/publisher/v0.12/apis/7a2298c4-c905-403f-8fac-38c73301631f\nAuthorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8\nContent-Type: application/json\n\n{\r\n \"id\": \"7a2298c4-c905-403f-8fac-38c73301631f\",\r\n \"name\": \"PizzaShackAPI\",\r\n \"description\": \"This document describe a RESTFul API for Pizza Shack online pizza delivery store.\\r\\n\",\r\n \"context\": \"/pizzashack\",\r\n \"version\": \"1.0.0\",\r\n \"provider\": \"admin\",\r\n \"apiDefinition\": \"{\\\"paths\\\":{\\\"/order\\\":{\\\"post\\\":{\\\"x-auth-type\\\":\\\"Application & Application User\\\",\\\"x-throttling-tier\\\":\\\"Unlimited\\\",\\\"description\\\":\\\"Create a new Order\\\",\\\"parameters\\\":[{\\\"schema\\\":{\\\"$ref\\\":\\\"#/definitions/Order\\\"},\\\"description\\\":\\\"Order object that needs to be added\\\",\\\"name\\\":\\\"body\\\",\\\"required\\\":true,\\\"in\\\":\\\"body\\\"}],\\\"responses\\\":{\\\"201\\\":{\\\"headers\\\":{\\\"Location\\\":{\\\"description\\\":\\\"The URL of the newly created resource.\\\",\\\"type\\\":\\\"string\\\"}},\\\"schema\\\":{\\\"$ref\\\":\\\"#/definitions/Order\\\"},\\\"description\\\":\\\"Created.\\\"}}}},\\\"/menu\\\":{\\\"get\\\":{\\\"x-auth-type\\\":\\\"Application & Application User\\\",\\\"x-throttling-tier\\\":\\\"Unlimited\\\",\\\"description\\\":\\\"Return a list of available menu items\\\",\\\"parameters\\\":[],\\\"responses\\\":{\\\"200\\\":{\\\"headers\\\":{},\\\"schema\\\":{\\\"title\\\":\\\"Menu\\\",\\\"properties\\\":{\\\"list\\\":{\\\"items\\\":{\\\"$ref\\\":\\\"#/definitions/MenuItem\\\"},\\\"type\\\":\\\"array\\\"}},\\\"type\\\":\\\"object\\\"},\\\"description\\\":\\\"OK.\\\"}}}}},\\\"schemes\\\":[\\\"https\\\"],\\\"produces\\\":[\\\"application/json\\\"],\\\"swagger\\\":\\\"2.0\\\",\\\"definitions\\\":{\\\"MenuItem\\\":{\\\"title\\\":\\\"Pizza menu Item\\\",\\\"properties\\\":{\\\"price\\\":{\\\"type\\\":\\\"string\\\"},\\\"description\\\":{\\\"type\\\":\\\"string\\\"},\\\"name\\\":{\\\"type\\\":\\\"string\\\"},\\\"image\\\":{\\\"type\\\":\\\"string\\\"}},\\\"required\\\":[\\\"name\\\"]},\\\"Order\\\":{\\\"title\\\":\\\"Pizza Order\\\",\\\"properties\\\":{\\\"customerName\\\":{\\\"type\\\":\\\"string\\\"},\\\"delivered\\\":{\\\"type\\\":\\\"boolean\\\"},\\\"address\\\":{\\\"type\\\":\\\"string\\\"},\\\"pizzaType\\\":{\\\"type\\\":\\\"string\\\"},\\\"creditCardNumber\\\":{\\\"type\\\":\\\"string\\\"},\\\"quantity\\\":{\\\"type\\\":\\\"number\\\"},\\\"orderId\\\":{\\\"type\\\":\\\"integer\\\"}},\\\"required\\\":[\\\"orderId\\\"]}},\\\"consumes\\\":[\\\"application/json\\\"],\\\"info\\\":{\\\"title\\\":\\\"PizzaShackAPI\\\",\\\"description\\\":\\\"This document describe a RESTFul API for Pizza Shack online pizza delivery store.\\\\n\\\",\\\"license\\\":{\\\"name\\\":\\\"Apache 2.0\\\",\\\"url\\\":\\\"http://www.apache.org/licenses/LICENSE-2.0.html\\\"},\\\"contact\\\":{\\\"email\\\":\\\"architecture@pizzashack.com\\\",\\\"name\\\":\\\"John Doe\\\",\\\"url\\\":\\\"http://www.pizzashack.com\\\"},\\\"version\\\":\\\"1.0.0\\\"}}\",\r\n \"wsdlUri\": null,\r\n \"status\": \"CREATED\",\r\n \"responseCaching\": \"Disabled\",\r\n \"cacheTimeout\": 300,\r\n \"destinationStatsEnabled\": null,\r\n \"isDefaultVersion\": false,\r\n \"type\": \"HTTP\",\r\n \"transport\": [\r\n \"https\"\r\n ],\r\n \"tags\": [\"pizza\",\"chicken\"],\r\n \"tiers\": [\"Unlimited\"],\r\n \"maxTps\": {\r\n \"sandbox\": 500,\r\n \"production\": 100\r\n },\r\n \"thumbnailUri\": null,\r\n \"visibility\": \"PUBLIC\",\r\n \"visibleRoles\": [],\\r\n \"endpointConfig\": \"{\\\"production_endpoints\\\":{\\\"url\\\":\\\"https://localhost:9443/am/sample/pizzashack/v1/api/\\\",\\\"config\\\":null},\\\"sandbox_endpoints\\\":{\\\"url\\\":\\\"https://localhost:9443/am/sample/pizzashack/v1/api/\\\",\\\"config\\\":null},\\\"endpoint_type\\\":\\\"http\\\"}\",\r\n \"endpointSecurity\": {\r\n \"username\": \"user\",\r\n \"type\": \"basic\",\r\n \"password\": \"pass\"\r\n },\r\n \"gatewayEnvironments\": \"Production and Sandbox\",\r\n \"sequences\": [{\"name\":\"json_validator\",\"type\": \"in\"},{\"name\":\"log_out_message\",\"type\": \"out\"}],\r\n \"subscriptionAvailability\": null,\r\n \"subscriptionAvailableTenants\": [],\r\n \"businessInformation\": {\r\n \"businessOwnerEmail\": \"marketing@pizzashack.com\",\r\n \"technicalOwnerEmail\": \"architecture@pizzashack.com\",\r\n \"technicalOwner\": \"John Doe\",\r\n \"businessOwner\": \"Jane Roe\"\r\n },\r\n \"corsConfiguration\": {\r\n \"accessControlAllowOrigins\": [\"*\"],\r\n \"accessControlAllowHeaders\": [\r\n \"authorization\",\r\n \"Access-Control-Allow-Origin\",\r\n \"Content-Type\",\r\n \"SOAPAction\"\r\n ],\r\n \"accessControlAllowMethods\": [\r\n \"GET\",\r\n \"PUT\",\r\n \"POST\",\r\n \"DELETE\",\r\n \"PATCH\",\r\n \"OPTIONS\"\r\n ],\r\n \"accessControlAllowCredentials\": false,\r\n \"corsConfigurationEnabled\": false\r\n }\r\n}" - x-wso2-response: "HTTP/1.1 200 OK\nContent-Type: application/json\n\n{\r\n \"id\": \"7a2298c4-c905-403f-8fac-38c73301631f\",\r\n \"name\": \"PizzaShackAPI\",\r\n \"description\": \"This document describe a RESTFul API for Pizza Shack online pizza delivery store.\\r\\n\",\r\n \"context\": \"/pizzashack\",\r\n \"version\": \"1.0.0\",\r\n \"provider\": \"admin\",\r\n \"apiDefinition\": \"{\\\"paths\\\":{\\\"/order\\\":{\\\"post\\\":{\\\"x-auth-type\\\":\\\"Application & Application User\\\",\\\"x-throttling-tier\\\":\\\"Unlimited\\\",\\\"description\\\":\\\"Create a new Order\\\",\\\"parameters\\\":[{\\\"schema\\\":{\\\"$ref\\\":\\\"#/definitions/Order\\\"},\\\"description\\\":\\\"Order object that needs to be added\\\",\\\"name\\\":\\\"body\\\",\\\"required\\\":true,\\\"in\\\":\\\"body\\\"}],\\\"responses\\\":{\\\"201\\\":{\\\"headers\\\":{\\\"Location\\\":{\\\"description\\\":\\\"The URL of the newly created resource.\\\",\\\"type\\\":\\\"string\\\"}},\\\"schema\\\":{\\\"$ref\\\":\\\"#/definitions/Order\\\"},\\\"description\\\":\\\"Created.\\\"}}}},\\\"/menu\\\":{\\\"get\\\":{\\\"x-auth-type\\\":\\\"Application & Application User\\\",\\\"x-throttling-tier\\\":\\\"Unlimited\\\",\\\"description\\\":\\\"Return a list of available menu items\\\",\\\"parameters\\\":[],\\\"responses\\\":{\\\"200\\\":{\\\"headers\\\":{},\\\"schema\\\":{\\\"title\\\":\\\"Menu\\\",\\\"properties\\\":{\\\"list\\\":{\\\"items\\\":{\\\"$ref\\\":\\\"#/definitions/MenuItem\\\"},\\\"type\\\":\\\"array\\\"}},\\\"type\\\":\\\"object\\\"},\\\"description\\\":\\\"OK.\\\"}}}}},\\\"schemes\\\":[\\\"https\\\"],\\\"produces\\\":[\\\"application/json\\\"],\\\"swagger\\\":\\\"2.0\\\",\\\"definitions\\\":{\\\"MenuItem\\\":{\\\"title\\\":\\\"Pizza menu Item\\\",\\\"properties\\\":{\\\"price\\\":{\\\"type\\\":\\\"string\\\"},\\\"description\\\":{\\\"type\\\":\\\"string\\\"},\\\"name\\\":{\\\"type\\\":\\\"string\\\"},\\\"image\\\":{\\\"type\\\":\\\"string\\\"}},\\\"required\\\":[\\\"name\\\"]},\\\"Order\\\":{\\\"title\\\":\\\"Pizza Order\\\",\\\"properties\\\":{\\\"customerName\\\":{\\\"type\\\":\\\"string\\\"},\\\"delivered\\\":{\\\"type\\\":\\\"boolean\\\"},\\\"address\\\":{\\\"type\\\":\\\"string\\\"},\\\"pizzaType\\\":{\\\"type\\\":\\\"string\\\"},\\\"creditCardNumber\\\":{\\\"type\\\":\\\"string\\\"},\\\"quantity\\\":{\\\"type\\\":\\\"number\\\"},\\\"orderId\\\":{\\\"type\\\":\\\"string\\\"}},\\\"required\\\":[\\\"orderId\\\"]}},\\\"consumes\\\":[\\\"application/json\\\"],\\\"info\\\":{\\\"title\\\":\\\"PizzaShackAPI\\\",\\\"description\\\":\\\"This document describe a RESTFul API for Pizza Shack online pizza delivery store.\\\\n\\\",\\\"license\\\":{\\\"name\\\":\\\"Apache 2.0\\\",\\\"url\\\":\\\"http://www.apache.org/licenses/LICENSE-2.0.html\\\"},\\\"contact\\\":{\\\"email\\\":\\\"architecture@pizzashack.com\\\",\\\"name\\\":\\\"John Doe\\\",\\\"url\\\":\\\"http://www.pizzashack.com\\\"},\\\"version\\\":\\\"1.0.0\\\"}}\",\r\n \"wsdlUri\": null,\r\n \"status\": \"CREATED\",\r\n \"responseCaching\": \"Disabled\",\r\n \"cacheTimeout\": 300,\r\n \"destinationStatsEnabled\": null,\r\n \"isDefaultVersion\": false,\r\n \"type\": \"HTTP\",\r\n \"transport\": [\"https\"],\r\n \"tags\": [\r\n \"chicken\",\r\n \"pizza\"\r\n ],\r\n \"tiers\": [\"Unlimited\"],\r\n \"maxTps\": {\r\n \"sandbox\": 500,\r\n \"production\": 100\r\n },\r\n \"thumbnailUri\": null,\r\n \"visibility\": \"PUBLIC\",\r\n \"visibleRoles\": [],\\r\n \"endpointConfig\": \"{\\\"production_endpoints\\\":{\\\"url\\\":\\\"https://localhost:9443/am/sample/pizzashack/v1/api/\\\",\\\"config\\\":null},\\\"sandbox_endpoints\\\":{\\\"url\\\":\\\"https://localhost:9443/am/sample/pizzashack/v1/api/\\\",\\\"config\\\":null},\\\"endpoint_type\\\":\\\"http\\\"}\",\r\n \"endpointSecurity\": {\r\n \"username\": \"user\",\r\n \"type\": \"basic\",\r\n \"password\": \"pass\"\r\n },\r\n \"gatewayEnvironments\": \"Production and Sandbox\",\r\n \"sequences\": [{\"name\":\"json_validator\",\"type\":\"in\",\"id\":\"142ece76-b208-4aab-b29a-f382045ed066\",\"shared\":false},{\"name\":\"log_out_message\",\"type\":\"out\",\"id\":\"b3527be8-95e6-41e0-8097-3276987b7d4b\",\"shared\":false}],\r\n \"subscriptionAvailability\": null,\r\n \"subscriptionAvailableTenants\": [],\r\n \"businessInformation\": {\r\n \"businessOwnerEmail\": \"marketing@pizzashack.com\",\r\n \"technicalOwnerEmail\": \"architecture@pizzashack.com\",\r\n \"technicalOwner\": \"John Doe\",\r\n \"businessOwner\": \"Jane Roe\"\r\n },\r\n \"corsConfiguration\": {\r\n \"accessControlAllowOrigins\": [\"*\"],\r\n \"accessControlAllowHeaders\": [\r\n \"authorization\",\r\n \"Access-Control-Allow-Origin\",\r\n \"Content-Type\",\r\n \"SOAPAction\"\r\n ],\r\n \"accessControlAllowMethods\": [\r\n \"GET\",\r\n \"PUT\",\r\n \"POST\",\r\n \"DELETE\",\r\n \"PATCH\",\r\n \"OPTIONS\"\r\n ],\r\n \"accessControlAllowCredentials\": false,\r\n \"corsConfigurationEnabled\": false\r\n }\r\n}" + tags: + - APIs summary: Update an API description: | This operation can be used to update an existing API. But the properties `name`, `version`, `context`, `provider`, `state` will not be changed by this operation. parameters: - - $ref: '#/parameters/apiId' - - in: body - name: body - description: | - API object that needs to be added - required: true - schema: - $ref: '#/definitions/API' - - $ref: '#/parameters/Content-Type' - - $ref: '#/parameters/If-Match' - - $ref: '#/parameters/If-Unmodified-Since' - tags: - - API (Individual) + - $ref: '#/components/parameters/apiId' + - $ref: '#/components/parameters/If-Match' + requestBody: + description: API object that needs to be added + content: + application/json: + schema: + $ref: '#/components/schemas/API' + required: true responses: 200: description: | OK. Successful response with updated API object - schema: - $ref: '#/definitions/API' headers: - Location: - description: | - The URL of the newly created resource. - type: string - Content-Type: - description: | - The content type of the body. - type: string ETag: description: | Entity Tag of the response resource. Used by caches, or in conditional requests (Will be supported in future). - type: string + schema: + type: string Last-Modified: description: | Date and time the resource has been modifed the last time. Used by caches, or in conditional requests (Will be supported in future). - type: string + schema: + type: string + Location: + description: | + The URL of the newly created resource. + schema: + type: string + Content-Type: + description: | + The content type of the body. + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/API' 400: - description: | - Bad Request. - Invalid request or validation error - schema: - $ref: '#/definitions/Error' + $ref: '#/components/responses/BadRequest' 403: - description: | - Forbidden. - The request must be conditional but no condition has been specified. - schema: - $ref: '#/definitions/Error' + $ref: '#/components/responses/Forbidden' 404: - description: | - Not Found. - The resource to be updated does not exist. - schema: - $ref: '#/definitions/Error' + $ref: '#/components/responses/NotFound' + 409: + $ref: '#/components/responses/Conflict' 412: - description: | - Precondition Failed. - The request has not been performed because one of the preconditions is not met. - schema: - $ref: '#/definitions/Error' + $ref: '#/components/responses/PreconditionFailed' + security: + - OAuth2Security: + - apim:api_create + - apim:api_publish + x-code-samples: + - lang: Curl + source: 'curl -k -X PUT -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" + -H "Content-Type: application/json" -d @data.json "https://127.0.0.1:9443/api/am/publisher/v2/apis/7a2298c4-c905-403f-8fac-38c73301631f"' + operationId: updateAPI -#----------------------------------------------------- -# Delete the definition of an API -#----------------------------------------------------- delete: - x-scope: apim:api_create - x-wso2-curl: "curl -k -H \"Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8\" -X DELETE https://localhost:9443/api/am/publisher/v0.12/apis/6fb74674-4ab8-4b52-9886-f9a376985060" - x-wso2-request: | - DELETE https://localhost:9443/api/am/publisher/v0.12/apis/6fb74674-4ab8-4b52-9886-f9a376985060 - Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8 - x-wso2-response: "HTTP/1.1 200 OK" + tags: + - APIs summary: Delete an API description: | This operation can be used to delete an existing API proving the Id of the API. parameters: - - $ref: '#/parameters/apiId' - - $ref: '#/parameters/If-Match' - - $ref: '#/parameters/If-Unmodified-Since' - tags: - - API (Individual) + - $ref: '#/components/parameters/apiId' + - $ref: '#/components/parameters/If-Match' responses: 200: description: | OK. Resource successfully deleted. + content: {} 403: - description: | - Forbidden. - The request must be conditional but no condition has been specified. - schema: - $ref: '#/definitions/Error' + $ref: '#/components/responses/Forbidden' 404: - description: | - Not Found. - Resource to be deleted does not exist. - schema: - $ref: '#/definitions/Error' + $ref: '#/components/responses/NotFound' + 409: + $ref: '#/components/responses/Conflict' 412: + $ref: '#/components/responses/PreconditionFailed' + security: + - OAuth2Security: + - apim:api_delete + - apim:api_import_export + x-code-samples: + - lang: Curl + source: 'curl -k -X DELETE -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" + "https://127.0.0.1:9443/api/am/publisher/v2/apis/7a2298c4-c905-403f-8fac-38c73301631f"' + operationId: deleteAPI + + /apis/{apiId}/topics: + put: + tags: + - APIs + summary: Update Topics + description: This operation can be used to update topics of an existing API. + operationId: updateTopics + parameters: + - $ref: '#/components/parameters/apiId' + - $ref: '#/components/parameters/If-Match' + requestBody: + description: API object that needs to be added + content: + application/json: + schema: + $ref: '#/components/schemas/TopicList' + required: true + responses: + 200: description: | - Precondition Failed. - The request has not been performed because one of the preconditions is not met. - schema: - $ref: '#/definitions/Error' + OK. + Successful response with updated API object + headers: + ETag: + description: | + Entity Tag of the response resource. Used by caches, or in conditional requests (Will be supported in future). + schema: + type: string + Last-Modified: + description: | + Date and time the resource has been modifed the last time. + Used by caches, or in conditional requests (Will be supported in future). + schema: + type: string + Location: + description: | + The URL of the newly created resource. + schema: + type: string + Content-Type: + description: | + The content type of the body. + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/API' -################################################################ -# The swagger resource of "Individual API" resource APIs -################################################################ + /apis/{apiId}/reimport-service: + put: + tags: + - APIs + summary: Update the Service that is used to create the API + description: This operation can be used to re-import the Service used to create the API + operationId: reimportServiceFromCatalog + parameters: + - $ref: '#/components/parameters/apiId' + responses: + 200: + description: | + OK. + Successful response with updated API object + headers: + Location: + description: | + The URL of the newly created resource. + schema: + type: string + Content-Type: + description: | + The content type of the body. + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/API' + 404: + $ref: '#/components/responses/NotFound' + 500: + $ref: '#/components/responses/InternalServerError' /apis/{apiId}/swagger: -#----------------------------------------------------- -# Retrieve the API swagger definition -#----------------------------------------------------- - get: - x-scope: apim:api_view - x-wso2-curl: "curl -k -H \"Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8\" https://localhost:9443/api/am/publisher/v0.12/apis/890a4f4d-09eb-4877-a323-57f6ce2ed79b/swagger" - x-wso2-request: | - GET https://localhost:9443/api/am/publisher/v0.12/apis/890a4f4d-09eb-4877-a323-57f6ce2ed79b/swagger - Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8 - x-wso2-response: "HTTP/1.1 200 OK\nContent-Type: application/json\nContent-Length: 329\n\n{\n \"paths\": {\"/*\": {\"get\": {\n \"x-auth-type\": \"Application\",\n \"x-throttling-tier\": \"Unlimited\",\n \"responses\": {\"200\": {\"description\": \"OK\"}}\n }}},\n \"x-wso2-security\": {\"apim\": {\"x-wso2-scopes\": []}},\n \"swagger\": \"2.0\",\n \"info\": {\n \"title\": \"PhoneVerification\",\n \"description\": \"Verify a phone number\",\n \"contact\": {\n \"email\": \"xx@ee.com\",\n \"name\": \"xx\"\n },\n \"version\": \"1.0.0\"\n }\n}" - summary: Get swagger definition + get: + tags: + - APIs + summary: Get Swagger Definition description: | This operation can be used to retrieve the swagger definition of an API. parameters: - - $ref: '#/parameters/apiId' - - $ref: '#/parameters/Accept' - - $ref: '#/parameters/If-None-Match' - - $ref: '#/parameters/If-Modified-Since' - tags: - - API (Individual) + - $ref: '#/components/parameters/apiId' + - $ref: '#/components/parameters/If-None-Match' responses: 200: description: | OK. Requested swagger document of the API is returned headers: - Content-Type: - description: | - The content type of the body. - type: string ETag: description: | Entity Tag of the response resource. Used by caches, or in conditional requests (Will be supported in future). - type: string + schema: + type: string Last-Modified: description: | Date and time the resource has been modifed the last time. Used by caches, or in conditional requests (Will be supported in future). - type: string + schema: + type: string + Content-Type: + description: | + The content type of the body. + schema: + type: string + content: + application/json: + schema: + type: string + example: "" 304: description: | Not Modified. Empty body because the client has already the latest version of the requested resource (Will be supported in future). + content: {} 404: - description: | - Not Found. - Requested API does not exist. - schema: - $ref: '#/definitions/Error' + $ref: '#/components/responses/NotFound' 406: - description: | - Not Acceptable. - The requested media type is not supported - schema: - $ref: '#/definitions/Error' + $ref: '#/components/responses/NotAcceptable' + security: + - OAuth2Security: + - apim:api_view + x-code-samples: + - lang: Curl + source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" + "https://127.0.0.1:9443/api/am/publisher/v2/apis/7a2298c4-c905-403f-8fac-38c73301631f/swagger"' + operationId: getAPISwagger -#----------------------------------------------------- -# Update the API swagger definition -#----------------------------------------------------- put: - consumes: - - multipart/form-data - x-scope: apim:api_create - x-wso2-curl: "curl -k -H \"Authorization:Bearer 5311eca3-8ac8-354e-ab36-7e2fdd6a4013\" -F apiDefinition=\"{\\\"paths\\\":{\\\"\\/*\\\":{\\\"get\\\":{\\\"x-auth-type\\\":\\\"Application\\\",\\\"x-throttling-tier\\\":\\\"Unlimited\\\",\\\"responses\\\":{\\\"200\\\":{\\\"description\\\":\\\"OK\\\"}}}}},\\\"x-wso2-security\\\":{\\\"apim\\\":{\\\"x-wso2-scopes\\\":[]}},\\\"swagger\\\":\\\"2.0\\\",\\\"info\\\":{\\\"title\\\":\\\"PhoneVerification\\\",\\\"description\\\":\\\"Verify a phone number\\\",\\\"contact\\\":{\\\"email\\\":\\\"xx@ee.com\\\",\\\"name\\\":\\\"xx\\\"},\\\"version\\\":\\\"1.0.0\\\"}}\" -X PUT \"https://localhost:9443/api/am/publisher/v0.12/apis/8848faaa-7fd1-478a-baa2-48a4ebb92c98/swagger\"" - x-wso2-request: | - PUT https://localhost:9443/api/am/publisher/v0.12/apis/8848faaa-7fd1-478a-baa2-48a4ebb92c98/swagger - Authorization:Bearer 5311eca3-8ac8-354e-ab36-7e2fdd6a4013 - Content-Length: 477 - Content-Type: multipart/form-data; boundary=------------------------4f51e636c0003d99 - - --------------------------4f51e636c0003d99 - Content-Disposition: form-data; name="apiDefinition" - - {"paths":{"\/*":{"get":{"x-auth-type":"Application","x-throttling-tier":"Unlimited","responses":{"200":{"description":"OK"}}}}},"x-wso2-security":{"apim":{"x-wso2-scopes":[]}},"swagger":"2.0","info":{"title":"PhoneVerification","description":"Verify a phone number","contact":{"email":"xx@ee.com","name":"xx"},"version":"1.0.0"}} - --------------------------4f51e636c0003d99-- - x-wso2-response: "HTTP/1.1 200 OK\nContent-Type: application/json\n\n{\n \"paths\": {\"/*\": {\"get\": {\n \"x-auth-type\": \"Application\",\n \"x-throttling-tier\": \"Unlimited\",\n \"responses\": {\"200\": {\"description\": \"OK\"}}\n }}},\n \"x-wso2-security\": {\"apim\": {\"x-wso2-scopes\": []}},\n \"swagger\": \"2.0\",\n \"info\": {\n \"title\": \"PhoneVerification\",\n \"description\": \"Verify a phone number\",\n \"contact\": {\n \"email\": \"xx@ee.com\",\n \"name\": \"xx\"\n },\n \"version\": \"1.0.0\"\n }\n}" - summary: Update swagger definition + tags: + - APIs + summary: Update Swagger Definition description: | This operation can be used to update the swagger definition of an existing API. Swagger definition to be updated is passed as a form data parameter `apiDefinition`. parameters: - - $ref: '#/parameters/apiId' - - in: formData - name: apiDefinition - description: Swagger definition of the API - type: string - required: true - - $ref: '#/parameters/Content-Type' - - $ref: '#/parameters/If-Match' - - $ref: '#/parameters/If-Unmodified-Since' - tags: - - API (Individual) + - $ref: '#/components/parameters/apiId' + - $ref: '#/components/parameters/If-Match' + requestBody: + content: + multipart/form-data: + schema: + properties: + apiDefinition: + type: string + description: Swagger definition of the API + url: + type: string + description: Swagger definition URL of the API + file: + type: string + description: Swagger definitio as a file + format: binary responses: 200: description: | OK. Successful response with updated Swagger definition headers: - Location: - description: | - The URL of the newly created resource. - type: string - Content-Type: - description: | - The content type of the body. - type: string ETag: description: | Entity Tag of the response resource. Used by caches, or in conditional requests (Will be supported in future). - type: string + schema: + type: string Last-Modified: description: | Date and time the resource has been modifed the last time. Used by caches, or in conditional requests (Will be supported in future). - type: string + schema: + type: string + Location: + description: | + The URL of the newly created resource. + schema: + type: string + Content-Type: + description: | + The content type of the body. + schema: + type: string + content: + application/json: + schema: + type: string + example: "" 400: - description: | - Bad Request. - Invalid request or validation error - schema: - $ref: '#/definitions/Error' + $ref: '#/components/responses/BadRequest' 403: - description: | - Forbidden. - The request must be conditional but no condition has been specified. - schema: - $ref: '#/definitions/Error' + $ref: '#/components/responses/Forbidden' 404: - description: | - Not Found. - The resource to be updated does not exist. - schema: - $ref: '#/definitions/Error' + $ref: '#/components/responses/NotFound' 412: - description: | - Precondition Failed. - The request has not been performed because one of the preconditions is not met. - schema: - $ref: '#/definitions/Error' - -################################################################ -# The thumbnail resource of "Individual API" resource APIs -################################################################ - - /apis/{apiId}/thumbnail: -#------------------------------------------------------------------------------------------------- -# Downloads a thumbnail image of an API -#------------------------------------------------------------------------------------------------- - get: - x-scope: apim:api_view - x-wso2-curl: "curl -k -H \"Authorization: Bearer d34baf74-3f02-3929-814e-88b27f750ba9\" https://localhost:9443/api/am/publisher/v0.12/apis/29c9ec3d-f590-467e-83e6-96d43517080f/thumbnail > image.jpg" - x-wso2-request: | - GET https://localhost:9443/api/am/publisher/v0.12/apis/29c9ec3d-f590-467e-83e6-96d43517080f/thumbnail - Authorization: Bearer d34baf74-3f02-3929-814e-88b27f750ba9 - x-wso2-response: "HTTP/1.1 200 OK\r\nContent-Type: image/jpeg\r\n\r\n[image content]" - summary: Get thumbnail image + $ref: '#/components/responses/PreconditionFailed' + security: + - OAuth2Security: + - apim:api_create + x-code-samples: + - lang: Curl + source: 'curl -k -X PUT -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" + -F apiDefinition=@swagger.json "https://127.0.0.1:9443/api/am/publisher/v2/apis/96077508-fd01-4fae-bc64-5de0e2baf43c/swagger"' + operationId: updateAPISwagger + + /apis/{apiId}/generate-mock-scripts: + post: + tags: + - APIs + summary: Generate Mock Response Payloads description: | - This operation can be used to download a thumbnail image of an API. + This operation can be used to generate mock responses from examples of swagger definition of an API. + operationId: generateMockScripts parameters: - - $ref: '#/parameters/apiId' - - $ref: '#/parameters/Accept' - - $ref: '#/parameters/If-None-Match' - - $ref: '#/parameters/If-Modified-Since' - tags: - - API (Individual) + - $ref: '#/components/parameters/apiId' + - $ref: '#/components/parameters/If-None-Match' responses: 200: description: | OK. - Thumbnail image returned + Requested swagger document of the API is returned with example responses headers: - Content-Type: - description: | - The content type of the body. - type: string ETag: description: | - Entity Tag of the response resource. - Used by caches, or in conditional requests (Will be supported in future). - type: string + Entity Tag of the response resource. Used by caches, or in conditional requests (Will be supported in future). + schema: + type: string Last-Modified: description: | Date and time the resource has been modifed the last time. Used by caches, or in conditional requests (Will be supported in future). - type: string + schema: + type: string + Content-Type: + description: | + The content type of the body. + schema: + type: string + content: + application/json: + schema: + type: string + example: "" 304: description: | Not Modified. Empty body because the client has already the latest version of the requested resource (Will be supported in future). + content: {} 404: - description: | - Not Found. - Requested Document does not exist. - schema: - $ref: '#/definitions/Error' + $ref: '#/components/responses/NotFound' 406: - description: | - Not Acceptable. - The requested media type is not supported - schema: - $ref: '#/definitions/Error' - -#---------------------------------------------------------------------------- -# Upload a thumbnail image to a certain API -#---------------------------------------------------------------------------- - post: - consumes: - - multipart/form-data - x-scope: apim:api_create - x-wso2-curl: "curl -X POST -H \"Authorization: Bearer d34baf74-3f02-3929-814e-88b27f750ba9\" https://localhost:9443/api/am/publisher/v0.12/apis/29c9ec3d-f590-467e-83e6-96d43517080f/thumbnail -F file=@image.jpg" - x-wso2-request: | - POST https://localhost:9443/api/am/publisher/v0.12/apis/8848faaa-7fd1-478a-baa2-48a4ebb92c98/thumbnail - Authorization: Bearer d34baf74-3f02-3929-814e-88b27f750ba9 - Content-Type: multipart/form-data; boundary=------------------------5e542e0e5b50e1e4 - Content-Length: 18333 - - --------------------------5e542e0e5b50e1e4 - Content-Disposition: form-data; name="file"; filename="image.jpg" - Content-Type: image/jpeg - - [image content] - - --------------------------5e542e0e5b50e1e4-- - x-wso2-response: "HTTP/1.1 201 Created\r\nLocation: https://localhost:9443/api/am/publisher/v0.12/apis/8848faaa-7fd1-478a-baa2-48a4ebb92c98/thumbnail\r\nContent-Type: application/json\r\n\r\n{\r\n \"relativePath\": \"/apis/8848faaa-7fd1-478a-baa2-48a4ebb92c98/thumbnail\",\r\n \"mediaType\": \"image/jpeg\"\r\n}" - summary: Upload a thumbnail image + $ref: '#/components/responses/NotAcceptable' + security: + - OAuth2Security: + - apim:api_create + x-code-samples: + - lang: Curl + source: 'curl -k -X POST -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" + "https://127.0.0.1:9443/api/am/publisher/v2/apis/7a2298c4-c905-403f-8fac-38c73301631f/generate-mock-scripts"' + + /apis/{apiId}/generated-mock-scripts: + get: + tags: + - APIs + summary: Get Generated Mock Response Payloads description: | - This operation can be used to upload a thumbnail image of an API. The thumbnail to be uploaded should be given as a form data parameter `file`. + This operation can be used to get generated mock responses from examples of swagger definition of an API. + operationId: getGeneratedMockScriptsOfAPI parameters: - - $ref: '#/parameters/apiId' - - in: formData - name: file - description: Image to upload - type: file - required: true - - $ref: '#/parameters/Content-Type' - - $ref: '#/parameters/If-Match' - - $ref: '#/parameters/If-Unmodified-Since' - tags: - - API (Individual) + - $ref: '#/components/parameters/apiId' + - $ref: '#/components/parameters/If-None-Match' responses: 200: description: | OK. - Image updated - schema: - $ref : '#/definitions/FileInfo' + Requested swagger document of the API is returned with example responses headers: - Location: + ETag: description: | - The URL of the uploaded thumbnail image of the API. - type: string - Content-Type: - description: | - The content type of the body. - type: string - ETag: - description: | - Entity Tag of the response resource. - Used by caches, or in conditional requests (Will be supported in future). - type: string + Entity Tag of the response resource. Used by caches, or in conditional requests (Will be supported in future). + schema: + type: string Last-Modified: description: | Date and time the resource has been modifed the last time. Used by caches, or in conditional requests (Will be supported in future). - type: string - 400: + schema: + type: string + Content-Type: + description: | + The content type of the body. + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/MockResponsePayloadList' + 304: description: | - Bad Request. - Invalid request or validation error. - schema: - $ref: '#/definitions/Error' + Not Modified. + Empty body because the client has already the latest version of the requested resource (Will be supported in future). + content: {} 404: - description: | - Not Found. - The resource to be updated does not exist. - schema: - $ref: '#/definitions/Error' - 412: - description: | - Precondition Failed. - The request has not been performed because one of the preconditions is not met. - schema: - $ref: '#/definitions/Error' - -###################################################### -# The "Copy API" Processing Function resource API -###################################################### - /apis/copy-api: - -#----------------------------------------------------- -# Create a new API based on an already existing one -#----------------------------------------------------- - post: - x-scope: apim:api_create - x-wso2-curl: "curl -k -H \"Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8\" -X POST \"https://localhost:9443/api/am/publisher/v0.12/apis/copy-api?apiId=890a4f4d-09eb-4877-a323-57f6ce2ed79b&newVersion=2.0.0\"" - x-wso2-request: | - POST https://localhost:9443/api/am/publisher/v0.12/apis/copy-api?apiId=890a4f4d-09eb-4877-a323-57f6ce2ed79b&newVersion=2.0.0 - Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8 - x-wso2-response: "HTTP/1.1 201 Created\nLocation: https://localhost:9443/api/am/publisher/v0.12/apis/25a84fc9-38c0-4578-95e8-29fb6b1c4771\nContent-Type: application/json\n\n{\r\n \"id\": \"25a84fc9-38c0-4578-95e8-29fb6b1c4771\",\r\n \"name\": \"PizzaShackAPI\",\r\n \"description\": \"This document describe a RESTFul API for Pizza Shack online pizza delivery store.\\r\\n\",\r\n \"context\": \"/pizzashack\",\r\n \"version\": \"2.0.0\",\r\n \"provider\": \"admin\",\r\n \"apiDefinition\": \"{\\\"paths\\\":{\\\"\\\\/order\\\":{\\\"post\\\":{\\\"x-auth-type\\\":\\\"Application & Application User\\\",\\\"x-throttling-tier\\\":\\\"Unlimited\\\",\\\"description\\\":\\\"Create a new Order\\\",\\\"parameters\\\":[{\\\"schema\\\":{\\\"$ref\\\":\\\"#\\\\/definitions\\\\/Order\\\"},\\\"description\\\":\\\"Order object that needs to be added\\\",\\\"name\\\":\\\"body\\\",\\\"required\\\":true,\\\"in\\\":\\\"body\\\"}],\\\"responses\\\":{\\\"201\\\":{\\\"schema\\\":{\\\"$ref\\\":\\\"#\\\\/definitions\\\\/Order\\\"},\\\"headers\\\":{\\\"Location\\\":{\\\"description\\\":\\\"The URL of the newly created resource.\\\",\\\"type\\\":\\\"string\\\"}},\\\"description\\\":\\\"Created.\\\"}}}},\\\"\\\\/menu\\\":{\\\"get\\\":{\\\"x-auth-type\\\":\\\"Application & Application User\\\",\\\"x-throttling-tier\\\":\\\"Unlimited\\\",\\\"description\\\":\\\"Return a list of available menu items\\\",\\\"parameters\\\":[],\\\"responses\\\":{\\\"200\\\":{\\\"schema\\\":{\\\"title\\\":\\\"Menu\\\",\\\"properties\\\":{\\\"list\\\":{\\\"items\\\":{\\\"$ref\\\":\\\"#\\\\/definitions\\\\/MenuItem\\\"},\\\"type\\\":\\\"array\\\"}},\\\"type\\\":\\\"object\\\"},\\\"headers\\\":{},\\\"description\\\":\\\"OK.\\\"}}}}},\\\"schemes\\\":[\\\"https\\\"],\\\"produces\\\":[\\\"application\\\\/json\\\"],\\\"swagger\\\":\\\"2.0\\\",\\\"definitions\\\":{\\\"MenuItem\\\":{\\\"title\\\":\\\"Pizza menu Item\\\",\\\"properties\\\":{\\\"price\\\":{\\\"type\\\":\\\"string\\\"},\\\"description\\\":{\\\"type\\\":\\\"string\\\"},\\\"name\\\":{\\\"type\\\":\\\"string\\\"},\\\"image\\\":{\\\"type\\\":\\\"string\\\"}},\\\"required\\\":[\\\"name\\\"]},\\\"Order\\\":{\\\"title\\\":\\\"Pizza Order\\\",\\\"properties\\\":{\\\"customerName\\\":{\\\"type\\\":\\\"string\\\"},\\\"delivered\\\":{\\\"type\\\":\\\"boolean\\\"},\\\"pizzaType\\\":{\\\"type\\\":\\\"string\\\"},\\\"address\\\":{\\\"type\\\":\\\"string\\\"},\\\"creditCardNumber\\\":{\\\"type\\\":\\\"string\\\"},\\\"quantity\\\":{\\\"type\\\":\\\"number\\\"},\\\"orderId\\\":{\\\"type\\\":\\\"string\\\"}},\\\"required\\\":[\\\"orderId\\\"]}},\\\"consumes\\\":[\\\"application\\\\/json\\\"],\\\"info\\\":{\\\"title\\\":\\\"PizzaShackAPI\\\",\\\"description\\\":\\\"This document describe a RESTFul API for Pizza Shack online pizza delivery store.\\\\n\\\",\\\"license\\\":{\\\"name\\\":\\\"Apache 2.0\\\",\\\"url\\\":\\\"http:\\\\/\\\\/www.apache.org\\\\/licenses\\\\/LICENSE-2.0.html\\\"},\\\"contact\\\":{\\\"email\\\":\\\"architecture@pizzashack.com\\\",\\\"name\\\":\\\"John Doe\\\",\\\"url\\\":\\\"http:\\\\/\\\\/www.pizzashack.com\\\"},\\\"version\\\":\\\"2.0.0\\\"}}\",\r\n \"wsdlUri\": null,\r\n \"status\": \"CREATED\",\r\n \"responseCaching\": \"Disabled\",\r\n \"cacheTimeout\": 300,\r\n \"destinationStatsEnabled\": null,\r\n \"isDefaultVersion\": false,\r\n \"type\": \"HTTP\",\r\n \"transport\": [\"https\"],\r\n \"tags\": [\r\n \"chicken\",\r\n \"pizza\"\r\n ],\r\n \"tiers\": [\"Unlimited\"],\r\n \"maxTps\": {\r\n \"sandbox\": 500,\r\n \"production\": 100\r\n },\r\n \"thumbnailUri\": null,\r\n \"visibility\": \"PUBLIC\",\r\n \"visibleRoles\": [],\\r\n \"endpointConfig\": \"{\\\"production_endpoints\\\":{\\\"url\\\":\\\"https://localhost:9443/am/sample/pizzashack/v1/api/\\\",\\\"config\\\":null},\\\"sandbox_endpoints\\\":{\\\"url\\\":\\\"https://localhost:9443/am/sample/pizzashack/v1/api/\\\",\\\"config\\\":null},\\\"endpoint_type\\\":\\\"http\\\"}\",\r\n \"endpointSecurity\": {\r\n \"username\": \"user\",\r\n \"type\": \"basic\",\r\n \"password\": \"pass\"\r\n },\r\n \"gatewayEnvironments\": \"Production and Sandbox\",\r\n \"sequences\": [],\r\n \"subscriptionAvailability\": null,\r\n \"subscriptionAvailableTenants\": [],\r\n \"businessInformation\": {\r\n \"businessOwnerEmail\": \"marketing@pizzashack.com\",\r\n \"technicalOwnerEmail\": \"architecture@pizzashack.com\",\r\n \"technicalOwner\": \"John Doe\",\r\n \"businessOwner\": \"Jane Roe\"\r\n },\r\n \"corsConfiguration\": {\r\n \"accessControlAllowOrigins\": [\"*\"],\r\n \"accessControlAllowHeaders\": [\r\n \"authorization\",\r\n \"Access-Control-Allow-Origin\",\r\n \"Content-Type\",\r\n \"SOAPAction\"\r\n ],\r\n \"accessControlAllowMethods\": [\r\n \"GET\",\r\n \"PUT\",\r\n \"POST\",\r\n \"DELETE\",\r\n \"PATCH\",\r\n \"OPTIONS\"\r\n ],\r\n \"accessControlAllowCredentials\": false,\r\n \"corsConfigurationEnabled\": false\r\n }\r\n}" - summary: Create a new API version + $ref: '#/components/responses/NotFound' + 406: + $ref: '#/components/responses/NotAcceptable' + security: + - OAuth2Security: + - apim:api_create + x-code-samples: + - lang: Curl + source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" + "https://127.0.0.1:9443/api/am/publisher/v2/apis/7a2298c4-c905-403f-8fac-38c73301631f/generated-mock-scripts"' + + /apis/{apiId}/resource-policies: + get: + tags: + - API Resource Policies + summary: Get the Resource Policy(inflow/outflow) Definitions description: | - This operation can be used to create a new version of an existing API. The new version is specified as `newVersion` query parameter. New API will be in `CREATED` state. + This operation can be used to retrieve conversion policy resource definitions of an API. parameters: - - name: newVersion - description: Version of the new API. - type: string + - $ref: '#/components/parameters/apiId' + - name: resourcePath in: query - required: true - - $ref: '#/parameters/apiId-Q' - tags: - - API (Individual) - responses: - 201: - description: | - Created. - Successful response with the newly created API as entity in the body. Location header contains URL of newly created API. - headers: - Location: - description: | - The URL of the newly created API. - type: string - 400: - description: | - Bad Request. - Invalid request or validation error + description: Resource path of the resource policy definition schema: - $ref: '#/definitions/Error' - 404: - description: | - Not Found. - API to copy does not exist. - 401: - description: | - Unauthenticated request. + type: string + - name: verb + in: query + description: HTTP verb of the resource path of the resource policy definition schema: - $ref: '#/definitions/Error' - -###################################################### -# The "Change Lifecycle" Processing Function resource API -###################################################### - /apis/change-lifecycle: - -#----------------------------------------------------- -# Change the lifecycle of an API -#----------------------------------------------------- - post: - x-scope: apim:api_publish - x-wso2-curl: "curl -k -H \"Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8\" -X POST \"https://localhost:9443/api/am/publisher/v0.12/apis/change-lifecycle?apiId=890a4f4d-09eb-4877-a323-57f6ce2ed79b&action=Publish\"" - x-wso2-request: | - POST https://localhost:9443/api/am/publisher/v0.12/apis/change-lifecycle?apiId=890a4f4d-09eb-4877-a323-57f6ce2ed79b&action=Publish - Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8 - x-wso2-response: "HTTP/1.1 200 OK" - summary: Change API Status - description: | - This operation is used to change the lifecycle of an API. Eg: Publish an API which is in `CREATED` state. In order to change the lifecycle, we need to provide the lifecycle `action` as a query parameter. - - For example, to Publish an API, `action` should be `Publish`. Note that the `Re-publish` action is available only after calling `Block`. - - Some actions supports providing additional paramters which should be provided as `lifecycleChecklist` parameter. Please see parameters table for more information. - parameters: - - name: action - description: | - The action to demote or promote the state of the API. - - Supported actions are [ **Publish, Deploy as a Prototype, Demote to Created, Demote to Prototyped, Block, Deprecate, Re-Publish, Retire **] - + type: string + - name: sequenceType in: query - type: string + description: sequence type of the resource policy resource definition required: true - enum: - - Publish - - Deploy as a Prototype - - Demote to Created - - Demote to Prototyped - - Block - - Deprecate - - Re-Publish - - Retire - - name: lifecycleChecklist - description: | - - Supported checklist items are as follows. - 1. **Deprecate Old Versions**: Setting this to true will deprecate older versions of a particular API when it is promoted to Published state from Created state. - 2. **Require Re-Subscription**: If you set this to true, users need to re subscribe to the API although they may have subscribed to an older version. - - You can specify additional checklist items by using an **"attribute:"** modifier. - - Eg: "Deprecate Old Versions:true" will deprecate older versions of a particular API when it is promoted to Published state from Created state. Multiple checklist items can be given in "attribute1:true, attribute2:false" format. - - **Sample CURL :** curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" -X POST "https://localhost:9443/api/am/publisher/v0.12/apis/change-lifecycle?apiId=890a4f4d-09eb-4877-a323-57f6ce2ed79b&action=Publish&lifecycleChecklist=Deprecate Old Versions:true,Require Re-Subscription:true" - - type: string - in: query - - $ref: '#/parameters/apiId-Q' - - $ref: '#/parameters/If-Match' - - $ref: '#/parameters/If-Unmodified-Since' - tags: - - API (Individual) + schema: + type: string + - $ref: '#/components/parameters/If-None-Match' responses: 200: description: | OK. - Lifecycle changed successfully. + List of resource policy definitions of the API is returned headers: ETag: description: | - Entity Tag of the changed API. Used by caches, or in conditional requests (Will be supported in future). - type: string + Entity Tag of the response resource. Used by caches, or in conditional requests (Will be supported in future). + schema: + type: string Last-Modified: description: | - Date and time the API lifecycle has been modified the last time. + Date and time the resource has been modifed the last time. Used by caches, or in conditional requests (Will be supported in future). - type: string - 400: + schema: + type: string + Content-Type: + description: | + The content type of the body. + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/ResourcePolicyList' + 304: description: | - Bad Request. - Invalid request or validation error - schema: - $ref: '#/definitions/Error' + Not Modified. + Empty body because the client has already the latest version of the requested resource (Will be supported in future). + content: {} 404: - description: | - Not Found. - Requested API does not exist. - schema: - $ref: '#/definitions/Error' - 412: - description: | - Precondition Failed. - The request has not been performed because one of the preconditions is not met. - schema: - $ref: '#/definitions/Error' - -###################################################### -# The "Document Collection" resource APIs -###################################################### - /apis/{apiId}/documents: - -#----------------------------------------------------- -# Retrieve the documents associated with an API that qualify under a search condition -#----------------------------------------------------- + $ref: '#/components/responses/NotFound' + 406: + $ref: '#/components/responses/NotAcceptable' + security: + - OAuth2Security: + - apim:api_view + x-code-samples: + - lang: Curl + source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" + "https://127.0.0.1:9443/api/am/publisher/v2/apis/2fd14eb8-b828-4013-b448-0739d2e76bf7/resource-policies?resourcePath=checkPhoneNumber&verb=post&sequenceType=in"' + operationId: getAPIResourcePolicies + + /apis/{apiId}/resource-policies/{resourcePolicyId}: get: - x-scope: apim:api_view - x-wso2-curl: "curl -k -H \"Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8\" \"https://localhost:9443/api/am/publisher/v0.12/apis/890a4f4d-09eb-4877-a323-57f6ce2ed79b/documents\"" - x-wso2-request: | - GET https://localhost:9443/api/am/publisher/v0.12/apis/890a4f4d-09eb-4877-a323-57f6ce2ed79b/documents - Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8 - x-wso2-response: "HTTP/1.1 200 OK\nContent-Type: application/json\n\n{\n \"previous\": \"\",\n \"list\": [\n {\n \"visibility\": \"API_LEVEL\",\n \"sourceType\": \"INLINE\",\n \"sourceUrl\": null,\n \"otherTypeName\": null,\n \"documentId\": \"0bcb7f05-599d-4e1a-adce-5cb89bfe58d5\",\n \"summary\": \"This is a sample documentation for v1.0.0\",\n \"name\": \"PhoneVerification API Documentation\",\n \"type\": \"HOWTO\"\n },\n {\n \"visibility\": \"API_LEVEL\",\n \"sourceType\": \"URL\",\n \"sourceUrl\": \"http://wiki.cdyne.com/index.php/Phone_Verification\",\n \"otherTypeName\": null,\n \"documentId\": \"4145df31-04f1-440c-8d08-68952874622c\",\n \"summary\": \"This is the URL for online documentation\",\n \"name\": \"Online Documentation\",\n \"type\": \"SAMPLES\"\n }\n ],\n \"next\": \"\",\n \"count\": 2\n}" - summary: Get a list of documents of an API + tags: + - API Resource Policies + summary: Get the Resource Policy(inflow/outflow) Definition for a Given Resource + Identifier. description: | - This operation can be used to retrive a list of documents belonging to an API by providing the id of the API. + This operation can be used to retrieve conversion policy resource definitions of an API given the resource identifier. parameters: - - $ref: '#/parameters/apiId' - - $ref: '#/parameters/limit' - - $ref: '#/parameters/offset' - - $ref: '#/parameters/Accept' - - $ref: '#/parameters/If-None-Match' - tags: - - Document (Collection) + - $ref: '#/components/parameters/apiId' + - $ref: '#/components/parameters/resourcePolicyId' + - $ref: '#/components/parameters/If-None-Match' responses: 200: description: | OK. - Document list is returned. - schema: - $ref: '#/definitions/DocumentList' + Requested resource policy definition of the API is returned for the given resource identifier. headers: - Content-Type: - description: | - The content type of the body. - type: string ETag: description: | Entity Tag of the response resource. Used by caches, or in conditional requests (Will be supported in future). - type: string + schema: + type: string + Last-Modified: + description: | + Date and time the resource has been modifed the last time. + Used by caches, or in conditional requests (Will be supported in future). + schema: + type: string + Content-Type: + description: | + The content type of the body. + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/ResourcePolicyInfo' 304: description: | Not Modified. Empty body because the client has already the latest version of the requested resource (Will be supported in future). + content: {} + 400: + $ref: '#/components/responses/BadRequest' 404: - description: | - Not Found. - Requested API does not exist. - schema: - $ref: '#/definitions/Error' + $ref: '#/components/responses/NotFound' 406: - description: | - Not Acceptable. - The requested media type is not supported - schema: - $ref: '#/definitions/Error' + $ref: '#/components/responses/NotAcceptable' + security: + - OAuth2Security: + - apim:api_view + x-code-samples: + - lang: Curl + source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" + "https://127.0.0.1:9443/api/am/publisher/v2/apis/2fd14eb8-b828-4013-b448-0739d2e76bf7/resource-policies/8efc32a4-c7f1-4bee-b860-b7566e2bc0d5"' + operationId: getAPIResourcePoliciesByPolicyId -#----------------------------------------------------- -# Add a document to a certain API -#----------------------------------------------------- - post: - x-scope: apim:api_create - x-wso2-curl: "curl -k -H \"Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8\" -H \"Content-Type: application/json\" -X POST -d @data.json \"https://localhost:9443/api/am/publisher/v0.12/apis/96077508-fd01-4fae-bc64-5de0e2baf43c/documents\"" - x-wso2-request: "POST https://localhost:9443/api/am/publisher/v0.12/apis/96077508-fd01-4fae-bc64-5de0e2baf43c/documents\nAuthorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8\nContent-Type: application/json\n\n{\n \"visibility\": \"API_LEVEL\",\n \"sourceType\": \"INLINE\",\n \"sourceUrl\": null,\n \"otherTypeName\": null,\n \"summary\": \"This is a sample documentation\",\n \"name\": \"Introduction to PhoneVerification API\",\n \"type\": \"HOWTO\"\n}" - x-wso2-response: "HTTP/1.1 201 Created\nLocation: https://localhost:9443/api/am/publisher/v0.12/apis/890a4f4d-09eb-4877-a323-57f6ce2ed79b/documents/ffd5790d-b7a9-4cb6-b76a-f8b83ecdd058\nContent-Type: application/json\n\n{\n \"visibility\": \"API_LEVEL\",\n \"sourceType\": \"INLINE\",\n \"sourceUrl\": null,\n \"otherTypeName\": null,\n \"documentId\": \"ffd5790d-b7a9-4cb6-b76a-f8b83ecdd058\",\n \"summary\": \"This is a sample documentation\",\n \"name\": \"Introduction to PhoneVerification API\",\n \"type\": \"HOWTO\"\n}" - summary: Add a new document to an API + put: + tags: + - API Resource Policies + summary: Update the Resource Policy(inflow/outflow) Definition for the Given + Resource Identifier description: | - This operation can be used to add a new documentation to an API. This operation only adds the metadata of a document. To add the actual content we need to use **Upload the content of an API document ** API once we obtain a document Id by this operation. + This operation can be used to update the resource policy(inflow/outflow) definition for the given resource identifier of an existing API. resource policy definition to be updated is passed as a body parameter `content`. parameters: - - $ref: '#/parameters/apiId' - - in: body - name: body - description: | - Document object that needs to be added - required: true - schema: - $ref: '#/definitions/Document' - - $ref: '#/parameters/Content-Type' - tags: - - Document (Collection) + - $ref: '#/components/parameters/apiId' + - $ref: '#/components/parameters/resourcePolicyId' + - $ref: '#/components/parameters/If-Match' + requestBody: + description: Content of the resource policy definition that needs to be updated + content: + application/json: + schema: + $ref: '#/components/schemas/ResourcePolicyInfo' + required: true responses: - 201: + 200: description: | - Created. - Successful response with the newly created Document object as entity in the body. - Location header contains URL of newly added document. - schema: - $ref: '#/definitions/Document' + OK. + Successful response with updated the resource policy definition headers: + ETag: + description: | + Entity Tag of the response resource. Used by caches, or in conditional requests (Will be supported in future). + schema: + type: string + Last-Modified: + description: | + Date and time the resource has been modifed the last time. + Used by caches, or in conditional requests (Will be supported in future). + schema: + type: string Location: description: | - Location to the newly created Document. - type: string + The URL of the newly created resource. + schema: + type: string Content-Type: description: | The content type of the body. - type: string - ETag: - description: | - Entity Tag of the response resource. - Used by caches, or in conditional requests (Will be supported in future). - type: string + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/ResourcePolicyInfo' 400: - description: | - Bad Request. - Invalid request or validation error - schema: - $ref: '#/definitions/Error' - 415: - description: | - Unsupported media type. - The entity of the request was in a not supported format. - -###################################################### -# The "Individual Document" resource APIs -###################################################### - '/apis/{apiId}/documents/{documentId}': + $ref: '#/components/responses/BadRequest' + 403: + $ref: '#/components/responses/Forbidden' + 404: + $ref: '#/components/responses/NotFound' + 412: + $ref: '#/components/responses/PreconditionFailed' + security: + - OAuth2Security: + - apim:api_create + x-code-samples: + - lang: Curl + source: 'curl -k -X PUT -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" + -H "Content-Type: application/json" -d @data.json "https://127.0.0.1:9443/api/am/publisher/v2/apis/2fd14eb8-b828-4013-b448-0739d2e76bf7/resource-policies/8efc32a4-c7f1-4bee-b860-b7566e2bc0d5"' + operationId: updateAPIResourcePoliciesByPolicyId -#----------------------------------------------------- -# Retrieve a particular document of a certain API -#----------------------------------------------------- + /apis/{apiId}/thumbnail: get: - x-scope: apim:api_view - x-wso2-curl: "curl -k -H \"Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8\" \"https://localhost:9443/api/am/publisher/v0.12/apis/890a4f4d-09eb-4877-a323-57f6ce2ed79b/documents/0bcb7f05-599d-4e1a-adce-5cb89bfe58d5\"" - x-wso2-request: | - GET https://localhost:9443/api/am/publisher/v0.12/apis/890a4f4d-09eb-4877-a323-57f6ce2ed79b/documents/0bcb7f05-599d-4e1a-adce-5cb89bfe58d5 - Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8 - x-wso2-response: "HTTP/1.1 200 OK\nContent-Type: application/json\n\n{\n \"visibility\": \"API_LEVEL\",\n \"sourceType\": \"INLINE\",\n \"sourceUrl\": null,\n \"otherTypeName\": null,\n \"documentId\": \"0bcb7f05-599d-4e1a-adce-5cb89bfe58d5\",\n \"summary\": \"This is a sample documentation\",\n \"name\": \"PhoneVerification API Documentation\",\n \"type\": \"HOWTO\"\n}" - summary: Get a document of an API + tags: + - APIs + summary: Get Thumbnail Image description: | - This operation can be used to retrieve a particular document's metadata associated with an API. + This operation can be used to download a thumbnail image of an API. parameters: - - $ref: '#/parameters/apiId' - - $ref: '#/parameters/documentId' - - $ref: '#/parameters/Accept' - - $ref: '#/parameters/If-None-Match' - - $ref: '#/parameters/If-Modified-Since' - tags: - - Document (Individual) + - $ref: '#/components/parameters/apiId' + - $ref: '#/components/parameters/If-None-Match' responses: 200: description: | OK. - Document returned. - schema: - $ref: '#/definitions/Document' + Thumbnail image returned headers: - Content-Type: - description: | - The content type of the body. - type: string ETag: description: | Entity Tag of the response resource. Used by caches, or in conditional requests (Will be supported in future). - type: string + schema: + type: string Last-Modified: description: | Date and time the resource has been modifed the last time. Used by caches, or in conditional requests (Will be supported in future). - type: string + schema: + type: string + Content-Type: + description: | + The content type of the body. + schema: + type: string + content: {} 304: description: | Not Modified. Empty body because the client has already the latest version of the requested resource (Will be supported in future). + content: {} 404: - description: | - Not Found. - Requested Document does not exist. - schema: - $ref: '#/definitions/Error' + $ref: '#/components/responses/NotFound' 406: - description: | - Not Acceptable. - The requested media type is not supported - schema: - $ref: '#/definitions/Error' + $ref: '#/components/responses/NotAcceptable' + security: + - OAuth2Security: + - apim:api_view + x-code-samples: + - lang: Curl + source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" + "https://127.0.0.1:9443/api/am/publisher/v2/apis/2fd14eb8-b828-4013-b448-0739d2e76bf7/thumbnail"' + operationId: getAPIThumbnail -#----------------------------------------------------- -# Update a particular document of a certain API -#----------------------------------------------------- put: - x-scope: apim:api_create - x-wso2-curl: "curl -k -H \"Authorization:Bearer b0982cd2aacd463ff5f63cd5ebe58f4a\" -H \"Content-Type: application/json\" -X PUT -d data.json \"https://localhost:9443/api/am/publisher/v0.12/apis/96077508-fd01-4fae-bc64-5de0e2baf43c/documents/0bcb7f05-599d-4e1a-adce-5cb89bfe58d5\"" - x-wso2-request: "PUT https://localhost:9443/api/am/publisher/v0.12/apis/96077508-fd01-4fae-bc64-5de0e2baf43c/documents/0bcb7f05-599d-4e1a-adce-5cb89bfe58d5\nAuthorization:Bearer b0982cd2aacd463ff5f63cd5ebe58f4a\nContent-Type: application/json\n\n{\n \"visibility\": \"API_LEVEL\",\n \"sourceType\": \"INLINE\",\n \"sourceUrl\": null,\n \"otherTypeName\": null,\n \"documentId\": \"0bcb7f05-599d-4e1a-adce-5cb89bfe58d5\",\n \"summary\": \"This is a sample documentation for v1.0.0\",\n \"name\": \"PhoneVerification API Documentation\",\n \"type\": \"HOWTO\"\n}" - x-wso2-response: "HTTP/1.1 200 OK\nContent-Type: application/json\n\n{\n \"visibility\": \"API_LEVEL\",\n \"sourceType\": \"INLINE\",\n \"sourceUrl\": null,\n \"otherTypeName\": null,\n \"documentId\": \"0bcb7f05-599d-4e1a-adce-5cb89bfe58d5\",\n \"summary\": \"This is a sample documentation for v1.0.0\",\n \"name\": \"PhoneVerification API Documentation\",\n \"type\": \"HOWTO\"\n}" - summary: Update a document of an API + tags: + - APIs + summary: Upload a Thumbnail Image description: | - This operation can be used to update metadata of an API's document. + This operation can be used to upload a thumbnail image of an API. The thumbnail to be uploaded should be given as a form data parameter `file`. + operationId: updateAPIThumbnail parameters: - - $ref: '#/parameters/apiId' - - $ref: '#/parameters/documentId' - - in: body - name: body - description: | - Document object that needs to be added - required: true - schema: - $ref: '#/definitions/Document' - - $ref: '#/parameters/Content-Type' - - $ref: '#/parameters/If-Match' - - $ref: '#/parameters/If-Unmodified-Since' - tags: - - Document (Individual) + - $ref: '#/components/parameters/apiId' + - $ref: '#/components/parameters/If-Match' + requestBody: + content: + multipart/form-data: + schema: + required: + - file + properties: + file: + type: string + description: Image to upload + format: binary + required: true responses: 200: description: | OK. - Document updated - schema: - $ref: '#/definitions/Document' + Image updated headers: - Location: - description: | - The URL of the updated document. - type: string - Content-Type: - description: | - The content type of the body. - type: string ETag: description: | Entity Tag of the response resource. Used by caches, or in conditional requests (Will be supported in future). - type: string + schema: + type: string Last-Modified: description: | Date and time the resource has been modifed the last time. Used by caches, or in conditional requests (Will be supported in future). - type: string + schema: + type: string + Location: + description: | + The URL of the uploaded thumbnail image of the API. + schema: + type: string + Content-Type: + description: | + The content type of the body. + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/FileInfo' 400: - description: | - Bad Request. - Invalid request or validation error. - schema: - $ref: '#/definitions/Error' + $ref: '#/components/responses/BadRequest' 404: - description: | - Not Found. - The resource to be updated does not exist. - schema: - $ref: '#/definitions/Error' + $ref: '#/components/responses/NotFound' 412: - description: | - Precondition Failed. - The request has not been performed because one of the preconditions is not met. - schema: - $ref: '#/definitions/Error' - -#----------------------------------------------------- -# Delete a particular document of a certain API -#----------------------------------------------------- - delete: - x-scope: apim:api_create - x-wso2-curl: "curl -k -H \"Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8\" -X DELETE https://localhost:9443/api/am/publisher/v0.12/apis/890a4f4d-09eb-4877-a323-57f6ce2ed79b/documents/ffd5790d-b7a9-4cb6-b76a-f8b83ecdd058" - x-wso2-request: | - DELETE https://localhost:9443/api/am/publisher/v0.12/apis/890a4f4d-09eb-4877-a323-57f6ce2ed79b/documents/ffd5790d-b7a9-4cb6-b76a-f8b83ecdd058 - Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8 - x-wso2-response: "HTTP/1.1 200 OK" - summary: Delete a document of an API + $ref: '#/components/responses/PreconditionFailed' + security: + - OAuth2Security: + - apim:api_create + - apim:api_publish + x-code-samples: + - lang: Curl + source: 'curl -k -X PUT -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" + -F file=image.jpeg "https://127.0.0.1:9443/api/am/publisher/v2/apis/2fd14eb8-b828-4013-b448-0739d2e76bf7/thumbnail"' + + /apis/{apiId}/subscription-policies: + get: + tags: + - APIs + summary: | + Get Details of the Subscription Throttling Policies of an API description: | - This operation can be used to delete a document associated with an API. - parameters: - - $ref: '#/parameters/apiId' - - $ref: '#/parameters/documentId' - - $ref: '#/parameters/If-Match' - - $ref: '#/parameters/If-Unmodified-Since' - tags: - - Document (Individual) - responses: - 200: - description: | - OK. - Resource successfully deleted. - 404: - description: | - Not Found. - Resource to be deleted does not exist. - schema: - $ref: '#/definitions/Error' - 412: - description: | - Precondition Failed. - The request has not been performed because one of the preconditions is not met. - schema: - $ref: '#/definitions/Error' - -################################################################ -# The content resource of "Individual Document" resource APIs -################################################################ - - '/apis/{apiId}/documents/{documentId}/content': - - #------------------------------------------------------------------------------------------------- - # Downloads a FILE type document/get the inline content or source url of a certain document - #------------------------------------------------------------------------------------------------- - get: - x-scope: apim:api_view - x-wso2-curl: "curl -k -H \"Authorization:Bearer b0982cd2aacd463ff5f63cd5ebe58f4a\" \"https://localhost:9443/api/am/publisher/v0.12/apis/890a4f4d-09eb-4877-a323-57f6ce2ed79b/documents/daf732d3-bda2-46da-b381-2c39d901ea61/content\" > sample.pdf" - x-wso2-request: | - GET https://localhost:9443/api/am/publisher/v0.12/apis/890a4f4d-09eb-4877-a323-57f6ce2ed79b/documents/daf732d3-bda2-46da-b381-2c39d901ea61/content - Authorization:Bearer b0982cd2aacd463ff5f63cd5ebe58f4a - x-wso2-response: "HTTP/1.1 200 OK\nContent-Disposition: attachment; filename=\"sample.pdf\"\nContent-Type: application/octet-stream\nContent-Length: 7802\n\n%PDF-1.4\n%äüöß\n2 0 obj\n<>\nstream\n..\n>>\nstartxref\n7279\n%%EOF" - summary: Get the content of an API document - description: | - This operation can be used to retrive the content of an API's document. - - The document can be of 3 types. In each cases responses are different. - - 1. **Inline type**: - The content of the document will be retrieved in `text/plain` content type - - _Sample cURL_ : `curl -k -H "Authorization:Bearer 579f0af4-37be-35c7-81a4-f1f1e9ee7c51" -F inlineContent=@"docs.txt" -X POST "https://localhost:9443/api/am/publisher/v0.12/apis/995a4972-3178-4b17-a374-756e0e19127c/documents/43c2bcce-60e7-405f-bc36-e39c0c5e189e/content` - 2. **FILE type**: - The file will be downloaded with the related content type (eg. `application/pdf`) - 3. **URL type**: - The client will recieve the URL of the document as the Location header with the response with - `303 See Other` - parameters: - - $ref: '#/parameters/apiId' - - $ref: '#/parameters/documentId' - - $ref: '#/parameters/Accept' - - $ref: '#/parameters/If-None-Match' - - $ref: '#/parameters/If-Modified-Since' - tags: - - Document (Individual) - responses: - 200: - description: | - OK. - File or inline content returned. - headers: - Content-Type: - description: | - The content type of the body. - type: string - ETag: - description: | - Entity Tag of the response resource. - Used by caches, or in conditional requests (Will be supported in future). - type: string - Last-Modified: - description: | - Date and time the resource has been modifed the last time. - Used by caches, or in conditional requests (Will be supported in future). - type: string - 303: - description: | - See Other. - Source can be retrived from the URL specified at the Location header. - headers: - Location: - description: | - The Source URL of the document. - type: string - 304: - description: | - Not Modified. - Empty body because the client has already the latest version of the requested resource (Will be supported in future). - 404: - description: | - Not Found. - Requested Document does not exist. - schema: - $ref: '#/definitions/Error' - 406: - description: | - Not Acceptable. - The requested media type is not supported - schema: - $ref: '#/definitions/Error' - - #---------------------------------------------------------------------------- - # Upload a file or add inline content to a document of a certain API - #---------------------------------------------------------------------------- - post: - consumes: - - multipart/form-data - x-scope: apim:api_create - x-wso2-curl: "curl -k -H \"Authorization:Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8\" -F file=@\"sample.pdf\" -X POST \"https://localhost:9443/api/am/publisher/v0.12/apis/890a4f4d-09eb-4877-a323-57f6ce2ed79b/documents/daf732d3-bda2-46da-b381-2c39d901ea61/content\"" - x-wso2-request: | - POST https://localhost:9443/api/am/publisher/v0.12/apis/8848faaa-7fd1-478a-baa2-48a4ebb92c98/documents/b3a79270-02bb-4e39-9ac1-90ce8f6c84af/content - Authorization:Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8 - Content-Length: 8004 - Content-Type: multipart/form-data; boundary=------------------------7b9a53f1ffa452b9 - - --------------------------7b9a53f1ffa452b9 - Content-Disposition: form-data; name="file"; filename="sample.pdf" - Content-Type: application/octet-stream - - [file content] - - --------------------------7b9a53f1ffa452b9-- - x-wso2-response: "HTTP/1.1 201 Created\nLocation: https://localhost:9443/api/am/publisher/v0.12/apis/8848faaa-7fd1-478a-baa2-48a4ebb92c98/documents/b3a79270-02bb-4e39-9ac1-90ce8f6c84af/content\nContent-Type: application/json\n\n{\n \"visibility\":\"API_LEVEL\",\n \"sourceType\":\"FILE\",\n \"sourceUrl\":null,\n \"otherTypeName\":null,\n \"documentId\":\"daf732d3-bda2-46da-b381-2c39d901ea61\",\n \"summary\":\"This is a sample documentation pdf\",\n \"name\":\"Introduction to PhoneVerification API PDF\",\n \"type\":\"HOWTO\"\n}" - summary: Upload the content of an API document - description: | - Thid operation can be used to upload a file or add inline content to an API document. - - **IMPORTANT:** - * Either **file** or **inlineContent** form data parameters should be specified at one time. - * Document's source type should be **FILE** in order to upload a file to the document using **file** parameter. - * Document's source type should be **INLINE** in order to add inline content to the document using **inlineContent** parameter. - parameters: - - $ref: '#/parameters/apiId' - - $ref: '#/parameters/documentId' - - in: formData - name: file - description: Document to upload - type: file - required: false - - in: formData - name: inlineContent - description: Inline content of the document - type: string - required: false - - $ref: '#/parameters/Content-Type' - - $ref: '#/parameters/If-Match' - - $ref: '#/parameters/If-Unmodified-Since' - tags: - - Document (Individual) - responses: - 200: - description: | - OK. - Document updated - schema: - $ref: '#/definitions/Document' - headers: - Location: - description: | - The URL of the updated content of the document. - type: string - Content-Type: - description: | - The content type of the body. - type: string - ETag: - description: | - Entity Tag of the response resource. - Used by caches, or in conditional requests (Will be supported in future). - type: string - Last-Modified: - description: | - Date and time the resource has been modifed the last time. - Used by caches, or in conditional requests (Will be supported in future). - type: string - 400: - description: | - Bad Request. - Invalid request or validation error. - schema: - $ref: '#/definitions/Error' - 404: - description: | - Not Found. - The resource to be updated does not exist. - schema: - $ref: '#/definitions/Error' - 412: - description: | - Precondition Failed. - The request has not been performed because one of the preconditions is not met. - schema: - $ref: '#/definitions/Error' - - ##pp -###################################################### -# The "specific mediation policy" resource APIs -###################################################### - '/apis/{apiId}/policies/mediation': - - #----------------------------------------------------------------------------------------- - # Retrieving the list of all API specific mediation sequences under a given search condition - #----------------------------------------------------------------------------------------- - get: - x-scope: apim:api_view - x-wso2-curl: "curl -k -H \"Authorization: Bearer fb2a0784-f60c-3276-8fde-5b0f70e61ecc\" https://localhost:9443/api/am/publisher/v0.12/apis/40082986-6488-4b86-801a-b0b069d4588c/policies/mediation" - x-wso2-request: "GET https://localhost:9443/api/am/publisher/v0.12/apis/40082986-6488-4b86-801a-b0b069d4588c/policies/mediation\r\nAuthorization: Bearer fb2a0784-f60c-3276-8fde-5b0f70e61ecc" - x-wso2-response: "HTTP/1.1 200 OK\r\nContent-Type: application/json\r\n\r\n{\r\n \"count\": 1,\r\n \"next\": null,\r\n \"previous\": null,\r\n \"list\": [ {\r\n \"name\": \"add_custom_header_fault\",\r\n \"id\": \"6460d7e6-4272-4e3a-9879-437228d83123\",\r\n \"type\": \"fault\"\r\n }]\r\n}" - summary: | - Get all mediation policies of an API - description: | - This operation provides you a list of available mediation policies of an API. - parameters: - - $ref: '#/parameters/apiId' - - $ref : '#/parameters/limit' - - $ref : '#/parameters/offset' - - name : query - in: query - description: "-Not supported yet-" - type: string - - $ref : "#/parameters/Accept" - - $ref : "#/parameters/If-None-Match" - tags: - - Mediation Policy (Collection) - responses: - 200: - description: | - OK. - List of qualifying APIs is returned. - schema: - $ref: '#/definitions/mediationList' - headers: - Content-Type: - description: The content type of the body. - type: string - ETag: - description: | - Entity Tag of the response resource. Used by caches, or in conditional requests (Will be supported in future). - type: string - 304: - description: | - Not Modified. - Empty body because the client has already the latest version of the requested resource (Will be supported in future). - 406: - description: | - Not Acceptable. - The requested media type is not supported - schema: - $ref: '#/definitions/Error' - -#---------------------------------------------------------------------------- -# Upload an API specific mediation policy -#---------------------------------------------------------------------------- - post: - x-scope: apim:api_create - x-wso2-curl: "curl -k -H \"Authorization: Bearer 6cea3696-0151-3282-bf79-a0c4db6f308a\" -H \"Content-Type: application/json\" -X POST -d @data.json \"https://localhost:9443/api/am/publisher/v0.12/apis/40082986-6488-4b86-801a-b0b069d4588c/policies/mediation\"" - x-wso2-request: "POST https://localhost:9443/api/am/publisher/v0.12/apis/40082986-6488-4b86-801a-b0b069d4588c/policies/mediation\r\nContent-Type: application/json\r\nAuthorization: Bearer 6cea3696-0151-3282-bf79-a0c4db6f308a\r\n\r\n{\r\n \"name\": \"add_custom_header_fault\",\r\n \"type\": \"fault\",\r\n \"config\": \"\\n \\n<\\/sequence>\\n\"\r\n}" - x-wso2-response: "HTTP/1.1 201 Created\r\nLocation: https://localhost:9443/api/am/publisher/v0.12/registry/resource/_system/governance/apimgt/applicationdata/provider/admin/hello/1.0.0/fault/add_custom_header_fault.xml\r\nContent-Type: application/json\r\n\r\n{ \r\n \"id\":\"624b9f7d-bfaf-484b-94cc-e84491f5d725\",\r\n \"name\":\"add_custom_header_fault\",\r\n \"type\":\"fault\",\r\n \"config\":\"\\n \\n\\n\"\r\n}" - summary: Add an API specific mediation policy - description: | - This operation can be used to add an API specifc mediation policy. - parameters: - - in: body - name: body - description: mediation policy to upload - required: true - schema: - $ref: '#/definitions/Mediation' - - $ref: '#/parameters/apiId' - - $ref: '#/parameters/Content-Type' - - $ref: '#/parameters/If-Match' - - $ref: '#/parameters/If-Unmodified-Since' - tags: - - Mediation Policy (Collection) - responses: - 200: - description: | - OK. - mediation policy uploaded - schema: - $ref : '#/definitions/Mediation' - headers: - Location: - description: | - The URL of the uploaded thumbnail image of the API. - type: string - Content-Type: - description: | - The content type of the body. - type: string - ETag: - description: | - Entity Tag of the response resource. - Used by caches, or in conditional requests (Will be supported in future). - type: string - Last-Modified: - description: | - Date and time the resource has been modifed the last time. - Used by caches, or in conditional requests (Will be supported in future). - type: string - 400: - description: | - Bad Request. - Invalid request or validation error. - schema: - $ref: '#/definitions/Error' - 404: - description: | - Not Found. - The resource to be updated does not exist. - schema: - $ref: '#/definitions/Error' - 412: - description: | - Precondition Failed. - The request has not been performed because one of the preconditions is not met. - schema: - $ref: '#/definitions/Error' - -###################################################### -# The "Individual API specific mediation sequence" resource -###################################################### - /apis/{apiId}/policies/mediation/{mediationPolicyId}: - -#----------------------------------------------------- -# Retrieve a particular API specific mediation squence -#----------------------------------------------------- - get: - x-scope: apim:api_view - x-wso2-curl: "curl -k -H \"Authorization: Bearer 5aa0acc0-0ce3-3a0b-8cc8-db5ef696ee23\" https://localhost:9443/api/am/publisher/v0.12/apis/40082986-6488-4b86-801a-b0b069d4588c/policies/mediation/624b9f7d-bfaf-484b-94cc-e84491f5d725" - x-wso2-request: "GET https://localhost:9443/api/am/publisher/v0.12/apis/40082986-6488-4b86-801a-b0b069d4588c/policies/mediation/624b9f7d-bfaf-484b-94cc-e84491f5d725\r\nAuthorization: Bearer 5aa0acc0-0ce3-3a0b-8cc8-db5ef696ee23" - x-wso2-response: "HTTP/1.1 200 OK\r\nContent-Type: application/json\r\n\r\n{\r\n \"id\": \"624b9f7d-bfaf-484b-94cc-e84491f5d725\",\r\n \"name\": \"add_custom_header_fault\",\r\n \"type\": \"fault\",\r\n \"config\": \"\\n \\n<\\/sequence>\\n\"\r\n}" - summary: Get an API specific mediation policy - description: | - This operation can be used to retrieve a particular API specific mediation policy. - parameters: - - $ref: '#/parameters/apiId' - - $ref: '#/parameters/mediationPolicyId' - - $ref: '#/parameters/Accept' - - $ref: '#/parameters/If-None-Match' - - $ref: '#/parameters/If-Modified-Since' - tags: - - Mediation Policy (Individual) - responses: - 200: - description: | - OK. - Mediation policy returned. - schema: - $ref: '#/definitions/Mediation' - headers: - Content-Type: - description: | - The content type of the body. - type: string - ETag: - description: | - Entity Tag of the response resource. - Used by caches, or in conditional requests (Will be supported in future). - type: string - Last-Modified: - description: | - Date and time the resource has been modifed the last time. - Used by caches, or in conditional requests (Will be supported in future). - type: string - 304: - description: | - Not Modified. - Empty body because the client has already the latest version of the requested resource (Will be supported in future). - 404: - description: | - Not Found. - Requested Document does not exist. - schema: - $ref: '#/definitions/Error' - 406: - description: | - Not Acceptable. - The requested media type is not supported - schema: - $ref: '#/definitions/Error' - -#----------------------------------------------------- -# Delete the mediation policy -#----------------------------------------------------- - delete: - x-scope: apim:api_create - x-wso2-curl: "curl -k -H \"Authorization: Bearer fb2a0784-f60c-3276-8fde-5b0f70e61ecc\" -X DELETE https://localhost:9443/api/am/publisher/v0.12/apis/40082986-6488-4b86-801a-b0b069d4588c/policies/mediation/60f5146d-1774-405d-86b3-9b040ac266d5" - x-wso2-request: "DELETE https://localhost:9443/api/am/publisher/v0.12/apis/40082986-6488-4b86-801a-b0b069d4588c/policies/mediation/60f5146d-1774-405d-86b3-9b040ac266d5\r\nAuthorization: Bearer fb2a0784-f60c-3276-8fde-5b0f70e61ecc" - x-wso2-response: "HTTP/1.1 200 OK" - summary: Delete an API specific mediation policy - description: | - This operation can be used to delete an existing API specific mediation policy providing the Id of the API and the Id of the mediation policy. - parameters: - - $ref: '#/parameters/apiId' - - $ref: '#/parameters/mediationPolicyId' - - $ref: '#/parameters/If-Match' - - $ref: '#/parameters/If-Unmodified-Since' - tags: - - Mediation Policy (Individual) - responses: - 200: - description: | - OK. - Resource successfully deleted. - 403: - description: | - Forbidden. - The request must be conditional but no condition has been specified. - schema: - $ref: '#/definitions/Error' - 404: - description: | - Not Found. - Resource to be deleted does not exist. - schema: - $ref: '#/definitions/Error' - 412: - description: | - Precondition Failed. - The request has not been performed because one of the preconditions is not met. - schema: - $ref: '#/definitions/Error' - -#----------------------------------------------------- -# Update the a mediation policy -#----------------------------------------------------- - put: - x-scope: apim:api_create - x-wso2-curl: "curl -k -H \"Authorization: Bearer 9e41fae2-3ada-3dd1-8f12-2077202f4285\" -H \"Content-Type: application/json\" -X PUT -d @data.json https://localhost:9443/api/am/publisher/v0.12/apis/40082986-6488-4b86-801a-b0b069d4588c/policies/mediation/820fdcf7-7258-42b5-809e-674b893644d1" - x-wso2-request: "PUT https://localhost:9443/api/am/publisher/v0.12/apis/40082986-6488-4b86-801a-b0b069d4588c/policies/mediation/820fdcf7-7258-42b5-809e-674b893644d1\r\nContent-Type: application/json\r\nAuthorization: Bearer 9e41fae2-3ada-3dd1-8f12-2077202f4285\r\n\r\n{\r\n \"name\": \"add_custom_header_fault\",\r\n \"type\": \"fault\",\r\n \"config\": \"\\n \\n<\\/sequence>\\n\"\r\n}" - x-wso2-response: "HTTP/1.1 200 OK\r\nContent-Type: application/json\r\n\r\n{\r\n \"id\": \"a7365481-5b3f-463c-a646-a498895ac210\",\r\n \"name\": \"add_custom_header_fault\",\r\n \"type\": \"fault\",\r\n \"config\": \"\\n \\n<\\/sequence>\\n\"\r\n}" - summary: Update an API specific mediation policy - description: | - This operation can be used to update an existing mediation policy of an API. - parameters: - - $ref: '#/parameters/apiId' - - $ref: '#/parameters/mediationPolicyId' - - in: body - name: body - description: | - Mediation policy object that needs to be updated - required: true - schema: - $ref: '#/definitions/Mediation' - - $ref: '#/parameters/Content-Type' - - $ref: '#/parameters/If-Match' - - $ref: '#/parameters/If-Unmodified-Since' - tags: - - Mediation Policy (Individual) - responses: - 200: - description: | - OK. - Successful response with updated API object - schema: - $ref: '#/definitions/Mediation' - headers: - Location: - description: | - The URL of the newly created resource. - type: string - Content-Type: - description: | - The content type of the body. - type: string - ETag: - description: | - Entity Tag of the response resource. Used by caches, or in conditional requests (Will be supported in future). - type: string - Last-Modified: - description: | - Date and time the resource has been modifed the last time. - Used by caches, or in conditional requests (Will be supported in future). - type: string - 400: - description: | - Bad Request. - Invalid request or validation error - schema: - $ref: '#/definitions/Error' - 403: - description: | - Forbidden. - The request must be conditional but no condition has been specified. - schema: - $ref: '#/definitions/Error' - 404: - description: | - Not Found. - The resource to be updated does not exist. - schema: - $ref: '#/definitions/Error' - 412: - description: | - Precondition Failed. - The request has not been performed because one of the preconditions is not met. - schema: - $ref: '#/definitions/Error' - -###################################################### -# The wsdl Resource -###################################################### - /apis/{apiId}/wsdl: + This operation can be used to retrieve details of the subscription throttling policy of an API by specifying the API Id. -#----------------------------------------------------- -# Retrieve the details about a certain wsdl -#----------------------------------------------------- - get: - x-scope: apim:api_view - x-wso2-curl: "curl -k -H \"Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8\" \"https://localhost:9443/api/am/publisher/v0.12/apis/7f82f6b0-2667-441e-af23-c0fc44cf3a17/wsdl\"" - x-wso2-request: | - GET https://localhost:9443/api/am/publisher/v0.12/apis/7f82f6b0-2667-441e-af23-c0fc44cf3a17/wsdl - Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8 - x-wso2-response: "HTTP/1.1 200 OK\r\nContent-Type: application/json\r\n\r\n{\r\n \"name\": \"admin--hello1.0.0.wsdl\",\r\n \"wsdlDefinition\": \"\\n \\n \\n <\\/part>\\n <\\/message>\\n \\n \\n <\\/part>\\n <\\/message>\\n \\n \\n \\n <\\/input>\\n \\n <\\/output>\\n <\\/operation>\\n <\\/portType>\\n \\n \\n \\n \\n \\n \\n <\\/input>\\n \\n \\n <\\/output>\\n <\\/operation>\\n <\\/binding>\\n \\nWSDL File for HelloService<\\/documentation>\\n \\n \\n <\\/port>\\n <\\/service>\\n<\\/definitions>\"\r\n}" - summary: Get the WSDL of an API - description: | - This operation can be used to retrieve the WSDL definition of an API. + `X-WSO2-Tenant` header can be used to retrive API subscription throttling policies that belongs to a different tenant domain. If not specified super tenant will be used. If Authorization header is present in the request, the user's tenant associated with the access token will be used. parameters: - - $ref: '#/parameters/apiId' - - $ref: '#/parameters/Accept' - - $ref: '#/parameters/If-None-Match' - - $ref: '#/parameters/If-Modified-Since' - tags: - - Wsdl (Individual) + - $ref: '#/components/parameters/apiId' + - $ref: '#/components/parameters/requestedTenant' + - $ref: '#/components/parameters/If-None-Match' responses: 200: description: | OK. - Requested WSDL DTO object belongs to the API - schema: - $ref: '#/definitions/Wsdl' + Throttling Policy returned headers: - Content-Type: - description: | - The content type of the body. - type: string ETag: description: | - Entity Tag of the response resource. Used by caches, or in conditional requests (Will be supported in future). - type: string + Entity Tag of the response resource. + Used by caches, or in conditional requests. + schema: + type: string Last-Modified: description: | Date and time the resource has been modifed the last time. - Used by caches, or in conditional requests (Will be supported in future). - type: string - + Used by caches, or in conditional requests. + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/ThrottlingPolicy' 304: description: | Not Modified. - Empty body because the client has already the latest version of the requested resource (Will be supported in future). + Empty body because the client has already the latest version of the requested resource. + content: {} 404: - description: | - Not Found. - Requested API does not exist. - schema: - $ref: '#/definitions/Error' + $ref: '#/components/responses/NotFound' 406: + $ref: '#/components/responses/NotAcceptable' + security: + - OAuth2Security: + - apim:api_view + x-code-samples: + - lang: Curl + source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" + "https://127.0.0.1:9443/api/am/publisher/v2/apis/2fd14eb8-b828-4013-b448-0739d2e76bf7/subscription-policies"' + operationId: getAPISubscriptionPolicies + + /apis/copy-api: + post: + tags: + - APIs + summary: Create a New API Version + description: | + This operation can be used to create a new version of an existing API. The new version is specified as `newVersion` query parameter. New API will be in `CREATED` state. + parameters: + - name: newVersion + in: query + description: Version of the new API. + required: true + schema: + maxLength: 30 + type: string + - name: defaultVersion + in: query + description: Specifies whether new API should be added as default version. + schema: + type: boolean + default: false + - name: serviceVersion + in: query + description: Version of the Service that will used in creating new version + schema: + type: string + required: false + - $ref: '#/components/parameters/apiId-Q' + responses: + 201: description: | - Not Acceptable. - The requested media type is not supported - schema: - $ref: '#/definitions/Error' -#----------------------------------------------------- -# Add a wsdl to the registry -#----------------------------------------------------- + Created. + Successful response with the newly created API as entity in the body. Location header contains URL of newly created API. + headers: + Location: + description: | + The URL of the newly created API. + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/API' + 400: + $ref: '#/components/responses/BadRequest' + 404: + $ref: '#/components/responses/NotFound' + security: + - OAuth2Security: + - apim:api_create + x-code-samples: + - lang: Curl + source: 'curl -k -X POST -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" + "https://127.0.0.1:9443/api/am/publisher/v2/apis/copy-api?newVersion=2.0&defaultVersion=false&apiId=2fd14eb8-b828-4013-b448-0739d2e76bf7"' + x-examples: + $ref: docs/examples/apis/apis_copyapi.yaml#/post + operationId: createNewAPIVersion + + /apis/change-lifecycle: post: - x-scope: apim:api_create - x-wso2-curl: "curl -k -H \"Authorization:Bearer 5311eca3-8ac8-354e-ab36-7e2fdd6a4013\" -H \"Content-Type: application/json\" -X POST -d @data.json \"https://localhost:9443/api/am/publisher/v0.12/apis/af3f96da-9ccf-463f-8cee-13ec8530a9cd/wsdl\"" - x-wso2-request: "POST https://localhost:9443/api/am/publisher/v0.12/apis/af3f96da-9ccf-463f-8cee-13ec8530a9cd/wsdl\r\nContent-Type: application/json\r\nAuthorization: Bearer 7d237cab-7011-3f81-b384-24d03e750873\r\n\r\n{\r\n \"name\": \"admin--PizzaShackAPI1.0.0.wsdl\",\r\n \"wsdlDefinition\": \"\\n \\n \\n <\\/part>\\n <\\/message>\\n \\n \\n <\\/part>\\n <\\/message>\\n \\n \\n \\n <\\/input>\\n \\n <\\/output>\\n <\\/operation>\\n <\\/portType>\\n \\n \\n \\n \\n \\n \\n <\\/input>\\n \\n \\n <\\/output>\\n <\\/operation>\\n <\\/binding>\\n \\nWSDL File for HelloService<\\/documentation>\\n \\n \\n <\\/port>\\n <\\/service>\\n<\\/definitions>\"\r\n}" - x-wso2-response: "HTTP/1.1 200 OK\r\nContent-Type: application/json\r\n\r\n{\r\n \"name\": \"admin--PizzaShackAPI1.0.0.wsdl\",\r\n \"wsdlDefinition\": \"\\n \\n \\n <\\/part>\\n <\\/message>\\n \\n \\n <\\/part>\\n <\\/message>\\n \\n \\n \\n <\\/input>\\n \\n <\\/output>\\n <\\/operation>\\n <\\/portType>\\n \\n \\n \\n \\n \\n \\n <\\/input>\\n \\n \\n <\\/output>\\n <\\/operation>\\n <\\/binding>\\n \\nWSDL File for HelloService<\\/documentation>\\n \\n \\n <\\/port>\\n <\\/service>\\n<\\/definitions>\"\r\n}" - summary: Add a WSDL to an API + tags: + - API Lifecycle + summary: Change API Status description: | - This operation can be used to add a WSDL definition to an existing API. + This operation is used to change the lifecycle of an API. Eg: Publish an API which is in `CREATED` state. In order to change the lifecycle, we need to provide the lifecycle `action` as a query parameter. + + For example, to Publish an API, `action` should be `Publish`. Note that the `Re-publish` action is available only after calling `Block`. + + Some actions supports providing additional paramters which should be provided as `lifecycleChecklist` parameter. Please see parameters table for more information. parameters: - - $ref: '#/parameters/apiId' - - in: body - name: body + - name: action + in: query description: | - JSON payload including WSDL definition that needs to be added + The action to demote or promote the state of the API. + + Supported actions are [ **Publish**, **Deploy as a Prototype**, **Demote to Created**, **Block**, **Deprecate**, **Re-Publish**, **Retire** ] required: true schema: - $ref: '#/definitions/Wsdl' - - $ref: '#/parameters/Content-Type' - - $ref: '#/parameters/If-Match' - - $ref: '#/parameters/If-Unmodified-Since' - tags: - - Wsdl (Individual) + type: string + enum: + - Publish + - Deploy as a Prototype + - Demote to Created + - Block + - Deprecate + - Re-Publish + - Retire + - name: lifecycleChecklist + in: query + description: |2 + + Supported checklist items are as follows. + 1. **Deprecate old versions after publishing the API**: Setting this to true will deprecate older versions of a particular API when it is promoted to Published state from Created state. + 2. **Requires re-subscription when publishing the API**: If you set this to true, users need to re subscribe to the API although they may have subscribed to an older version. + You can specify additional checklist items by using an **"attribute:"** modifier. + Eg: "Deprecate old versions after publishing the API:true" will deprecate older versions of a particular API when it is promoted to Published state from Created state. Multiple checklist items can be given in "attribute1:true, attribute2:false" format. + **Sample CURL :** curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" -X POST "https://localhost:9443/api/am/publisher/v2/apis/change-lifecycle?apiId=890a4f4d-09eb-4877-a323-57f6ce2ed79b&action=Publish&lifecycleChecklist=Deprecate%20old%20versions%20after%20publishing%20the%20API%3Atrue,Requires%20re-subscription%20when%20publishing%20the%20API%3Afalse" + schema: + type: string + - $ref: '#/components/parameters/apiId-Q' + - $ref: '#/components/parameters/If-Match' responses: 200: description: | OK. - Successful response with updated wsdl definition + Lifecycle changed successfully. headers: - Location: - description: | - The URL of the newly created resource. - type: string - Content-Type: - description: | - The content type of the body. - type: string ETag: description: | - Entity Tag of the response resource. Used by caches, or in conditional requests (Will be supported in future). - type: string + Entity Tag of the changed API. Used by caches, or in conditional requests (Will be supported in future). + schema: + type: string Last-Modified: description: | - Date and time the resource has been modifed the last time. + Date and time the API lifecycle has been modified the last time. Used by caches, or in conditional requests (Will be supported in future). - type: string + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/WorkflowResponse' + 202: + description: | + Accepted. + The request has been accepted. + content: + application/json: + schema: + $ref: '#/components/schemas/WorkflowResponse' 400: - description: | - Bad Request. - Invalid request or validation error - schema: - $ref: '#/definitions/Error' - 403: - description: | - Forbidden. - The request must be conditional but no condition has been specified. - schema: - $ref: '#/definitions/Error' + $ref: '#/components/responses/BadRequest' 404: - description: | - Not Found. - The resource to be updated does not exist. - schema: - $ref: '#/definitions/Error' + $ref: '#/components/responses/NotFound' + 409: + $ref: '#/components/responses/Conflict' 412: - description: | - Precondition Failed. - The request has not been performed because one of the preconditions is not met. - schema: - $ref: '#/definitions/Error' - - -###################################################### -# The "Individual Application" resource APIs -###################################################### - '/applications/{applicationId}': - -#----------------------------------------------------- -# Retrieve the details about a certain application -#----------------------------------------------------- + $ref: '#/components/responses/PreconditionFailed' + security: + - OAuth2Security: + - apim:api_publish + - apim:api_import_export + x-code-samples: + - lang: Curl + source: 'curl -k -X POST -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" + "https://127.0.0.1:9443/api/am/publisher/v2/apis/change-lifecycle?apiId=890a4f4d-09eb-4877-a323-57f6ce2ed79b&action=Publish"' + operationId: changeAPILifecycle + + /apis/{apiId}/lifecycle-history: get: - x-scope: apim:api_create - x-wso2-curl: "curl -k -H \"Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8\" https://localhost:9443/api/am/publisher/v0.12/applications/896658a0-b4ee-4535-bbfa-806c894a4015" - x-wso2-request: | - GET https://localhost:9443/api/am/publisher/v0.12/applications/896658a0-b4ee-4535-bbfa-806c894a4015 - Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8 - x-wso2-response: "HTTP/1.1 200 OK\nContent-Type: application/json\n\n{\n \"groupId\": \"\",\n \"subscriber\": \"admin\",\n \"throttlingTier\": \"Unlimited\",\n \"applicationId\": \"896658a0-b4ee-4535-bbfa-806c894a4015\",\n \"description\": null,\n \"name\": \"DefaultApplication\"\n}" - summary: Get details of an application + tags: + - API Lifecycle + summary: Get Lifecycle State Change History of the API. description: | - This operation can be used to retrieve details of an individual application specifying the application id in the URI. + This operation can be used to retrieve Lifecycle state change history of the API. parameters: - - $ref: '#/parameters/applicationId' - - $ref: '#/parameters/Accept' - - $ref: '#/parameters/If-None-Match' - - $ref: '#/parameters/If-Modified-Since' - tags: - - Application (Individual) + - $ref: '#/components/parameters/apiId' + - $ref: '#/components/parameters/If-None-Match' responses: 200: description: | OK. - Application returned. - schema: - $ref: '#/definitions/Application' + Lifecycle state change history returned successfully. headers: - Content-Type: - description: | - The content type of the body. - type: string ETag: description: | Entity Tag of the response resource. Used by caches, or in conditional requests (Will be supported in future). - type: string + schema: + type: string Last-Modified: description: | Date and time the resource has been modifed the last time. Used by caches, or in conditional requests (Will be supported in future). - type: string + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/LifecycleHistory' 304: description: | Not Modified. Empty body because the client has already the latest version of the requested resource (Will be supported in future). + content: {} 404: - description: | - Not Found. - Requested application does not exist. - schema: - $ref: '#/definitions/Error' - 406: - description: | - Not Acceptable. - The requested media type is not supported - schema: - $ref: '#/definitions/Error' - -###################################################### -# The "Subscription Collection" resource APIs -###################################################### - /subscriptions: - -#----------------------------------------------------- -# Retrieve all subscriptions of a certain API -#----------------------------------------------------- + $ref: '#/components/responses/NotFound' + security: + - OAuth2Security: + - apim:api_publish + x-code-samples: + - lang: Curl + source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" + "https://127.0.0.1:9443/api/am/publisher/v2/apis/890a4f4d-09eb-4877-a323-57f6ce2ed79b/lifecycle-history"' + operationId: getAPILifecycleHistory + + /apis/{apiId}/lifecycle-state: get: - x-scope: apim:subscription_view - x-wso2-curl: "curl -k -H \"Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8\" \"https://localhost:9443/api/am/publisher/v0.12/subscriptions?apiId=890a4f4d-09eb-4877-a323-57f6ce2ed79b\"" - x-wso2-request: | - GET https://localhost:9443/api/am/publisher/v0.12/subscriptions?apiId=890a4f4d-09eb-4877-a323-57f6ce2ed79b - Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8 - x-wso2-response: "HTTP/1.1 200 OK\nContent-Type: application/json\n \n{\n \"previous\": \"\",\n \"list\": [\n {\n \"subscriptionId\": \"64eca60b-2e55-4c38-8603-e9e6bad7d809\",\n \"tier\": \"Gold\",\n \"apiIdentifier\": \"admin-PhoneVerification-1.0.0\",\n \"applicationId\": \"896658a0-b4ee-4535-bbfa-806c894a4015\",\n \"status\": \"UNBLOCKED\"\n },\n {\n \"subscriptionId\": \"7ac22c34-8745-4cfe-91e0-262c50b2f2e3\",\n \"tier\": \"Gold\",\n \"apiIdentifier\": \"admin-PhoneVerification-1.0.0\",\n \"applicationId\": \"367a2361-8db5-4140-8133-c6c8dc7fa0c4\",\n \"status\": \"UNBLOCKED\"\n }\n ],\n \"next\": \"\",\n \"count\": 2\n}" - summary: Get all Subscriptions + tags: + - API Lifecycle + summary: Get Lifecycle State Data of the API. description: | - This operation can be used to retrieve a list of subscriptions of the user associated with the provided access token. This operation is capable of - - 1. Retrieving all subscriptions for the user's APIs. - `GET https://localhost:9443/api/am/publisher/v0.12/subscriptions` - - 2. Retrieving subscriptions for a specific API. - `GET https://localhost:9443/api/am/publisher/v0.12/subscriptions?apiId=c43a325c-260b-4302-81cb-768eafaa3aed` + This operation can be used to retrieve Lifecycle state data of the API. parameters: - - $ref: '#/parameters/apiId-Q' - - $ref: '#/parameters/limit' - - $ref: '#/parameters/offset' - - $ref: '#/parameters/Accept' - - $ref: '#/parameters/If-None-Match' - tags: - - Subscription (Collection) + - $ref: '#/components/parameters/apiId' + - $ref: '#/components/parameters/If-None-Match' responses: 200: description: | OK. - Subscription list returned. - schema: - $ref: '#/definitions/SubscriptionList' + Lifecycle state data returned successfully. headers: - Content-Type: - description: | - The content type of the body. - type: string ETag: description: | - Entity Tag of the response resource. + Entity Tag of the response resource. Used by caches, or in conditional requests (Will be supported in future). + schema: + type: string + Last-Modified: + description: | + Date and time the resource has been modifed the last time. Used by caches, or in conditional requests (Will be supported in future). - type: string + schema: + type: string + Content-Type: + description: | + The content type of the body. + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/LifecycleState' 304: description: | Not Modified. Empty body because the client has already the latest version of the requested resource (Will be supported in future). - 406: - description: | - Not Acceptable. The requested media type is not supported - schema: - $ref: '#/definitions/Error' - -###################################################### -# The "Individual Subscription" resource APIs -###################################################### - '/subscriptions/{subscriptionId}': - -#----------------------------------------------------- -# Retrieve a certain subscription -#----------------------------------------------------- - get: - x-scope: apim:subscription_view - x-wso2-curl: "curl -k -H \"Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8\" https://localhost:9443/api/am/publisher/v0.12/subscriptions/64eca60b-2e55-4c38-8603-e9e6bad7d809" - x-wso2-request: | - GET https://localhost:9443/api/am/publisher/v0.12/subscriptions/64eca60b-2e55-4c38-8603-e9e6bad7d809 - Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8 - x-wso2-response: "HTTP/1.1 200 OK\nContent-Type: application/json\n\n{\n \"subscriptionId\": \"64eca60b-2e55-4c38-8603-e9e6bad7d809\",\n \"tier\": \"Gold\",\n \"apiIdentifier\": \"admin-PhoneVerification-1.0.0\",\n \"applicationId\": \"896658a0-b4ee-4535-bbfa-806c894a4015\",\n \"status\": \"UNBLOCKED\"\n}" - summary: Get details of a subscription + content: {} + 404: + $ref: '#/components/responses/NotFound' + 412: + $ref: '#/components/responses/PreconditionFailed' + security: + - OAuth2Security: + - apim:api_publish + - apim:api_create + x-code-samples: + - lang: Curl + source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" + "https://127.0.0.1:9443/api/am/publisher/v2/apis/890a4f4d-09eb-4877-a323-57f6ce2ed79b/lifecycle-state"' + operationId: getAPILifecycleState + + /apis/{apiId}/lifecycle-state/pending-tasks: + delete: + tags: + - API Lifecycle + summary: Delete Pending Lifecycle State Change Tasks description: | - This operation can be used to get details of a single subscription. + This operation can be used to remove pending lifecycle state change requests that are in pending state parameters: - - $ref: '#/parameters/subscriptionId' - - $ref: '#/parameters/Accept' - - $ref: '#/parameters/If-None-Match' - - $ref: '#/parameters/If-Modified-Since' - tags: - - Subscription (Individual) + - $ref: '#/components/parameters/apiId' responses: 200: description: | OK. - Subscription returned - schema: - $ref: '#/definitions/ExtendedSubscription' - headers: - Content-Type: - description: The content type of the body. - type: string - ETag: - description: 'Entity Tag of the response resource. Used by caches, or in conditional requests (Will be supported in future).' - type: string - Last-Modified: - description: 'Date and time the resource has been modifed the last time. Used by caches, or in conditional requests (Will be supported in future).' - type: string - '304': - description: | - Not Modified. - Empty body because the client has already the latest version of the requested resource (Will be supported in future). - '404': - description: | - Not Found. - Requested Subscription does not exist. - schema: - $ref: '#/definitions/Error' - -###################################################### -# The "Block Subscription" Processing Function resource API -###################################################### - /subscriptions/block-subscription: - -#----------------------------------------------------- -# Block a certain subscription -#----------------------------------------------------- - post: - x-scope: apim:subscription_block - x-wso2-curl: "curl -k -H \"Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8\" -X POST \"https://localhost:9443/api/am/publisher/v0.12/subscriptions/block-subscription?subscriptionId=64eca60b-2e55-4c38-8603-e9e6bad7d809&blockState=PROD_ONLY_BLOCKED\"" - x-wso2-request: | - POST https://localhost:9443/api/am/publisher/v0.12/subscriptions/block-subscription?subscriptionId=64eca60b-2e55-4c38-8603-e9e6bad7d809&blockState=PROD_ONLY_BLOCKED - Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8 - x-wso2-response: "HTTP/1.1 200 OK\nContent-Type: application/json\n \n{\n \"subscriptionId\": \"64eca60b-2e55-4c38-8603-e9e6bad7d809\",\n \"tier\": \"Gold\",\n \"apiIdentifier\": \"admin-PhoneVerification-1.0.0\",\n \"applicationId\": \"896658a0-b4ee-4535-bbfa-806c894a4015\",\n \"status\": \"PROD_ONLY_BLOCKED\"\n}" - summary: Block a subscription + Lifecycle state change pending task removed successfully. + content: {} + 404: + $ref: '#/components/responses/NotFound' + 412: + $ref: '#/components/responses/PreconditionFailed' + security: + - OAuth2Security: + - apim:api_publish + x-code-samples: + - lang: Curl + source: 'curl -k -X DELETE -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" + "https://127.0.0.1:9443/api/am/publisher/v2/apis/890a4f4d-09eb-4877-a323-57f6ce2ed79b/lifecycle-state/pending-tasks"' + operationId: deleteAPILifecycleStatePendingTasks + + ###################################################### + # The "API Revisions" resource API + ###################################################### + /apis/{apiId}/revisions: + + #-------------------------------------------- + # List available revisions of an API + #-------------------------------------------- + get: + tags: + - API Revisions + summary: List available revisions of an API description: | - This operation can be used to block a subscription. Along with the request, `blockState` must be specified as a query parameter. - - 1. `BLOCKED` : Subscription is completely blocked for both Production and Sandbox environments. - 2. `PROD_ONLY_BLOCKED` : Subscription is blocked for Production environment only. + List available revisions of an API + operationId: getAPIRevisions parameters: - - $ref: '#/parameters/subscriptionId-Q' - - name: blockState + - $ref: '#/components/parameters/apiId' + - name: query in: query - description: | - Subscription block state. - type: string - required: true - enum: - - BLOCKED - - PROD_ONLY_BLOCKED - - $ref: '#/parameters/If-Match' - - $ref: '#/parameters/If-Unmodified-Since' - tags: - - Subscription (Individual) + schema: + type: string responses: 200: description: | OK. - Subscription was blocked successfully. - headers: - ETag: - description: | - Entity Tag of the blocked subscription. - Used by caches, or in conditional requests (Will be supported in future). - type: string - Last-Modified: - description: | - Date and time the subscription has been blocked. - Used by caches, or in conditional requests (Will be supported in future). - type: string - 400: - description: | - Bad Request. - Invalid request or validation error - schema: - $ref: '#/definitions/Error' + List of API revisions are returned. + content: + application/json: + schema: + $ref: '#/components/schemas/APIRevisionList' 404: - description: | - Not Found. - Requested subscription does not exist. - schema: - $ref: '#/definitions/Error' - 412: - description: | - Precondition Failed. - The request has not been performed because one of the preconditions is not met. - schema: - $ref: '#/definitions/Error' - -###################################################### -# The "Unblock Subscription" Processing Function resource API -###################################################### - /subscriptions/unblock-subscription: - -#----------------------------------------------------- -# Unblock a certain subscription -#----------------------------------------------------- + $ref: '#/components/responses/NotFound' + security: + - OAuth2Security: + - apim:api_publish + - apim:api_import_export + x-code-samples: + - lang: Curl + source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" + "https://127.0.0.1:9443/api/am/publisher/v1/apis/890a4f4d-09eb-4877-a323-57f6ce2ed79b/revisions?query=deployed:true"' + + #-------------------------------------------- + # Create a new API revision + #-------------------------------------------- post: - x-scope: apim:subscription_block - x-wso2-curl: "curl -k -H \"Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8\" -X POST \"https://localhost:9443/api/am/publisher/v0.12/subscriptions/unblock-subscription?subscriptionId=64eca60b-2e55-4c38-8603-e9e6bad7d809\"" - x-wso2-request: | - POST https://localhost:9443/api/am/publisher/v0.12/subscriptions/unblock-subscription?subscriptionId=64eca60b-2e55-4c38-8603-e9e6bad7d809 - Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8` - x-wso2-response: "HTTP/1.1 200 OK\nContent-Type: application/json\n\n{\n \"subscriptionId\": \"64eca60b-2e55-4c38-8603-e9e6bad7d809\",\n \"tier\": \"Gold\",\n \"apiIdentifier\": \"admin-PhoneVerification-1.0.0\",\n \"applicationId\": \"896658a0-b4ee-4535-bbfa-806c894a4015\",\n \"status\": \"UNBLOCKED\"\n} " - summary: Unblock a Subscription - parameters: - - $ref: '#/parameters/subscriptionId-Q' - - $ref: '#/parameters/If-Match' - - $ref: '#/parameters/If-Unmodified-Since' + tags: + - API Revisions + summary: Create a new API revision description: | - This operation can be used to unblock a subscription specifying the subscription Id. The subscription will be fully unblocked after performing this operation. + Create a new API revision + operationId: createAPIRevision + parameters: + - $ref: '#/components/parameters/apiId' + requestBody: + description: API object that needs to be added + content: + application/json: + schema: + $ref: '#/components/schemas/APIRevision' + responses: + 201: + description: | + Created. + Successful response with the newly created APIRevision object as the entity in the body. + content: + application/json: + schema: + $ref: '#/components/schemas/APIRevision' + 404: + $ref: '#/components/responses/NotFound' + 412: + $ref: '#/components/responses/PreconditionFailed' + security: + - OAuth2Security: + - apim:api_publish + - apim:api_import_export + x-code-samples: + - lang: Curl + source: 'curl -k -X POST -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" + -H "Content-Type: application/json" -d @data.json + "https://127.0.0.1:9443/api/am/publisher/v1/apis/890a4f4d-09eb-4877-a323-57f6ce2ed79b/revisions"' + + ###################################################### + # The "API Revisions" individual resource API + ###################################################### + /apis/{apiId}/revisions/{revisionId}: + + #-------------------------------------------- + # Get a revision + #-------------------------------------------- + get: tags: - - Subscription (Individual) + - API Revisions + summary: Retrieve a revision of an API + description: | + Retrieve a revision of an API + operationId: getAPIRevision + parameters: + - $ref: '#/components/parameters/apiId' + - $ref: '#/components/parameters/revisionId' responses: 200: description: | OK. - Subscription was unblocked successfully. - headers: - ETag: - description: | - Entity Tag of the unblocked subscription. - Used by caches, or in conditional requests (Will be supported in future). - type: string - Last-Modified: - description: | - Date and time the subscription has been unblocked. - Used by caches, or in conditional requests (Will be supported in future). - type: string - 400: - description: | - Bad Request. - Invalid request or validation error - schema: - $ref: '#/definitions/Error' + An API revision is returned. + content: + application/json: + schema: + $ref: '#/components/schemas/APIRevision' 404: + $ref: '#/components/responses/NotFound' + security: + - OAuth2Security: + - apim:api_publish + x-code-samples: + - lang: Curl + source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" + "https://127.0.0.1:9443/api/am/publisher/v1/apis/890a4f4d-09eb-4877-a323-57f6ce2ed79b/revisions/e0824883-3e86-403a-aec1-22bbc454eb7c"' + + #-------------------------------------------- + # Delete a revision + #-------------------------------------------- + delete: + tags: + - API Revisions + summary: Delete a revision of an API + description: | + Delete a revision of an API + operationId: deleteAPIRevision + parameters: + - $ref: '#/components/parameters/apiId' + - $ref: '#/components/parameters/revisionId' + responses: + 200: description: | - Not Found. - Requested subscription does not exist. - schema: - $ref: '#/definitions/Error' - 412: - description: | - Precondition Failed. - The request has not been performed because one of the preconditions is not met. - schema: - $ref: '#/definitions/Error' - -###################################################### -# The "Tier Collection" resource APIs -###################################################### - '/tiers/{tierLevel}': - -#----------------------------------------------------- -# Retrieve the list of all available tiers -#----------------------------------------------------- + OK. + List of remaining API revisions are returned. + content: + application/json: + schema: + $ref: '#/components/schemas/APIRevisionList' + 204: + description: | + No Content. + Successfully deleted the revision + 404: + $ref: '#/components/responses/NotFound' + security: + - OAuth2Security: + - apim:api_publish + - apim:api_import_export + x-code-samples: + - lang: Curl + source: 'curl -k -X DELETE -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" + "https://127.0.0.1:9443/api/am/publisher/v1/apis/890a4f4d-09eb-4877-a323-57f6ce2ed79b/revisions/e0824883-3e86-403a-aec1-22bbc454eb7c"' + + /apis/{apiId}/deploy-revision: + + #-------------------------------------------- + # List available deployed revision deployment details of an API + #-------------------------------------------- get: - x-scope: apim:tier_view - x-wso2-curl: "curl -k -H \"Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8\" https://localhost:9443/api/am/publisher/v0.12/tiers/api" - x-wso2-request: | - GET https://localhost:9443/api/am/publisher/v0.12/tiers/api - Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8 - x-wso2-response: "HTTP/1.1 200 OK\nContent-Type: application/json\n\n\n{\n \"previous\": \"\",\n \"list\": [\n {\n \"unitTime\": 60000,\n \"tierPlan\": \"FREE\",\n \"tierLevel\": \"api\",\n \"stopOnQuotaReach\": true,\n \"requestCount\": 1,\n \"description\": \"Allows 1 request(s) per minute.\",\n \"name\": \"Bronze\",\n \"attributes\": {}\n },\n {\n \"unitTime\": 60000,\n \"tierPlan\": \"FREE\",\n \"tierLevel\": \"api\",\n \"stopOnQuotaReach\": true,\n \"requestCount\": 20,\n \"description\": \"Allows 20 request(s) per minute.\",\n \"name\": \"Gold\",\n \"attributes\": {}\n },\n {\n \"unitTime\": 60000,\n \"tierPlan\": \"FREE\",\n \"tierLevel\": \"api\",\n \"stopOnQuotaReach\": true,\n \"requestCount\": 5,\n \"description\": \"Allows 5 request(s) per minute.\",\n \"name\": \"Silver\",\n \"attributes\": {}\n },\n {\n \"unitTime\": 0,\n \"tierPlan\": null,\n \"tierLevel\": \"api\",\n \"stopOnQuotaReach\": true,\n \"requestCount\": 0,\n \"description\": \"Allows unlimited requests\",\n \"name\": \"Unlimited\",\n \"attributes\": {}\n }\n ],\n \"next\": \"\",\n \"count\": 4\n}" - summary: Get all tiers + tags: + - API Revisions + summary: List available deployed revision deployment details of an API description: | - This operation can be used to list the available tiers for a given tier level. Tier level should be specified as a path parameter and should be one of `api`, `application` and `resource`. + List available deployed revision deployment details of an API + operationId: getAPIRevisionDeployments parameters: - - $ref: '#/parameters/limit' - - $ref: '#/parameters/offset' - - $ref: '#/parameters/tierLevel' - - $ref: '#/parameters/Accept' - - $ref: '#/parameters/If-None-Match' + - $ref: '#/components/parameters/apiId' + responses: + 200: + description: | + OK. + List of deployed revision deployment details are returned. + content: + application/json: + schema: + $ref: '#/components/schemas/APIRevisionDeploymentList' + 404: + $ref: '#/components/responses/NotFound' + security: + - OAuth2Security: + - apim:api_publish + x-code-samples: + - lang: Curl + source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" + "https://127.0.0.1:9443/api/am/publisher/v1/apis/890a4f4d-09eb-4877-a323-57f6ce2ed79b/deploy-revision"' + + #-------------------------------------------- + # Deploy a revision + #-------------------------------------------- + post: tags: - - Throttling Tier (Collection) + - API Revisions + summary: Deploy a revision + description: | + Deploy a revision + operationId: deployAPIRevision + parameters: + - $ref: '#/components/parameters/apiId' + - $ref: '#/components/parameters/revisionId-Q' + requestBody: + description: Deployment object that needs to be added + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/APIRevisionDeployment' responses: 200: description: | OK. - List of tiers returned. + 201: + description: | + Created. + Successful response with the newly deployed APIRevisionDeployment List object as the entity in the body. + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/APIRevisionDeployment' + 404: + $ref: '#/components/responses/NotFound' + security: + - OAuth2Security: + - apim:api_publish + x-code-samples: + - lang: Curl + source: 'curl -k -X POST -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" + "https://127.0.0.1:9443/api/am/publisher/v1/apis/890a4f4d-09eb-4877-a323-57f6ce2ed79b/deploy-revision?revisionId=e0824883-3e86-403a-aec1-22bbc454eb7c"' + + /apis/{apiId}/undeploy-revision: + #-------------------------------------------- + # Un-Deploy a revision from deployed gateway + #-------------------------------------------- + post: + tags: + - API Revisions + summary: Un-Deploy a revision + description: | + Un-Deploy a revision + operationId: undeployAPIRevision + parameters: + - $ref: '#/components/parameters/apiId' + - $ref: '#/components/parameters/revisionId-Q' + - $ref: '#/components/parameters/revisionNum-Q' + - name: allEnvironments + in: query schema: - $ref: '#/definitions/TierList' - headers: - Content-Type: - description: The content type of the body. - type: string - ETag: - description: | - Entity Tag of the response resource. - Used by caches, or in conditional requests (Will be supported in future). - type: string - 304: + type: boolean + default: false + requestBody: + description: Deployment object that needs to be added + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/APIRevisionDeployment' + responses: + 200: description: | - Not Modified. - Empty body because the client has already the latest version of the requested resource (Will be supported in future). - 406: + OK. + 201: description: | - Not Acceptable. - The requested media type is not supported - schema: - $ref: '#/definitions/Error' - -#----------------------------------------------------- -# Create a new tier -#----------------------------------------------------- + Created. + Successful response with the newly undeployed APIRevisionDeploymentList object as the entity in the body. + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/APIRevisionDeployment' + 404: + $ref: '#/components/responses/NotFound' + security: + - OAuth2Security: + - apim:api_publish + - apim:api_import_export + x-code-samples: + - lang: Curl + source: 'curl -k -X POST -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" + "https://127.0.0.1:9443/api/am/publisher/v1/apis/890a4f4d-09eb-4877-a323-57f6ce2ed79b/undeploy-revision?revisionId=e0824883-3e86-403a-aec1-22bbc454eb7c"' + + /apis/{apiId}/restore-revision: + + #-------------------------------------------------------- + # Restore a revision to the working copy of the API + #-------------------------------------------------------- post: - x-scope: apim:tier_manage - x-wso2-curl: "curl -k -H \"Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8\" -H \"Content-Type: application/json\" -X POST -d @data.json \"https://localhost:9443/api/am/publisher/v0.12/tiers/api\"" - x-wso2-request: "POST https://localhost:9443/api/am/publisher/v0.12/tiers/api\nAuthorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8\nContent-Type: application/json\n\n{\n \"unitTime\": 60000,\n \"tierPlan\": \"FREE\",\n \"tierLevel\": \"api\",\n \"stopOnQuotaReach\": true,\n \"requestCount\": 5,\n \"description\": \"Allows 5 request(s) per minute.\",\n \"name\": \"Low\",\n \"attributes\": {\n \"a\":10,\n \"b\":30\n }\n}" - x-wso2-response: "HTTP/1.1 201 Created\nLocation: https://localhost:9443/api/am/publisher/v0.12/tiers/Low\nContent-Type: application/json\n\n{\n \"unitTime\": 60000,\n \"tierPlan\": \"FREE\",\n \"tierLevel\": \"api\",\n \"stopOnQuotaReach\": true,\n \"requestCount\": 5,\n \"description\": \"Allows 5 request(s) per minute.\",\n \"name\": \"Low\",\n \"attributes\": {\n \"b\": \"30\",\n \"a\": \"10\"\n }\n}" - summary: Create a Tier + tags: + - API Revisions + summary: Restore a revision description: | - This operation can be used to create a new throttling tier. The only supported tier level is `api` tiers. - `POST https://localhost:9443/api/am/publisher/v0.12/tiers/api` - - **IMPORTANT:** - * This is only effective when Advanced Throttling is disabled in the Server. If enabled, we need to use Admin REST API for throttling tiers modification related operations. + Restore a revision to the working copy of the API + operationId: restoreAPIRevision parameters: - - in: body - name: body + - $ref: '#/components/parameters/apiId' + - $ref: '#/components/parameters/revisionId-Q' + responses: + 201: description: | - Tier object that should to be added + Restored. + Successful response with the newly restored API object as the entity in the body. + content: + application/json: + schema: + $ref: '#/components/schemas/API' + 404: + $ref: '#/components/responses/NotFound' + security: + - OAuth2Security: + - apim:api_publish + x-code-samples: + - lang: Curl + source: 'curl -k -X POST -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" + "https://127.0.0.1:9443/api/am/publisher/v1/apis/890a4f4d-09eb-4877-a323-57f6ce2ed79b/restore-revision?revisionId=e0824883-3e86-403a-aec1-22bbc454eb7c"' + + /apis/import-service: + post: + tags: + - APIs + summary: Import a Service from Service Catalog + description: This operation can be used to create an API from a Service from Service Catalog + operationId: importServiceFromCatalog + parameters: + - name: serviceKey + in: query required: true schema: - $ref: '#/definitions/Tier' - - $ref: '#/parameters/tierLevel-A' - - $ref: '#/parameters/Content-Type' - tags: - - Throttling Tier (Collection) + type: string + description: ID of service that should be imported from Service Catalog + requestBody: + content: + application/json: + schema: + '$ref': '#/components/schemas/API' responses: 201: description: | Created. Successful response with the newly created object as entity in the body. - Location header contains URL of newly created entity. - schema: - $ref: '#/definitions/Tier' + Location header contains the URL of the newly created entity. headers: Location: description: | - Location of the newly created tier. - type: string + The URL of the newly created resource. + schema: + type: string Content-Type: description: | The content type of the body. - type: string + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/API' + 404: + $ref: '#/components/responses/NotFound' + 500: + $ref: '#/components/responses/InternalServerError' + + /apis/{apiId}/comments: + get: + tags: + - Comments + summary: Retrieve API Comments + description: | + Get a list of Comments that are already added to APIs + operationId: getAllCommentsOfAPI + parameters: + - $ref: '#/components/parameters/apiId' + - $ref: '#/components/parameters/requestedTenant' + - $ref: '#/components/parameters/limit' + - $ref: '#/components/parameters/offset' + - $ref: '#/components/parameters/includeCommenterInfo' + responses: + 200: + description: | + OK. + Comments list is returned. + content: + application/json: + schema: + $ref: '#/components/schemas/CommentList' + 401: + $ref: '#/components/responses/Unauthorized' + 406: + $ref: '#/components/responses/NotAcceptable' + security: + - OAuth2Security: [] + x-code-samples: + - lang: Curl + source: curl -k "https://localhost:9443/api/am/publisher/v1/apis/e93fb282-b456-48fc-8981-003fb89086ae/comments" + + post: + tags: + - Comments + summary: Add an API Comment + operationId: addCommentToAPI + parameters: + - $ref: '#/components/parameters/apiId' + - $ref: '#/components/parameters/parentCommentID' + requestBody: + description: | + Comment object that should to be added + content: + application/json: + schema: + title: Post request body + type: object + properties: + content: + type: string + description: | + Content of the comment + example: This is a comment + category: + type: string + description: | + Category of the comment + example: general + required: + - content + required: true + responses: + 201: + description: | + Created. + Successful response with the newly created object as entity in the body. + Location header contains URL of newly created entity. + headers: ETag: description: | - Entity Tag of the response resource. - Used by caches, or in conditional request' - type: string + Entity Tag of the response resource. Used by caches, or in conditional request. + schema: + type: string + Location: + description: | + Location to the newly created Comment. + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/Comment' 400: - description: | - Bad Request. - Invalid request or validation error - schema: - $ref: '#/definitions/Error' + $ref: '#/components/responses/BadRequest' + 401: + $ref: '#/components/responses/Unauthorized' 415: - description: | - Unsupported media type. - The entity of the request was in a not supported format. - -###################################################### -# The "Individual Tier" resource APIs -###################################################### - '/tiers/{tierLevel}/{tierName}': - -#----------------------------------------------------- -# Retrieve a certain tier -#----------------------------------------------------- + $ref: '#/components/responses/UnsupportedMediaType' + security: + - OAuth2Security: + - apim:api_publish + x-code-samples: + - lang: Curl + source: 'curl -k -X POST -H "Authorization:Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" + -H "Content-Type: application/json" -d @data.json "https://localhost:9443/api/am/publisher/v1/apis/e93fb282-b456-48fc-8981-003fb89086ae/comments"' + + /apis/{apiId}/comments/{commentId}: get: - x-scope: apim:tier_view - x-wso2-curl: "curl -k -H \"Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8\" https://localhost:9443/api/am/publisher/v0.12/tiers/api/Bronze" - x-wso2-request: | - GET https://localhost:9443/api/am/publisher/v0.12/tiers/api/Bronze - Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8 - x-wso2-response: "HTTP/1.1 200 OK\nContent-Type: application/json\n\n{\n \"unitTime\": 60000,\n \"tierPlan\": \"FREE\",\n \"tierLevel\": \"api\",\n \"stopOnQuotaReach\": true,\n \"requestCount\": 1,\n \"description\": \"Allows 1 request(s) per minute.\",\n \"name\": \"Bronze\",\n \"attributes\": {}\n}" - summary: Get details of a tier + tags: + - Comments + summary: Get Details of an API Comment description: | - This operation can be used to retrieve details of a single tier by specifying the tier level and tier name. - Note that the scope of the API is mandatory while retreiving the access token with the following cURL command : `curl -k -d \"grant_type=password&username=username&password=password&scope=apim:tier_view\" -H \"Authorization: Basic \" https://localhost:8243/token`. - You will receive the access token as the response, for example `"access_token":"8644c013-7ff1-3217-b150-d7b92cae6be7"`. + Get the individual comment given by a username for a certain API. + operationId: getCommentOfAPI parameters: - - $ref: '#/parameters/tierName' - - $ref: '#/parameters/tierLevel' - - $ref: '#/parameters/Accept' - - $ref: '#/parameters/If-None-Match' - - $ref: '#/parameters/If-Modified-Since' - tags: - - Throttling Tier (Individual) + - $ref: '#/components/parameters/commentId' + - $ref: '#/components/parameters/apiId' + - $ref: '#/components/parameters/requestedTenant' + - $ref: '#/components/parameters/If-None-Match' + - $ref: '#/components/parameters/includeCommenterInfo' + - $ref: '#/components/parameters/replyLimit' + - $ref: '#/components/parameters/replyOffset' responses: 200: description: | OK. - Tier returned - schema: - $ref: '#/definitions/Tier' + Comment returned. headers: - Content-Type: - description: | - The content type of the body. - type: string ETag: description: | Entity Tag of the response resource. - Used by caches, or in conditional requests (Will be supported in future). - type: string + Used by caches, or in conditional requests. + schema: + type: string Last-Modified: description: | Date and time the resource has been modifed the last time. - Used by caches, or in conditional requests (Will be supported in future). - type: string + Used by caches, or in conditional requests. + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/Comment' 304: description: | Not Modified. - Empty body because the client has already the latest version of the requested resource (Will be supported in future). + Empty body because the client has already the latest version of the requested resource. + content: {} + 401: + $ref: '#/components/responses/Unauthorized' 404: - description: | - Not Found. - Requested Tier does not exist. - schema: - $ref: '#/definitions/Error' + $ref: '#/components/responses/NotFound' 406: - description: | - Not Acceptable. - The requested media type is not supported. - schema: - $ref: '#/definitions/Error' - -#----------------------------------------------------- -# Update a certain tier -#----------------------------------------------------- - put: - x-scope: apim:tier_manage - x-wso2-curl: "curl -k -H \"Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8\" -H \"Content-Type: application/json\" -X PUT -d @data.json \"https://localhost:9443/api/am/publisher/v0.12/tiers/api/Low\"" - x-wso2-request: "PUT https://localhost:9443/api/am/publisher/v0.12/tiers/api/Low\nAuthorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8\nContent-Type: application/json\n\n{\n \"unitTime\": 60000,\n \"tierPlan\": \"FREE\",\n \"tierLevel\": \"api\",\n \"stopOnQuotaReach\": true,\n \"requestCount\": 10,\n \"description\": \"Allows 10 request(s) per minute.\",\n \"name\": \"Low\",\n \"attributes\": {\n \"a\": \"30\",\n \"b\": \"10\",\n \"c\": \"20\"\n }\n}\n" - x-wso2-response: "HTTP/1.1 200 OK\nContent-Type: application/json\n\n{\n \"unitTime\": 60000,\n \"tierPlan\": \"FREE\",\n \"tierLevel\": \"api\",\n \"stopOnQuotaReach\": true,\n \"requestCount\": 10,\n \"description\": \"Allows 10 request(s) per minute.\",\n \"name\": \"Low\",\n \"attributes\": {\n \"b\": \"10\",\n \"c\": \"20\",\n \"a\": \"30\"\n }\n}" - summary: Update a Tier + $ref: '#/components/responses/NotAcceptable' + security: + - OAuth2Security: [] + x-code-samples: + - lang: Curl + source: curl -k "https://localhost:9443/api/am/publisher/v1/apis/e93fb282-b456-48fc-8981-003fb89086ae/comments/d4cf1704-5d09-491c-bc48-4d19ce6ea9b4" + + patch: + tags: + - Comments + summary: Edit a comment description: | - This operation can be used to update an existing tier. The only supported tier level is `api` tiers. - `PUT https://localhost:9443/api/am/publisher/v0.12/tiers/api/Low` - - **IMPORTANT:** - * This is only effective when Advanced Throttling is disabled in the Server. If enabled, we need to use Admin REST API for throttling tiers modification related operations. + Edit the individual comment + operationId: editCommentOfAPI parameters: - - $ref: '#/parameters/tierName' - - in: body - name: body - description: | - Tier object that needs to be modified - required: true - schema: - $ref: '#/definitions/Tier' - - $ref: '#/parameters/tierLevel-A' - - $ref: '#/parameters/Content-Type' - - $ref: '#/parameters/If-Match' - - $ref: '#/parameters/If-Unmodified-Since' - tags: - - Throttling Tier (Individual) + - $ref: '#/components/parameters/commentId' + - $ref: '#/components/parameters/apiId' + requestBody: + description: | + Comment object that should to be updated + content: + application/json: + schema: + title: Patch request body + type: object + properties: + content: + type: string + description: | + Content of the comment + example: This is a comment + category: + type: string + description: | + Category of the comment + example: general + required: true responses: 200: description: | OK. - Subscription updated. - schema: - $ref: '#/definitions/Tier' + Comment updated. headers: - Location: - description: | - The URL of the newly created resource. - type: string - Content-Type: - description: | - The content type of the body. - type: string ETag: description: | - Entity Tag of the response resource. - Used by caches, or in conditional requests (Will be supported in future). - type: string - Last-Modified: + Entity Tag of the response resource. Used by caches, or in conditional request. + schema: + type: string + Location: #??? description: | - Date and time the resource has been modifed the last time. - Used by caches, or in conditional requests (Will be supported in future). - type: string + Location to the newly created Comment. + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/Comment' 400: - description: | - Bad Request. - Invalid request or validation error. - schema: - $ref: '#/definitions/Error' + $ref: '#/components/responses/BadRequest' + 401: + $ref: '#/components/responses/Unauthorized' 404: - description: | - Not Found. - The resource to be updated does not exist. - schema: - $ref: '#/definitions/Error' - 412: - description: | - Precondition Failed. - The request has not been performed because one of the preconditions is not met. - schema: - $ref: '#/definitions/Error' + $ref: '#/components/responses/NotFound' + 415: + $ref: '#/components/responses/UnsupportedMediaType' + security: + - OAuth2Security: + - apim:api_publish + x-code-samples: + - lang: Curl + source: 'curl -k -X PUT -H "Authorization:Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" + -H "Content-Type: application/json" -d @data.json "https://localhost:9443/api/am/publisher/v1/apis/e93fb282-b456-48fc-8981-003fb89086ae/comments/d4cf1704-5d09-491c-bc48-4d19ce6ea9b4"' -#----------------------------------------------------- -# Delete a certain tier -#----------------------------------------------------- delete: - x-scope: apim:tier_manage - x-wso2-curl: "curl -k -H \"Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8\" -X DELETE \"https://localhost:9443/api/am/publisher/v0.12/tiers/api/Low\"" - x-wso2-request: | - DELETE https://localhost:9443/api/am/publisher/v0.12/tiers/api/Low - Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8 - x-wso2-response: "HTTP/1.1 200 OK" - summary: Delete a Tier + tags: + - Comments + summary: Delete an API Comment description: | - This operation can be used to delete an existing tier. The only supported tier level is `api` tiers. - `DELETE https://localhost:9443/api/am/publisher/v0.12/tiers/api/Low` - - **IMPORTANT:** - * This is only effective when Advanced Throttling is disabled in the Server. If enabled, we need to use Admin REST API for throttling tiers modification related operations. + Remove a Comment + operationId: deleteComment parameters: - - $ref: '#/parameters/tierName' - - $ref: '#/parameters/tierLevel-A' - - $ref: '#/parameters/If-Match' - - $ref: '#/parameters/If-Unmodified-Since' - tags: - - Throttling Tier (Individual) + - $ref: '#/components/parameters/commentId' + - $ref: '#/components/parameters/apiId' + - $ref: '#/components/parameters/If-Match' responses: 200: description: | OK. Resource successfully deleted. + content: {} + 401: + $ref: '#/components/responses/Unauthorized' 404: - description: | - Not Found. - Resource to be deleted does not exist. - schema: - $ref: '#/definitions/Error' - 412: - description: | - Precondition Failed. - The request has not been performed because one of the preconditions is not met. - schema: - $ref: '#/definitions/Error' - -###################################################### -# The "Update Permission" Processing Function resource API -###################################################### - '/tiers/update-permission': - -#----------------------------------------------------- -# Update the permission of a certain tier -#----------------------------------------------------- - post: - x-scope: apim:tier_manage - x-wso2-curl: "curl -k -H \"Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8\" -H \"Content-Type: application/json\" -X POST -d @data.json \"https://localhost:9443/api/am/publisher/v0.12/tiers/update-permission?tierName=Bronze&tierLevel=api\"" - x-wso2-request: "POST https://localhost:9443/api/am/publisher/v0.12/tiers/update-permission?tierName=Bronze&tierLevel=api\nAuthorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8\nContent-Type: application/json\n\n{\n \"permissionType\":\"deny\",\n \"roles\": [\"Internal/everyone\",\"admin\"]\n}" - x-wso2-response: "HTTP/1.1 200 OK" - summary: Update tier permission + $ref: '#/components/responses/NotFound' + security: + - OAuth2Security: + - apim:api_publish + x-code-samples: + - lang: Curl + source: curl -k -X DELETE -H "Authorization:Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" + "https://localhost:9443/api/am/publisher/v1/apis/e93fb282-b456-48fc-8981-003fb89086ae/comments/d4cf1704-5d09-491c-bc48-4d19ce6ea9b4" + + /apis/{apiId}/comments/{commentId}/replies: + get: + tags: + - Comments + summary: Get replies of a comment description: | - This operation can be used to update tier permissions which controls access for the particular tier based on the subscribers' roles. + Get replies of a comment + operationId: getRepliesOfComment parameters: - - $ref: '#/parameters/tierName-Q' - - $ref: '#/parameters/tierLevel-Q' - - $ref: '#/parameters/If-Match' - - $ref: '#/parameters/If-Unmodified-Since' - - in: body - name: permissions - schema: - $ref: '#/definitions/TierPermission' - tags: - - Throttling Tier (Individual) + - $ref: '#/components/parameters/commentId' + - $ref: '#/components/parameters/apiId' + - $ref: '#/components/parameters/requestedTenant' + - $ref: '#/components/parameters/limit' + - $ref: '#/components/parameters/offset' + - $ref: '#/components/parameters/If-None-Match' + - $ref: '#/components/parameters/includeCommenterInfo' responses: 200: description: | OK. - Successfully updated tier permissions - schema: - type: array - items: - $ref: '#/definitions/Tier' + Comment returned. headers: ETag: description: | - Entity Tag of the modified tier. - Used by caches, or in conditional requests (Will be supported in future). - type: string + Entity Tag of the response resource. + Used by caches, or in conditional requests. + schema: + type: string Last-Modified: description: | - Date and time the tier has been modified. - Used by caches, or in conditional requests (Will be supported in future). - type: string - 400: - description: | - Bad Request. - Invalid request or validation error. - schema: - $ref: '#/definitions/Error' - 403: + Date and time the resource has been modifed the last time. + Used by caches, or in conditional requests. + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/CommentList' + 304: description: | - Forbidden. - The request must be conditional but no condition has been specified. - schema: - $ref: '#/definitions/Error' + Not Modified. + Empty body because the client has already the latest version of the requested resource. + content: {} + 401: + $ref: '#/components/responses/Unauthorized' 404: + $ref: '#/components/responses/NotFound' + 406: + $ref: '#/components/responses/NotAcceptable' + security: + - OAuth2Security: [] + x-code-samples: + - lang: Curl + source: curl -k "https://localhost:9443/api/am/publisher/v1/apis/e93fb282-b456-48fc-8981-003fb89086ae/comments/d4cf1704-5d09-491c-bc48-4d19ce6ea9b4" + + /apis/import-openapi: + post: + tags: + - APIs + summary: Import an OpenAPI Definition + description: | + This operation can be used to create an API from an OpenAPI definition. Provide either `url` or `file` + to specify the definition. + + Specify additionalProperties with **at least** API's name, version, context and endpointConfig. + operationId: importOpenAPIDefinition + requestBody: + content: + multipart/form-data: + schema: + properties: + file: + type: string + description: Definition to upload as a file + format: binary + url: + type: string + description: Definition url + additionalProperties: + type: string + description: Additional attributes specified as a stringified JSON with API's schema + responses: + 201: description: | - Not Found. - Requested tier does not exist. - schema: - $ref: '#/definitions/Error' - 412: + Created. + Successful response with the newly created object as entity in the body. + Location header contains URL of newly created entity. + headers: + ETag: + description: | + Entity Tag of the response resource. Used by caches, or in conditional requests (Will be supported in future). + schema: + type: string + Location: + description: | + The URL of the newly created resource. + schema: + type: string + Content-Type: + description: | + The content type of the body. + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/API' + 400: + $ref: '#/components/responses/BadRequest' + 415: + $ref: '#/components/responses/UnsupportedMediaType' + security: + - OAuth2Security: + - apim:api_create + x-code-samples: + - lang: Curl + source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" + -F file=@openapi.json -F additionalProperties=@data.json "https://127.0.0.1:9443/api/am/publisher/v2/apis/import-openapi"' + x-examples: + $ref: docs/examples/apis/import_openapi_post.yaml + + /apis/import-wsdl: + post: + tags: + - APIs + summary: Import a WSDL Definition + description: | + This operation can be used to create an API using a WSDL definition. Provide either `url` or `file` + to specify the definition. + + WSDL can be speficied as a single file or a ZIP archive with WSDLs and reference XSDs etc. + Specify additionalProperties with **at least** API's name, version, context and endpointConfig. + operationId: importWSDLDefinition + requestBody: + content: + multipart/form-data: + schema: + properties: + file: + type: string + description: | + WSDL definition as a file or archive + + **Sample cURL to Upload WSDL File** + + curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" -F file=@api.wsdl -F additionalProperties=@data.json "https://127.0.0.1:9443/api/am/publisher/v2/apis/import-wsdl" + + **Sample cURL to Upload WSDL Archive** + + curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" -F file="@wsdl.zip;type=application/zip" -F additionalProperties=@data.json "https://127.0.0.1:9443/api/am/publisher/v2/apis/import-wsdl" + format: binary + url: + type: string + description: WSDL Definition url + additionalProperties: + type: string + description: Additional attributes specified as a stringified JSON + with API's schema + implementationType: + type: string + description: | + If 'SOAP' is specified, the API will be created with only one resource 'POST /*' which is to be used for SOAP + operations. + + If 'HTTP_BINDING' is specified, the API will be created with resources using HTTP binding operations + which are extracted from the WSDL. + default: SOAP + enum: + - SOAPTOREST + - SOAP + responses: + 201: description: | - Precondition Failed. - The request has not been performed because one of the preconditions is not met. - schema: - $ref: '#/definitions/Error' - - -###################################################### -# The "Environment Collection" resource API -###################################################### - /environments: - -#----------------------------------------------------- -# Retrieve the list of environments configured for a certain API -#----------------------------------------------------- - get: - x-scope: apim:api_view - x-wso2-curl: "curl -k -H \"Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8\" \"https://localhost:9443/api/am/publisher/v0.12/environments\"" - x-wso2-request: | - GET https://localhost:9443/api/am/publisher/v0.12/environments - Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8 - x-wso2-response: "HTTP/1.1 200 OK\nContent-Type: application/json\n\n{\n \"list\": [ {\n \"showInApiConsole\": true,\n \"serverUrl\": \"https://localhost:9443/services/\",\n \"endpoints\": {\n \"http\": \"http://localhost:8280\",\n \"https\": \"https://localhost:8243\"\n },\n \"name\": \"Production and Sandbox\",\n \"type\": \"hybrid\"\n }],\n \"count\": 1\n}" - summary: Get all gateway environments + Created. + Successful response with the newly created object as entity in the body. + Location header contains URL of newly created entity. + headers: + ETag: + description: | + Entity Tag of the response resource. Used by caches, or in conditional requests (Will be supported in future). + schema: + type: string + Location: + description: | + The URL of the newly created resource. + schema: + type: string + Content-Type: + description: | + The content type of the body. + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/API' + 400: + $ref: '#/components/responses/BadRequest' + 415: + $ref: '#/components/responses/UnsupportedMediaType' + security: + - OAuth2Security: + - apim:api_create + x-code-samples: + - lang: Curl + source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" + -F file=@api.wsdl -F additionalProperties=@data.json "https://127.0.0.1:9443/api/am/publisher/v2/apis/import-wsdl"' + x-examples: + $ref: docs/examples/apis/wsdl/import_wsdl_post.yaml + + /apis/import-graphql-schema: + post: + tags: + - APIs + summary: Import API Definition description: | - This operation can be used to retrieve the list of gateway environments available. + This operation can be used to create api from api definition.APIMgtDAOTest + + API definition is GraphQL Schema parameters: - - $ref: '#/parameters/apiId-Q' + - name: If-Match + in: header + description: | + Validator for conditional requests; based on ETag. + schema: + type: string + requestBody: + content: + multipart/form-data: + schema: + properties: + type: + type: string + description: Definition type to upload + file: + type: string + description: Definition to uploads a file + format: binary + additionalProperties: + type: string + description: Additional attributes specified as a stringified JSON + with API's schema + responses: + 201: + description: | + Created. + Successful response with the newly created object as entity in the body. + Location header contains URL of newly created entity. + headers: + ETag: + description: | + Entity Tag of the response resource. Used by caches, or in conditional requests (Will be supported in future). + schema: + type: string + Location: + description: | + The URL of the newly created resource. + schema: + type: string + Content-Type: + description: | + The content type of the body. + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/API' + 400: + $ref: '#/components/responses/BadRequest' + 415: + $ref: '#/components/responses/UnsupportedMediaType' + security: + - OAuth2Security: + - apim:api_create + x-code-samples: + - lang: Curl + source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" + -F file=@schema.graphql -F additionalProperties=@data.json "https://127.0.0.1:9443/api/am/publisher/v2/apis/import-graphql-schema"' + operationId: importGraphQLSchema + + /apis/validate-openapi: + post: tags: - - Environment (Collection) + - Validation + summary: Validate an OpenAPI Definition + description: | + This operation can be used to validate an OpenAPI definition and retrieve a summary. Provide either `url` + or `file` to specify the definition. + operationId: validateOpenAPIDefinition + parameters: + - name: returnContent + in: query + description: | + Specify whether to return the full content of the OpenAPI definition in the response. This is only + applicable when using url based validation + schema: + type: boolean + default: false + requestBody: + content: + multipart/form-data: + schema: + properties: + url: + type: string + description: OpenAPI definition url + file: + type: string + description: OpenAPI definition as a file + format: binary responses: 200: description: | OK. - Environment list is returned. + API definition validation information is returned + headers: + Content-Type: + description: | + The content type of the body. + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/OpenAPIDefinitionValidationResponse' + 400: + $ref: '#/components/responses/BadRequest' + 404: + $ref: '#/components/responses/NotFound' + security: + - OAuth2Security: + - apim:api_create + x-code-samples: + - lang: Curl + source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" + -F file=@openapi.json "https://127.0.0.1:9443/api/am/publisher/v2/apis/validate-openapi"' + x-examples: + $ref: docs/examples/apis/validate_openapi_post.yaml + + /apis/validate-endpoint: + post: + tags: + - Validation + summary: Check Whether Given Endpoint URL is Valid + description: | + Using this operation, it is possible check whether the given API endpoint url is a valid url + operationId: validateEndpoint + parameters: + - name: endpointUrl + in: query + description: API endpoint url + required: true + schema: + type: string + - name: apiId + in: query schema: - $ref: '#/definitions/EnvironmentList' + type: string + responses: + 200: + description: | + OK. + API definition validation information is returned headers: Content-Type: description: | The content type of the body. - type: string - ETag: + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/ApiEndpointValidationResponse' + 400: + $ref: '#/components/responses/BadRequest' + 404: + $ref: '#/components/responses/NotFound' + security: + - OAuth2Security: + - apim:api_create + x-code-samples: + - lang: Curl + source: 'curl -k -X POST -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" + "https://127.0.0.1:9443/api/am/publisher/v2/apis/validate-endpoint?apiId=e0824883-3e86-403a-aec1-22bbc454eb7c&endpointUrl=https%3A%2F%2Flocalhost%3A9443%2Fam%2Fsample%2Fpizzashack%2Fv1%2Fapi%2F"' + + /apis/validate: + post: + tags: + - Validation + summary: Check Given API Context Name already Exists + description: | + Using this operation, you can check a given API context is already used. You need to provide the context name you want to check. + operationId: validateAPI + parameters: + - name: query + in: query + description: | + **Search condition**. + + You can search in attributes by using an **":"** modifier. + + Eg. + "name:wso2" will match an API if the provider of the API is exactly "wso2". + + Supported attribute modifiers are [** version, context, name **] + + If no advanced attribute modifier has been specified, search will match the + given query string against API Name. + required: true + schema: + type: string + - $ref: '#/components/parameters/If-None-Match' + responses: + 200: + description: | + OK. + API definition validation information is returned + headers: + Content-Type: description: | - Entity Tag of the response resource. - Used by caches, or in conditional requests (Will be supported in future). - type: string - 304: + The content type of the body. + schema: + type: string + content: {} + 400: + $ref: '#/components/responses/BadRequest' + 404: + $ref: '#/components/responses/NotFound' + security: + - OAuth2Security: + - apim:api_create + x-code-samples: + - lang: Curl + source: 'curl -k -X POST -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" + "https://127.0.0.1:9443/api/am/publisher/v2/apis/validate?query=name%3Awso2"' + x-examples: + $ref: docs/examples/apis/apis_validate.yaml + + /apis/validate-wsdl: + post: + tags: + - Validation + summary: Validate a WSDL Definition + description: | + This operation can be used to validate a WSDL definition and retrieve a summary. Provide either `url` + or `file` to specify the definition. + operationId: validateWSDLDefinition + requestBody: + content: + multipart/form-data: + schema: + properties: + url: + type: string + description: Definition url + file: + type: string + description: Definition to upload as a file + format: binary + responses: + 200: description: | - Not Modified. - Empty body because the client has already the latest version of the requested resource (Will be supported in future). + OK. + API definition validation information is returned + headers: + Content-Type: + description: | + The content type of the body. + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/WSDLValidationResponse' + 400: + $ref: '#/components/responses/BadRequest' 404: + $ref: '#/components/responses/NotFound' + security: + - OAuth2Security: + - apim:api_create + x-code-samples: + - lang: Curl + source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" + -F file=@api.wsdl "https://127.0.0.1:9443/api/am/publisher/v2/apis/validate-wsdl"' + x-examples: + $ref: docs/examples/apis/wsdl/validate_wsdl_post.yaml + + /apis/validate-graphql-schema: + post: + tags: + - Validation + summary: Validate GraphQL API Definition and Retrieve a Summary + description: | + This operation can be used to validate a graphQL definition and retrieve a summary. + requestBody: + content: + multipart/form-data: + schema: + required: + - file + properties: + file: + type: string + description: Definition to upload as a file + format: binary + required: true + responses: + 200: description: | - Not Found. - Requested API does not exist. - schema: - $ref: '#/definitions/Error' - /policies/mediation: - -#----------------------------------------------------------------------------------------- -# Retrieving the list of all global mediation sequences under a given search condition -#----------------------------------------------------------------------------------------- + OK. + API definition validation information is returned + headers: + Content-Type: + description: | + The content type of the body. + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/GraphQLValidationResponse' + 400: + $ref: '#/components/responses/BadRequest' + 404: + $ref: '#/components/responses/NotFound' + security: + - OAuth2Security: + - apim:api_create + x-code-samples: + - lang: Curl + source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" + -F file=@schema.graphql "https://127.0.0.1:9443/api/am/publisher/v2/apis/validate-graphql-schema"' + operationId: validateGraphQLSchema + + /apis/{apiId}/graphql-schema: get: - x-scope: apim:mediation_policy_view - x-wso2-curl: "curl -k -H \"Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8\" https://localhost:9443/api/am/publisher/v0.12/policies/mediation" - x-wso2-request: | - GET https://localhost:9443/api/am/publisher/v0.12/policies/mediation - Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8 - x-wso2-response: "HTTP/1.1 200 OK\r\nContent-Type: application/json\r\n\r\n{\r\n \"count\": 10,\r\n \"next\": null,\r\n \"previous\": null,\r\n \"list\": [\r\n {\r\n \"name\": \"debug_json_fault\",\r\n \"id\": \"563de8f3-dd1d-4ec7-afc2-d158c663ed34\",\r\n \"type\": \"fault\"\r\n },\r\n {\r\n \"name\": \"json_fault\",\r\n \"id\": \"f9c36f4d-a2b6-41e7-b311-d358a47916be\",\r\n \"type\": \"fault\"\r\n },\r\n {\r\n \"name\": \"json_to_xml_in_message\",\r\n \"id\": \"3921225b-7918-4b95-a851-22c4e4e3e911\",\r\n \"type\": \"in\"\r\n },\r\n {\r\n \"name\": \"debug_in_flow\",\r\n \"id\": \"2bc15f93-4455-4763-89b8-83600fb9d731\",\r\n \"type\": \"in\"\r\n },\r\n {\r\n \"name\": \"log_in_message\",\r\n \"id\": \"4d287cca-76ab-44ca-b22e-919fc27c50e3\",\r\n \"type\": \"in\"\r\n },\r\n {\r\n \"name\": \"preserve_accept_header\",\r\n \"id\": \"3776b215-b3bc-40b6-bdcb-06efa7de64be\",\r\n \"type\": \"in\"\r\n },\r\n {\r\n \"name\": \"xml_to_json_in_message\",\r\n \"id\": \"50ac2002-769e-4f90-8549-6d0248dff7d2\",\r\n \"type\": \"in\"\r\n },\r\n {\r\n \"name\": \"xml_to_json_out_message\",\r\n \"id\": \"2af75853-ed75-4d25-81aa-0ebbeca691ea\",\r\n \"type\": \"out\"\r\n },\r\n {\r\n \"name\": \"json_to_xml_out_message\",\r\n \"id\": \"d9fa3ffc-f6b6-4171-ab97-eb44196cb66e\",\r\n \"type\": \"out\"\r\n },\r\n {\r\n \"name\": \"debug_out_flow\",\r\n \"id\": \"260b7701-4071-46bd-9b66-900ac6fffed6\",\r\n \"type\": \"out\"\r\n },\r\n {\r\n \"name\": \"apply_accept_header\",\r\n \"id\": \"15c17c2f-33e3-4c37-a262-04dfa49983a4\",\r\n \"type\": \"out\"\r\n },\r\n {\r\n \"name\": \"log_out_message\",\r\n \"id\": \"d37dca41-c048-492a-82cf-9a2292c6fff0\",\r\n \"type\": \"out\"\r\n }\r\n ]\r\n}" - summary: | - Get all global level mediation policies + tags: + - GraphQL Schema (Individual) + summary: Get the Schema of a GraphQL API description: | - This operation provides you a list of available all global level mediation policies. + This operation can be used to retrieve the Schema definition of a GraphQL API. parameters: - - $ref : '#/parameters/limit' - - $ref : '#/parameters/offset' - - name : query - in: query - description: "-Not supported yet-" - type: string - - $ref : "#/parameters/Accept" - - $ref : "#/parameters/If-None-Match" - tags: - - Mediation Policy (Collection) + - $ref: '#/components/parameters/apiId' + - $ref: '#/components/parameters/Accept' + - $ref: '#/components/parameters/If-None-Match' responses: 200: description: | OK. - List of mediation policies is returned. - schema: - $ref: '#/definitions/mediationList' + Requested GraphQL Schema DTO object belongs to the API headers: - Content-Type: - description: The content type of the body. - type: string ETag: description: | Entity Tag of the response resource. Used by caches, or in conditional requests (Will be supported in future). - type: string + schema: + type: string + Last-Modified: + description: | + Date and time the resource has been modifed the last time. + Used by caches, or in conditional requests (Will be supported in future). + schema: + type: string + Content-Type: + description: | + The content type of the body. + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/GraphQLSchema' 304: description: | Not Modified. Empty body because the client has already the latest version of the requested resource (Will be supported in future). + content: {} + 404: + $ref: '#/components/responses/NotFound' 406: - description: | - Not Acceptable. - The requested media type is not supported - schema: - $ref: '#/definitions/Error' + $ref: '#/components/responses/NotAcceptable' + security: + - OAuth2Security: + - apim:api_view + x-code-samples: + - lang: Curl + source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" + "https://127.0.0.1:9443/api/am/publisher/v2/apis/e0824883-3e86-403a-aec1-22bbc454eb7c/graphql-schema"' + operationId: getAPIGraphQLSchema - - -###################################################### -# The "Workflow approval" resource API -###################################################### - /workflows/update-workflow-status: - -#------------------------------------------------------------------- -# Resume the workflow by approving or rejecting the workflow request -#------------------------------------------------------------------- - post: - x-scope: apim:api_workflow - x-wso2-curl: "curl -k -H \"Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8\" -H \"Content-Type: application/json\" -X POST -d @data.json \"https://localhost:9443/api/am/publisher/v0.12/workflows/update-workflow-status?workflowReferenceId=56e3a170-a7a7-45f8-b051-7e43a58a67e1\"" - x-wso2-request: "POST https://localhost:9443/api/am/publisher/v0.12/workflows/update-workflow-status?workflowReferenceId=56e3a170-a7a7-45f8-b051-7e43a58a67e1\nAuthorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8\nContent-Type: application/json\n\n{\n \"status\" : \"APPROVED\",\n \"attributes\" : {\n \"apiCurrentState\": \"Created\",\n \"apiLCAction\": \"Publish\",\n \"apiName\":\"APIname\",\n \"apiVersion\" : \"1.0.0\",\n \"apiProvider\" : \"admin\",\n \"invoker\": \"admin\"\n }\n}" - x-wso2-response: "HTTP/1.1 200 OK" - summary: Update workflow status + put: + tags: + - GraphQL Schema + summary: Add a Schema to a GraphQL API description: | - This operation can be used to approve or reject a workflow task. + This operation can be used to add a GraphQL Schema definition to an existing GraphQL API. parameters: - - $ref: '#/parameters/workflowReferenceId-Q' - - in: body - name: body - description: | - Workflow event that need to be updated - required: true - schema: - $ref: '#/definitions/Workflow' - tags: - - Workflows (Individual) + - $ref: '#/components/parameters/apiId' + - $ref: '#/components/parameters/If-Match' + requestBody: + content: + multipart/form-data: + schema: + required: + - schemaDefinition + properties: + schemaDefinition: + type: string + description: schema definition of the GraphQL API + required: true responses: 200: description: | OK. - Workflow request information is returned. - schema: - $ref: '#/definitions/Workflow' + Successful response with updated schema definition headers: + ETag: + description: | + Entity Tag of the response resource. Used by cache, or in conditional requests (Will be supported in future). + schema: + type: string + Last-Modified: + description: | + Date and time the resource has been modifed the last time. + Used by caches, or in conditional requests (Will be supported in future). + schema: + type: string + Location: + description: | + The URL of the newly created resource. + schema: + type: string Content-Type: description: | The content type of the body. - type: string + schema: + type: string + content: {} 400: + $ref: '#/components/responses/BadRequest' + 403: + $ref: '#/components/responses/Forbidden' + 404: + $ref: '#/components/responses/NotFound' + 412: + $ref: '#/components/responses/PreconditionFailed' + security: + - OAuth2Security: + - apim:api_create + x-code-samples: + - lang: Curl + source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" + -F schemaDefinition=@schema.graphql "https://127.0.0.1:9443/api/am/publisher/v2/apis/e0824883-3e86-403a-aec1-22bbc454eb7c/graphql-schema"' + operationId: updateAPIGraphQLSchema + + /apis/{apiId}/amznResourceNames: + get: + tags: + - AWS Lambda (Individual) + summary: Retrieve the ARNs of AWS Lambda Functions + description: | + This operation can be use to retrieve ARNs of AWS Lambda function for a given AWS credentials. + parameters: + - $ref: '#/components/parameters/apiId' + responses: + 200: description: | - Bad Request. - Invalid request or validation error. - schema: - $ref: '#/definitions/Error' + OK. + Requested ARN List of the API is returned + headers: + Content-Type: + description: | + The content type of the body. + schema: + type: string + content: + application/json: + schema: + type: string + example: |- + { + "count": "2", + "list": [ + "arn:aws:lambda:us-west-2:123456789012:function:my-function1", + "arn:aws:lambda:us-west-2:123456789012:function:my-function2" + ] + } 404: + $ref: '#/components/responses/NotFound' + security: + - OAuth2Security: + - apim:api_view + x-code-samples: + - lang: Curl + source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" + "https://127.0.0.1:9443/api/am/publisher/v2/apis/e0824883-3e86-403a-aec1-22bbc454eb7c/amznResourceNames"' + x-examples: + $ref: docs/examples/apis/apis_id_amznresourcenames_get.yaml + operationId: getAmazonResourceNamesOfAPI + + /apis/{apiId}/monetize: + post: + tags: + - API Monetization + summary: Configure Monetization for a Given API + description: | + This operation can be used to configure monetization for a given API. + parameters: + - $ref: '#/components/parameters/apiId' + requestBody: + description: Monetization data object + content: + application/json: + schema: + $ref: '#/components/schemas/APIMonetizationInfo' + required: true + responses: + 201: description: | - Not Found. - Workflow for the given reference in not found. - schema: - $ref: '#/definitions/Error' -###################################################### -# Parameters - required by some of the APIs above -###################################################### -parameters: - -# API Identifier -# Specified as part of the path expression - apiId: - name: apiId - in: path - description: | - **API ID** consisting of the **UUID** of the API. Using the **UUID** in the API call is recommended. - The combination of the provider of the API, name of the API and the version is also accepted as a valid API ID. - Should be formatted as **provider-name-version**. - required: true - type: string - x-encoded: true - -# API Identifier -# Specified as part of the query string - apiId-Q: - name: apiId - in: query - description: | - **API ID** consisting of the **UUID** of the API. Using the **UUID** in the API call is recommended. - The combination of the provider of the API, name of the API and the version is also accepted as a valid API I. - Should be formatted as **provider-name-version**. - required: true - type: string - x-encoded: true - - -# Document Identifier -# Specified as part of the path expression - documentId: - name: documentId - in: path - description: | - Document Identifier - required: true - type: string - -# Application Identifier -# Specified as part of the path expression - applicationId: - name: applicationId - in: path - description: | - **Application Identifier** consisting of the UUID of the Application. - required: true - type: string - -# Subscription Identifier -# Specified as part of the path expression - subscriptionId: - name: subscriptionId - in: path - description: | - Subscription Id - required: true - type: string - -# Mediation policy identifier -# Specified as part of the path expression - mediationPolicyId: - name: mediationPolicyId - in: path - description: | - Mediation policy Id - required: true - type: string - - - -# Subscription Identifier -# Specified as part of the query string - subscriptionId-Q: - name: subscriptionId - in: query - description: | - Subscription Id - required: true - type: string - -# Tier Name -# Specified as part of the path expression - tierName: - name: tierName - in: path - description: | - Tier name - required: true - type: string - -# Tier Name -# Specified as part of the query string - tierName-Q: - name: tierName - in: query - description: | - Name of the tier - required: true - type: string - -# Tier Type -# Specified as part of the path expression - tierLevel: - name: tierLevel - in: path - description: | - List API or Application or Resource type tiers. - type: string - enum: - - api - - application - - resource - required: true - -# Tier Type -# Specified as part of the path expression - tierLevel-A: - name: tierLevel - in: path - description: | - List API or Application or Resource type tiers. - type: string - enum: - - api - required: true - -# Tier Type -# Specified as part of the query string - tierLevel-Q: - name: tierLevel - in: query - description: | - List API or Application or Resource type tiers. - type: string - enum: - - api - - application - - resource - required: true - -# Used for pagination: -# The maximum number of resoures to be returned by a GET - limit: - name: limit - in: query - description: | - Maximum length of resource array to return. - default: 25 - type: integer - -# Used for pagination: -# The order number of an instance in a qualified set of resoures -# at which to start to return the next batch of qualified resources - offset: - name: offset - in: query - description: | - Starting point within the complete list of items qualified. - default: 0 - type: integer - -# The HTTP Accept header - Accept: - name: Accept - in: header - description: | - Media types acceptable for the response. Default is application/json. - default: application/json - type: string - -# The HTTP Content-Type header - Content-Type: - name: Content-Type - in: header - description: | - Media type of the entity in the body. Default is application/json. - default: application/json - required: true - type : string - -# The HTTP Authorization header - Authorization: - name: Authorization - in: header - description: | - Holds the bearer token for apis that require authentication. - required: true - type : string - -# The HTTP If-None-Match header -# Used to avoid retrieving data that are already cached - If-None-Match: - name: If-None-Match - in: header - description: | - Validator for conditional requests; based on the ETag of the formerly retrieved - variant of the resource (Will be supported in future). - type : string - -# The HTTP If-Modified-Since header -# Used to avoid retrieving data that are already cached - If-Modified-Since: - name: If-Modified-Since - in: header - description: | - Validator for conditional requests; based on Last Modified header of the - formerly retrieved variant of the resource (Will be supported in future). - type: string - -# The HTTP If-Match header -# Used to avoid concurrent updates - If-Match: - name: If-Match - in: header - description: | - Validator for conditional requests; based on ETag (Will be supported in future). - type: string - -# The HTTP If-Unmodified-Since header -# Used to avoid concurrent updates - If-Unmodified-Since: - name: If-Unmodified-Since - in: header - description: | - Validator for conditional requests; based on Last Modified header (Will be supported in future). - type: string - - -# Workflow reference ID -# Specified as part of the path expression - workflowReferenceId-Q: - name: workflowReferenceId - in: query - description: | - Workflow reference id - required: true - type: string - -###################################################### -# The resources used by some of the APIs above within the message body -###################################################### -definitions: - -#----------------------------------------------------- -# The API List resource -#----------------------------------------------------- - APIList: - title: API List - properties: - count: - type: integer - description: | - Number of APIs returned. - example: 1 - next: - type: string - description: | - Link to the next subset of resources qualified. - Empty if no more resources are to be returned. - example: "/apis?limit=1&offset=2&query=" - previous: - type: string - description: | - Link to the previous subset of resources qualified. - Empty if current subset is the first subset returned. - example: "/apis?limit=1&offset=0&query=" - list: - type: array - items: - $ref: '#/definitions/APIInfo' - pagination: + OK. + Monetization status changed successfully. + content: {} + 400: + $ref: '#/components/responses/BadRequest' + 404: + $ref: '#/components/responses/NotFound' + 406: + $ref: '#/components/responses/NotAcceptable' + security: + - OAuth2Security: + - apim:api_publish + x-code-samples: + - lang: Curl + source: 'curl -k -X POST -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" + -H "Content-Type: application/json" -d @data.json https://127.0.0.1:9443/api/am/publisher/v2/apis/96077508-fd01-4fae-bc64-5de0e2baf43c/monetize' + operationId: addAPIMonetization + + /apis/{apiId}/monetization: + get: + tags: + - API Monetization + summary: Get Monetization Status for each Tier in a Given API + description: | + This operation can be used to get monetization status for each tier in a given API + parameters: + - $ref: '#/components/parameters/apiId' + responses: + 200: + description: | + OK. + Monetization status for each tier returned successfully. + content: {} + 400: + $ref: '#/components/responses/BadRequest' + 404: + $ref: '#/components/responses/NotFound' + 406: + $ref: '#/components/responses/NotAcceptable' + security: + - OAuth2Security: + - apim:api_publish + x-code-samples: + - lang: Curl + source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" + "https://127.0.0.1:9443/api/am/publisher/v2/apis/96077508-fd01-4fae-bc64-5de0e2baf43c/monetize"' + operationId: getAPIMonetization + + /apis/{apiId}/revenue: + get: + tags: + - API Monetization + summary: Get Total Revenue Details of a Given Monetized API with Meterd Billing + description: | + This operation can be used to get details of total revenue details of a given monetized API with meterd billing. + parameters: + - $ref: '#/components/parameters/apiId' + responses: + 200: + description: | + OK. + Details of a total revenue returned. + headers: + ETag: + description: Entity Tag of the response resource. Used by caches, or + in conditional requests (Will be supported in future). + schema: + type: string + Last-Modified: + description: Date and time the resource has been modified the last time. + Used by caches, or in conditional requests (Will be supported in future). + schema: + type: string + Content-Type: + description: The content type of the body. + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/APIRevenue' + 304: + description: | + Not Modified. + Empty body because the client has already the latest version of the requested resource (Will be supported in future). + content: {} + 404: + $ref: '#/components/responses/NotFound' + security: + - OAuth2Security: + - apim:api_publish + x-code-samples: + - lang: Curl + source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" + "https://127.0.0.1:9443/api/am/publisher/v2/apis/96077508-fd01-4fae-bc64-5de0e2baf43c/revenue"' + operationId: getAPIRevenue + + /apis/{apiId}/documents: + get: + tags: + - API Documents + summary: Get a List of Documents of an API + description: | + This operation can be used to retrieve a list of documents belonging to an API by providing the id of the API. + parameters: + - $ref: '#/components/parameters/apiId' + - $ref: '#/components/parameters/limit' + - $ref: '#/components/parameters/offset' + - $ref: '#/components/parameters/If-None-Match' + responses: + 200: + description: | + OK. + Document list is returned. + headers: + ETag: + description: | + Entity Tag of the response resource. Used by caches, or in conditional requests (Will be supported in future). + schema: + type: string + Content-Type: + description: | + The content type of the body. + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/DocumentList' + 304: + description: | + Not Modified. + Empty body because the client has already the latest version of the requested resource (Will be supported in future). + content: {} + 404: + $ref: '#/components/responses/NotFound' + 406: + $ref: '#/components/responses/NotAcceptable' + security: + - OAuth2Security: + - apim:api_view + x-code-samples: + - lang: Curl + source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" + "https://127.0.0.1:9443/api/am/publisher/v2/apis/e0824883-3e86-403a-aec1-22bbc454eb7c/documents"' + operationId: getAPIDocuments + + post: + tags: + - API Documents + summary: Add a New Document to an API + description: | + This operation can be used to add a new documentation to an API. This operation only adds the metadata of a document. To add the actual content we need to use **Upload the content of an API document ** API once we obtain a document Id by this operation. + parameters: + - $ref: '#/components/parameters/apiId' + - $ref: '#/components/parameters/If-Match' + requestBody: + description: Document object that needs to be added + content: + application/json: + schema: + $ref: '#/components/schemas/Document' + required: true + responses: + 201: + description: | + Created. + Successful response with the newly created Document object as entity in the body. + Location header contains URL of newly added document. + headers: + ETag: + description: | + Entity Tag of the response resource. + Used by caches, or in conditional requests (Will be supported in future). + schema: + type: string + Location: + description: | + Location to the newly created Document. + schema: + type: string + Content-Type: + description: | + The content type of the body. + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/Document' + 400: + $ref: '#/components/responses/BadRequest' + 415: + $ref: '#/components/responses/UnsupportedMediaType' + security: + - OAuth2Security: + - apim:api_create + - apim:document_create + x-code-samples: + - lang: Curl + source: 'curl -k -X POST -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" + -H "Content-Type: application/json" -d @data.json "https://127.0.0.1:9443/api/am/publisher/v2/apis/96077508-fd01-4fae-bc64-5de0e2baf43c/documents"' + operationId: addAPIDocument + + /apis/{apiId}/documents/{documentId}: + get: + tags: + - API Documents + summary: Get a Document of an API + description: | + This operation can be used to retrieve a particular document's metadata associated with an API. + parameters: + - $ref: '#/components/parameters/apiId' + - $ref: '#/components/parameters/documentId' + - $ref: '#/components/parameters/If-None-Match' + responses: + 200: + description: | + OK. + Document returned. + headers: + ETag: + description: | + Entity Tag of the response resource. + Used by caches, or in conditional requests (Will be supported in future). + schema: + type: string + Last-Modified: + description: | + Date and time the resource has been modifed the last time. + Used by caches, or in conditional requests (Will be supported in future). + schema: + type: string + Content-Type: + description: | + The content type of the body. + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/Document' + 304: + description: | + Not Modified. + Empty body because the client has already the latest version of the requested resource (Will be supported in future). + content: {} + 404: + $ref: '#/components/responses/NotFound' + 406: + $ref: '#/components/responses/NotAcceptable' + security: + - OAuth2Security: + - apim:api_view + x-code-samples: + - lang: Curl + source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" + "https://127.0.0.1:9443/api/am/publisher/v2/apis/96077508-fd01-4fae-bc64-5de0e2baf43c/documents/0bcb7f05-599d-4e1a-adce-5cb89bfe58d5"' + operationId: getAPIDocumentByDocumentId + + put: + tags: + - API Documents + summary: Update a Document of an API + description: | + This operation can be used to update metadata of an API's document. + parameters: + - $ref: '#/components/parameters/apiId' + - $ref: '#/components/parameters/documentId' + - $ref: '#/components/parameters/If-Match' + requestBody: + description: Document object that needs to be added + content: + application/json: + schema: + $ref: '#/components/schemas/Document' + required: true + responses: + 200: + description: | + OK. + Document updated + headers: + ETag: + description: | + Entity Tag of the response resource. + Used by caches, or in conditional requests (Will be supported in future). + schema: + type: string + Last-Modified: + description: | + Date and time the resource has been modifed the last time. + Used by caches, or in conditional requests (Will be supported in future). + schema: + type: string + Location: + description: | + The URL of the updated document. + schema: + type: string + Content-Type: + description: | + The content type of the body. + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/Document' + 400: + $ref: '#/components/responses/BadRequest' + 404: + $ref: '#/components/responses/NotFound' + 412: + $ref: '#/components/responses/PreconditionFailed' + security: + - OAuth2Security: + - apim:api_create + - apim:document_manage + x-code-samples: + - lang: Curl + source: 'curl -k -X PUT -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" + -H "Content-Type: application/json" -d @doc.json "https://127.0.0.1:9443/api/am/publisher/v2/apis/96077508-fd01-4fae-bc64-5de0e2baf43c/documents/0bcb7f05-599d-4e1a-adce-5cb89bfe58d5"' + operationId: updateAPIDocument + + delete: + tags: + - API Documents + summary: Delete a Document of an API + description: | + This operation can be used to delete a document associated with an API. + parameters: + - $ref: '#/components/parameters/apiId' + - $ref: '#/components/parameters/documentId' + - $ref: '#/components/parameters/If-Match' + responses: + 200: + description: | + OK. + Resource successfully deleted. + content: {} + 404: + $ref: '#/components/responses/NotFound' + 412: + $ref: '#/components/responses/PreconditionFailed' + security: + - OAuth2Security: + - apim:api_create + - apim:document_manage + x-code-samples: + - lang: Curl + source: 'curl -k -X DELETE -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" + "https://127.0.0.1:9443/api/am/publisher/v2/apis/96077508-fd01-4fae-bc64-5de0e2baf43c/documents/0bcb7f05-599d-4e1a-adce-5cb89bfe58d5"' + operationId: deleteAPIDocument + + /apis/{apiId}/documents/{documentId}/content: + get: + tags: + - API Documents + summary: Get the Content of an API Document + description: | + This operation can be used to retrive the content of an API's document. + + The document can be of 3 types. In each cases responses are different. + + 1. **Inline type**: + The content of the document will be retrieved in `text/plain` content type + + _Sample cURL_ : `curl -k -H "Authorization:Bearer 579f0af4-37be-35c7-81a4-f1f1e9ee7c51" -F inlineContent=@"docs.txt" -X POST "https://localhost:9443/api/am/publisher/v2/apis/995a4972-3178-4b17-a374-756e0e19127c/documents/43c2bcce-60e7-405f-bc36-e39c0c5e189e/content` + 2. **FILE type**: + The file will be downloaded with the related content type (eg. `application/pdf`) + 3. **URL type**: + The client will recieve the URL of the document as the Location header with the response with - `303 See Other` + parameters: + - $ref: '#/components/parameters/apiId' + - $ref: '#/components/parameters/documentId' + - $ref: '#/components/parameters/If-None-Match' + responses: + 200: + description: | + OK. + File or inline content returned. + headers: + ETag: + description: | + Entity Tag of the response resource. + Used by caches, or in conditional requests (Will be supported in future). + schema: + type: string + Last-Modified: + description: | + Date and time the resource has been modifed the last time. + Used by caches, or in conditional requests (Will be supported in future). + schema: + type: string + Content-Type: + description: | + The content type of the body. + schema: + type: string + content: + application/octet-stream: + schema: + type: string + 303: + description: | + See Other. + Source can be retrived from the URL specified at the Location header. + headers: + Location: + description: | + The Source URL of the document. + schema: + type: string + content: {} + 304: + description: | + Not Modified. + Empty body because the client has already the latest version of the requested resource (Will be supported in future). + content: {} + 404: + $ref: '#/components/responses/NotFound' + 406: + $ref: '#/components/responses/NotAcceptable' + security: + - OAuth2Security: + - apim:api_view + x-code-samples: + - lang: Curl + source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" + "https://127.0.0.1:9443/api/am/publisher/v2/apis/96077508-fd01-4fae-bc64-5de0e2baf43c/documents/0bcb7f05-599d-4e1a-adce-5cb89bfe58d5/content"' + operationId: getAPIDocumentContentByDocumentId + + post: + tags: + - API Documents + summary: Upload the Content of an API Document + description: | + Thid operation can be used to upload a file or add inline content to an API document. + + **IMPORTANT:** + * Either **file** or **inlineContent** form data parameters should be specified at one time. + * Document's source type should be **FILE** in order to upload a file to the document using **file** parameter. + * Document's source type should be **INLINE** in order to add inline content to the document using **inlineContent** parameter. + parameters: + - $ref: '#/components/parameters/apiId' + - $ref: '#/components/parameters/documentId' + - $ref: '#/components/parameters/If-Match' + requestBody: + content: + multipart/form-data: + schema: + properties: + file: + type: string + description: Document to upload + format: binary + inlineContent: + type: string + description: Inline content of the document + responses: + 200: + description: | + OK. + Document updated + headers: + ETag: + description: | + Entity Tag of the response resource. + Used by caches, or in conditional requests (Will be supported in future). + schema: + type: string + Last-Modified: + description: | + Date and time the resource has been modifed the last time. + Used by caches, or in conditional requests (Will be supported in future). + schema: + type: string + Location: + description: | + The URL of the updated content of the document. + schema: + type: string + Content-Type: + description: | + The content type of the body. + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/Document' + 400: + $ref: '#/components/responses/BadRequest' + 404: + $ref: '#/components/responses/NotFound' + 412: + $ref: '#/components/responses/PreconditionFailed' + security: + - OAuth2Security: + - apim:api_create + - apim:document_create + x-code-samples: + - lang: Curl + source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" + -F file=@sample.pdf "https://127.0.0.1:9443/api/am/publisher/v2/apis/96077508-fd01-4fae-bc64-5de0e2baf43c/documents/0bcb7f05-599d-4e1a-adce-5cb89bfe58d5/content"' + operationId: addAPIDocumentContent + + /apis/{apiId}/documents/validate: + post: + tags: + - API Documents + summary: Check Whether a Document with the Provided Name Exist + description: | + This operation can be used to verify the document name exists or not. + operationId: validateDocument + parameters: + - $ref: '#/components/parameters/apiId' + - name: name + in: query + description: | + The name of the document which needs to be checked for the existance. + required: true + schema: + type: string + - $ref: '#/components/parameters/If-Match' + responses: + 200: + description: | + OK. + Successful response if the document name exists. + 400: + $ref: '#/components/responses/BadRequest' + 404: + description: | + Not Found. + The specified resource does not exist. + security: + - OAuth2Security: + - apim:api_create + - apim:document_create + x-code-samples: + - lang: Curl + source: 'curl -k -X POST -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" + "https://127.0.0.1:9443/api/am/publisher/v2/apis/96077508-fd01-4fae-bc64-5de0e2baf43c/documents/validate?name=CalculatorDoc"' + x-examples: + $ref: docs/examples/apis/apis_id_document_validate.yaml + + /apis/{apiId}/mediation-policies: + get: + tags: + - API Mediation Policies + summary: | + Get All Mediation Policies of an API + description: | + This operation provides you a list of available mediation policies of an API. + operationId: getAllAPIMediationPolicies + parameters: + - $ref: '#/components/parameters/apiId' + - $ref: '#/components/parameters/limit' + - $ref: '#/components/parameters/offset' + - name: query + in: query + description: -Not supported yet- + schema: + type: string + - $ref: '#/components/parameters/If-None-Match' + responses: + 200: + description: | + OK. + List of qualifying APIs is returned. + headers: + ETag: + description: | + Entity Tag of the response resource. Used by caches, or in conditional requests (Will be supported in future). + schema: + type: string + Content-Type: + description: The content type of the body. + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/MediationList' + 304: + description: | + Not Modified. + Empty body because the client has already the latest version of the requested resource (Will be supported in future). + content: {} + 406: + $ref: '#/components/responses/NotAcceptable' + security: + - OAuth2Security: + - apim:api_view + - apim:mediation_policy_view + x-code-samples: + - lang: Curl + source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" + "https://127.0.0.1:9443/api/am/publisher/v2/apis/96077508-fd01-4fae-bc64-5de0e2baf43c/mediation-policies"' + x-examples: + $ref: docs/examples/mediation-policies/apis_id_mediationpolicies_get.yaml + + post: + tags: + - API Mediation Policies + summary: Add an API Specific Mediation Policy + description: | + This operation can be used to add an API specifc mediation policy. + operationId: addAPIMediationPolicy + parameters: + - $ref: '#/components/parameters/apiId' + - $ref: '#/components/parameters/If-Match' + requestBody: + content: + multipart/form-data: + schema: + required: + - type + properties: + mediationPolicyFile: + type: string + description: Mediation Policy to upload + format: binary + inlineContent: + type: string + description: Inline content of the Mediation Policy + type: + type: string + description: Type of the mediation sequence + required: true + responses: + 201: + description: | + OK. + mediation policy uploaded + headers: + ETag: + description: | + Entity Tag of the response resource. + Used by caches, or in conditional requests (Will be supported in future). + schema: + type: string + Last-Modified: + description: | + Date and time the resource has been modifed the last time. + Used by caches, or in conditional requests (Will be supported in future). + schema: + type: string + Location: + description: | + The URL of the uploaded mediation policy of the API. + schema: + type: string + Content-Type: + description: | + The content type of the body. + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/Mediation' + 400: + $ref: '#/components/responses/BadRequest' + 404: + $ref: '#/components/responses/NotFound' + 412: + $ref: '#/components/responses/PreconditionFailed' + security: + - OAuth2Security: + - apim:api_create + - apim:mediation_policy_create + x-code-samples: + - lang: Curl + source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" + -H "Content-Type: multipart/form-data" -F mediationPolicyFile=@TokenExchange.xml + -F type=in "https://127.0.0.1:9443/api/am/publisher/v2/apis/96077508-fd01-4fae-bc64-5de0e2baf43c/mediation-policies"' + x-examples: + $ref: docs/examples/mediation-policies/apis_id_mediationpolicies_post.yaml + + /apis/{apiId}/mediation-policies/{mediationPolicyId}: + get: + tags: + - API Mediation Policy + summary: Get an API Specific Mediation Policy + description: | + This operation can be used to retrieve a particular API specific mediation policy. + operationId: getAPIMediationPolicyByPolicyId + parameters: + - $ref: '#/components/parameters/apiId' + - $ref: '#/components/parameters/mediationPolicyId' + - $ref: '#/components/parameters/If-None-Match' + responses: + 200: + description: | + OK. + Mediation policy returned. + headers: + ETag: + description: | + Entity Tag of the response resource. + Used by caches, or in conditional requests (Will be supported in future). + schema: + type: string + Last-Modified: + description: | + Date and time the resource has been modifed the last time. + Used by caches, or in conditional requests (Will be supported in future). + schema: + type: string + Content-Type: + description: | + The content type of the body. + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/Mediation' + 304: + description: | + Not Modified. + Empty body because the client has already the latest version of the requested resource (Will be supported in future). + content: {} + 404: + $ref: '#/components/responses/NotFound' + 406: + $ref: '#/components/responses/NotAcceptable' + security: + - OAuth2Security: + - apim:api_view + - apim:mediation_policy_view + x-code-samples: + - lang: Curl + source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" + "https://127.0.0.1:9443/api/am/publisher/v2/apis/96077508-fd01-4fae-bc64-5de0e2baf43c/mediation-policies/f56eb8b4-128c-45aa-ad35-9c87a546261a"' + x-examples: + $ref: docs/examples/mediation-policies/apis_id_mediationpolicies_id_get.yaml + + delete: + tags: + - API Mediation Policy + summary: Delete an API Specific Mediation Policy + description: | + This operation can be used to delete an existing API specific mediation policy providing the Id of the API and the Id of the mediation policy. + operationId: deleteAPIMediationPolicyByPolicyId + parameters: + - $ref: '#/components/parameters/apiId' + - $ref: '#/components/parameters/mediationPolicyId' + - $ref: '#/components/parameters/If-Match' + responses: + 200: + description: | + OK. + Resource successfully deleted. + content: {} + 403: + $ref: '#/components/responses/Forbidden' + 404: + $ref: '#/components/responses/NotFound' + 412: + $ref: '#/components/responses/PreconditionFailed' + security: + - OAuth2Security: + - apim:api_create + - apim:mediation_policy_manage + x-code-samples: + - lang: Curl + source: 'curl -k -X DELETE -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" + "https://127.0.0.1:9443/api/am/publisher/v2/apis/96077508-fd01-4fae-bc64-5de0e2baf43c/mediation-policies/f56eb8b4-128c-45aa-ad35-9c87a546261a"' + x-examples: + $ref: docs/examples/mediation-policies/apis_id_mediationpolicies_id_delete.yaml + + /apis/{apiId}/mediation-policies/{mediationPolicyId}/content: + get: + tags: + - API Mediation Policy + summary: Download an API Specific Mediation Policy + description: | + This operation can be used to download a particular API specific mediation policy. + operationId: getAPIMediationPolicyContentByPolicyId + parameters: + - $ref: '#/components/parameters/apiId' + - $ref: '#/components/parameters/mediationPolicyId' + - $ref: '#/components/parameters/If-None-Match' + responses: + 200: + description: | + OK. + Mediation policy returned. + headers: + ETag: + description: | + Entity Tag of the response resource. + Used by caches, or in conditional requests (Will be supported in future). + schema: + type: string + Last-Modified: + description: | + Date and time the resource has been modifed the last time. + Used by caches, or in conditional requests (Will be supported in future). + schema: + type: string + Content-Type: + description: | + The content type of the body. + schema: + type: string + content: {} + 304: + description: | + Not Modified. + Empty body because the client has already the latest version of the requested resource (Will be supported in future). + content: {} + 404: + $ref: '#/components/responses/NotFound' + security: + - OAuth2Security: + - apim:api_view + - apim:mediation_policy_view + x-code-samples: + - lang: Curl + source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" + "https://127.0.0.1:9443/api/am/publisher/v2/apis/96077508-fd01-4fae-bc64-5de0e2baf43c/mediation-policies/f56eb8b4-128c-45aa-ad35-9c87a546261a/content"' + x-examples: + $ref: docs/examples/mediation-policies/apis_id_mediationpolicies_id_content_get.yaml + + put: + tags: + - API Mediation Policy + summary: Update an API Specific Mediation Policy + description: | + This operation can be used to update an existing mediation policy of an API. + operationId: updateAPIMediationPolicyContentByPolicyId + parameters: + - $ref: '#/components/parameters/apiId' + - $ref: '#/components/parameters/mediationPolicyId' + - $ref: '#/components/parameters/If-Match' + requestBody: + content: + multipart/form-data: + schema: + required: + - type + properties: + file: + type: string + description: Mediation Policy to upload + format: binary + inlineContent: + type: string + description: Inline content of the Mediation Policy + type: + type: string + description: Type of the mediation sequence(in/out/fault) + required: true + responses: + 200: + description: | + OK. + Successful response with updated API object + headers: + ETag: + description: | + Entity Tag of the response resource. Used by caches, or in conditional requests (Will be supported in future). + schema: + type: string + Last-Modified: + description: | + Date and time the resource has been modifed the last time. + Used by caches, or in conditional requests (Will be supported in future). + schema: + type: string + Location: + description: | + The URL of the newly created resource. + schema: + type: string + Content-Type: + description: | + The content type of the body. + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/Mediation' + 400: + $ref: '#/components/responses/BadRequest' + 403: + $ref: '#/components/responses/Forbidden' + 404: + $ref: '#/components/responses/NotFound' + 412: + $ref: '#/components/responses/PreconditionFailed' + security: + - OAuth2Security: + - apim:api_create + - apim:mediation_policy_manage + x-code-samples: + - lang: Curl + source: 'curl -k -X PUT -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" + -F file=@TokenExchange.xml -F type=@type.txt "https://127.0.0.1:9443/api/am/publisher/v2/apis/96077508-fd01-4fae-bc64-5de0e2baf43c/mediation-policies/f56eb8b4-128c-45aa-ad35-9c87a546261a/content"' + x-examples: + $ref: docs/examples/mediation-policies/apis_id_mediationpolicies_id_content_put.yaml + + /apis/{apiId}/wsdl-info: + get: + tags: + - APIs + summary: Get WSDL Meta Information + description: | + This operation can be used to retrieve the WSDL meta information of an API. It states whether the API is a SOAP + API. If the API is a SOAP API, it states whether it has a single WSDL or a WSDL archive. + operationId: getWSDLInfoOfAPI + parameters: + - $ref: '#/components/parameters/apiId' + responses: + 200: + description: | + OK. + Requested WSDL meta information of the API is returned + content: + application/json: + schema: + $ref: '#/components/schemas/WSDLInfo' + 404: + $ref: '#/components/responses/NotFound' + 406: + $ref: '#/components/responses/NotAcceptable' + security: + - OAuth2Security: + - apim:api_view + x-code-samples: + - lang: Curl + source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" + "https://127.0.0.1:9443/api/am/publisher/v2/apis/96077508-fd01-4fae-bc64-5de0e2baf43c/wsdl-info"' + x-examples: + $ref: docs/examples/apis/wsdl/apiId_wsdl_info_get.yaml + + /apis/{apiId}/wsdl: + get: + tags: + - APIs + summary: Get WSDL definition + description: | + This operation can be used to retrieve the WSDL definition of an API. It can be either a single WSDL file or a WSDL archive. + + The type of the WSDL of the API is indicated at the "wsdlInfo" element of the API payload definition. + operationId: getWSDLOfAPI + parameters: + - $ref: '#/components/parameters/apiId' + - $ref: '#/components/parameters/If-None-Match' + responses: + 200: + description: | + OK. + Requested WSDL document of the API is returned + headers: + ETag: + description: | + Entity Tag of the response resource. Used by caches, or in conditional requests (Will be supported in future). + schema: + type: string + Last-Modified: + description: | + Date and time the resource has been modifed the last time. + Used by caches, or in conditional requests (Will be supported in future). + schema: + type: string + content: {} + 304: + description: | + Not Modified. + Empty body because the client has already the latest version of the requested resource (Will be supported in future). + content: {} + 404: + $ref: '#/components/responses/NotFound' + 406: + $ref: '#/components/responses/NotAcceptable' + security: + - OAuth2Security: + - apim:api_view + x-code-samples: + - lang: Curl + source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" + "https://127.0.0.1:9443/api/am/publisher/v2/apis/96077508-fd01-4fae-bc64-5de0e2baf43c/wsdl"' + x-examples: + $ref: docs/examples/apis/wsdl/apiId_wsdl_get.yaml + + put: + tags: + - APIs + summary: Update WSDL Definition + description: | + This operation can be used to update the WSDL definition of an existing API. WSDL to be updated can be passed as either "url" or "file". + Only one of "url" or "file" can be used at the same time. "file" can be specified as a single WSDL file or as a zip file which has a WSDL + and its dependencies (eg: XSDs) + operationId: updateWSDLOfAPI + parameters: + - $ref: '#/components/parameters/apiId' + - $ref: '#/components/parameters/If-Match' + requestBody: + content: + multipart/form-data: + schema: + properties: + file: + type: string + description: WSDL file or archive to upload + format: binary + url: + type: string + description: WSDL Definition url + responses: + 200: + description: | + OK. + Successful response with updated WSDL definition + headers: + ETag: + description: | + Entity Tag of the response resource. Used by caches, or in conditional requests (Will be supported in future). + schema: + type: string + Last-Modified: + description: | + Date and time the resource has been modifed the last time. + Used by caches, or in conditional requests (Will be supported in future). + schema: + type: string + Location: + description: | + The URL of the newly created resource. + schema: + type: string + Content-Type: + description: | + The content type of the body. + schema: + type: string + content: {} + 400: + $ref: '#/components/responses/BadRequest' + 403: + $ref: '#/components/responses/Forbidden' + 404: + $ref: '#/components/responses/NotFound' + 412: + $ref: '#/components/responses/PreconditionFailed' + security: + - OAuth2Security: + - apim:api_create + x-code-samples: + - lang: Curl + source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" + -F file=@api.wsdl "https://127.0.0.1:9443/api/am/publisher/v2/apis/96077508-fd01-4fae-bc64-5de0e2baf43c/wsdl"' + x-examples: + $ref: docs/examples/apis/wsdl/apiId_wsdl_put.yaml + + /apis/{apiId}/graphql-policies/complexity: + get: + tags: + - GraphQL Policies + summary: Get the Complexity Related Details of an API + description: | + This operation can be used to retrieve complexity related details belonging to an API by providing the API id. + parameters: + - $ref: '#/components/parameters/apiId' + responses: + 200: + description: | + OK. + Requested complexity details returned. + headers: + Content-Type: + description: | + The content of the body. + schema: + type: string + default: application/json + content: + application/json: + schema: + $ref: '#/components/schemas/GraphQLQueryComplexityInfo' + 404: + $ref: '#/components/responses/NotFound' + security: + - OAuth2Security: + - apim:api_create + - apim:api_publish + x-code-samples: + - lang: Curl + source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" + "https://127.0.0.1:9443/api/am/publisher/v2/apis/96077508-fd01-4fae-bc64-5de0e2baf43c/graphql-policies/complexity"' + operationId: getGraphQLPolicyComplexityOfAPI + + + put: + tags: + - GraphQL Policies + summary: Update Complexity Related Details of an API + description: | + This operation can be used to update complexity details belonging to an API by providing the id of the API. + parameters: + - $ref: '#/components/parameters/apiId' + requestBody: + description: Role-depth mapping that needs to be added + content: + application/json: + schema: + $ref: '#/components/schemas/GraphQLQueryComplexityInfo' + responses: + 200: + description: | + Created. + Complexity details created successfully. + content: {} + 404: + $ref: '#/components/responses/NotFound' + security: + - OAuth2Security: + - apim:api_create + x-code-samples: + - lang: Curl + source: 'curl -k -X PUT -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" + -H "Content-Type: application/json" -d @data.json "https://127.0.0.1:9443/api/am/publisher/v2/apis/96077508-fd01-4fae-bc64-5de0e2baf43c/graphql-policies/complexity"' + operationId: updateGraphQLPolicyComplexityOfAPI + + /apis/{apiId}/graphql-policies/complexity/types: + get: + tags: + - GraphQL Policies + summary: Retrieve Types and Fields of a GraphQL Schema + description: | + This operation can be used to retrieve all types and fields of the GraphQL Schema by providing the API id. + parameters: + - $ref: '#/components/parameters/apiId' + responses: + 200: + description: | + OK. + Types and fields returned successfully. + headers: + Content-Type: + description: | + The content of the body. + schema: + type: string + default: application/json + content: + application/json: + schema: + $ref: '#/components/schemas/GraphQLSchemaTypeList' + 404: + $ref: '#/components/responses/NotFound' + security: + - OAuth2Security: + - apim:api_create + - apim:api_publish + x-code-samples: + - lang: Curl + source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" + "https://127.0.0.1:9443/api/am/publisher/v2/apis/96077508-fd01-4fae-bc64-5de0e2baf43c/graphql-policies/complexity/types"' + operationId: getGraphQLPolicyComplexityTypesOfAPI + + /apis/{apiId}/resource-paths: + get: + tags: + - APIs + summary: Get Resource Paths of an API + description: | + This operation can be used to retrieve resource paths defined for a specific api. + parameters: + - $ref: '#/components/parameters/apiId' + - $ref: '#/components/parameters/limit' + - $ref: '#/components/parameters/offset' + - $ref: '#/components/parameters/If-None-Match' + responses: + 200: + description: | + OK. + ResourcePaths returned. + headers: + ETag: + description: | + Entity Tag of the response resource. + Used by caches, or in conditional requests (Will be supported in future). + schema: + type: string + Last-Modified: + description: | + Date and time the resource has been modified the last time. + Used by caches, or in conditional requests (Will be supported in future). + schema: + type: string + Content-Type: + description: | + The content type of the body. + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/ResourcePathList' + 304: + description: | + Not Modified. + Empty body because the client has already the latest version of the requested resource (Will be supported in future). + content: {} + 404: + $ref: '#/components/responses/NotFound' + 406: + $ref: '#/components/responses/NotAcceptable' + security: + - OAuth2Security: + - apim:api_view + x-code-samples: + - lang: Curl + source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" + "https://127.0.0.1:9443/api/am/publisher/v2/apis/96077508-fd01-4fae-bc64-5de0e2baf43c/resource-paths"' + operationId: getAPIResourcePaths + + /apis/{apiId}/auditapi: + get: + tags: + - API Audit + summary: Retrieve the Security Audit Report of the Audit API + description: | + Retrieve the Security Audit Report of the Audit API + parameters: + - $ref: '#/components/parameters/Accept' + - $ref: '#/components/parameters/apiId' + responses: + 200: + description: | + OK. + The Security Audit Report has been returned. + headers: + Content-Type: + description: | + The content of the body. + schema: + type: string + default: application/json + content: + application/json: + schema: + $ref: '#/components/schemas/AuditReport' + 404: + $ref: '#/components/responses/NotFound' + security: + - OAuth2Security: + - apim:api_view + x-code-samples: + - lang: Curl + source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" + "https://127.0.0.1:9443/api/am/publisher/v2/apis/96077508-fd01-4fae-bc64-5de0e2baf43c/auditapi"' + x-examples: + $ref: "docs/examples/apis/apis_id_auditapi_get.yaml" + operationId: getAuditReportOfAPI + + /apis/{apiId}/external-stores: + get: + tags: + - External Stores + summary: Get the List of External Stores to which an API is Published + description: | + This operation can be used to retrieve a list of external stores which an API is published to by providing the id of the API. + operationId: getAllPublishedExternalStoresByAPI + parameters: + - $ref: '#/components/parameters/apiId' + - $ref: '#/components/parameters/If-None-Match' + responses: + 200: + description: | + OK. + External Store list is returned. + headers: + ETag: + description: | + Entity Tag of the response resource. Used by caches, or in conditional requests (Will be supported in future). + schema: + type: string + Content-Type: + description: | + The content type of the body. + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/APIExternalStoreList' + 404: + $ref: '#/components/responses/NotFound' + 500: + $ref: '#/components/responses/InternalServerError' + security: + - OAuth2Security: + - apim:api_view + x-code-samples: + - lang: Curl + source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" + "https://127.0.0.1:9443/api/am/publisher/v2/apis/96077508-fd01-4fae-bc64-5de0e2baf43c/external-stores"' + x-examples: + $ref: docs/examples/external-stores/external_stores.yaml#/getPublishedExternalStoresByAPI + + /apis/{apiId}/publish-to-external-stores: + post: + tags: + - External Stores + summary: Publish an API to External Stores + description: | + This operation can be used to publish an API to a list of external stores. + operationId: publishAPIToExternalStores + parameters: + - $ref: '#/components/parameters/apiId' + - name: externalStoreIds + in: query + description: External Store Ids of stores which the API needs to be published + or updated. + required: true + schema: + type: string + - $ref: '#/components/parameters/If-Match' + responses: + 200: + description: | + OK. + API was successfully published to all the selected external stores. + headers: + ETag: + description: | + Entity Tag of the blocked subscription. + Used by caches, or in conditional requests (Will be supported in future). + schema: + type: string + Last-Modified: + description: | + Date and time the subscription has been blocked. + Used by caches, or in conditional requests (Will be supported in future). + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/APIExternalStoreList' + 404: + $ref: '#/components/responses/NotFound' + 500: + $ref: '#/components/responses/InternalServerError' + security: + - OAuth2Security: + - apim:api_publish + x-code-samples: + - lang: Curl + source: 'curl -k -X POST -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" + "https://127.0.0.1:9443/api/am/publisher/v2/apis/96077508-fd01-4fae-bc64-5de0e2baf43c/publish-to-external-stores?externalStoreId=Store123#"' + x-examples: + $ref: docs/examples/external-stores/external_stores.yaml#/publishToExternalStore + + /apis/export: + get: + tags: + - Import Export + summary: Export an API + description: | + This operation can be used to export the details of a particular API as a zip file. + parameters: + - name: apiId + in: query + description: UUID of the API + schema: + type: string + - name: name + in: query + description: | + API Name + schema: + type: string + - name: version + in: query + description: | + Version of the API + schema: + type: string + - name: revisionNumber + in: query + description: | + Revision number of the API artifact + schema: + type: string + - name: providerName + in: query + description: | + Provider name of the API + schema: + type: string + - name: format + in: query + description: | + Format of output documents. Can be YAML or JSON. + schema: + type: string + enum: + - JSON + - YAML + - name: preserveStatus + in: query + description: | + Preserve API Status on export + schema: + type: boolean + - name: latestRevision + in: query + description: | + Export the latest revision of the API + schema: + type: boolean + default: false + responses: + 200: + description: | + OK. + Export Successful. + headers: + Content-Type: + description: | + The content type of the body. + schema: + type: string + content: + application/zip: + schema: + type: string + format: binary + 404: + $ref: '#/components/responses/NotFound' + 500: + $ref: '#/components/responses/InternalServerError' + security: + - OAuth2Security: + - apim:api_publish + - apim:api_create + - apim:api_import_export + x-code-samples: + - lang: Curl + source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" + "https://127.0.0.1:9443/api/am/publisher/v2/apis/export?apiId=96077508-fd01-4fae-bc64-5de0e2baf43c&name=PizzaShackAPI&version=1.0&provider=admin&format=YAML" + > exportAPI.zip' + operationId: exportAPI + + /apis/import: + post: + tags: + - Import Export + summary: Import an API + description: | + This operation can be used to import an API. + parameters: + - name: preserveProvider + in: query + description: | + Preserve Original Provider of the API. This is the user choice to keep or replace the API provider + required: false + schema: + type: boolean + - name: rotateRevision + in: query + description: | + Once the revision max limit reached, undeploy and delete the earliest revision and create a new revision + required: false + schema: + type: boolean + - name: overwrite + in: query + description: | + Whether to update the API or not. This is used when updating already existing APIs + required: false + schema: + type: boolean + requestBody: + content: + multipart/form-data: + schema: + required: + - file + properties: + file: + type: string + description: Zip archive consisting on exported api configuration + format: binary + responses: + 200: + description: | + Created. + API Imported Successfully. + 403: + $ref: '#/components/responses/Forbidden' + 404: + $ref: '#/components/responses/NotFound' + 409: + $ref: '#/components/responses/Conflict' + 500: + $ref: '#/components/responses/InternalServerError' + security: + - OAuth2Security: + - apim:api_import_export + x-code-samples: + - lang: Curl + source: 'curl -k -X POST -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" + -F file=@admin-PizzaShackAPI-1.0.0.zip "https://127.0.0.1:9443/api/am/publisher/v2/apis/import?preserveProvider=false&overwrite=false"' + operationId: importAPI + + ###################################################### + # The "Subscription Collection" resource APIs + ###################################################### + /subscriptions: + get: + tags: + - Subscriptions + summary: Get all Subscriptions + description: | + This operation can be used to retrieve a list of subscriptions of the user associated with the provided access token. This operation is capable of + + 1. Retrieving all subscriptions for the user's APIs. + `GET https://127.0.0.1:9443/api/am/publisher/v2/subscriptions` + + 2. Retrieving subscriptions for a specific API. + `GET https://127.0.0.1:9443/api/am/publisher/v2/subscriptions?apiId=c43a325c-260b-4302-81cb-768eafaa3aed` + parameters: + - $ref: '#/components/parameters/apiId-Q-Opt' + - $ref: '#/components/parameters/limit' + - $ref: '#/components/parameters/offset' + - $ref: '#/components/parameters/If-None-Match' + - name: query + in: query + description: | + Keywords to filter subscriptions + schema: + type: string + responses: + 200: + description: | + OK. + Subscription list returned. + headers: + ETag: + description: | + Entity Tag of the response resource. + Used by caches, or in conditional requests (Will be supported in future). + schema: + type: string + Content-Type: + description: | + The content type of the body. + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/SubscriptionList' + 304: + description: | + Not Modified. + Empty body because the client has already the latest version of the requested resource (Will be supported in future). + content: {} + 406: + $ref: '#/components/responses/NotAcceptable' + security: + - OAuth2Security: + - apim:subscription_view + x-code-samples: + - lang: Curl + source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" + "https://127.0.0.1:9443/api/am/publisher/v2/subscriptions?apiId=96077508-fd01-4fae-bc64-5de0e2baf43c"' + operationId: getSubscriptions + + ###################################################### + # The Individual Subscription resource APIs + ###################################################### + /subscriptions/{subscriptionId}/usage: + get: + tags: + - API Monetization + summary: Get Details of a Pending Invoice for a Monetized Subscription with Metered Billing. + description: | + This operation can be used to get details of a pending invoice for a monetized subscription with meterd billing. + parameters: + - $ref: '#/components/parameters/subscriptionId' + responses: + 200: + description: | + OK. + Details of a pending invoice returned. + headers: + ETag: + description: Entity Tag of the response resource. Used by caches, or + in conditional requests (Will be supported in future). + schema: + type: string + Last-Modified: + description: Date and time the resource has been modified the last time. + Used by caches, or in conditional requests (Will be supported in future). + schema: + type: string + Content-Type: + description: The content type of the body. + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/APIMonetizationUsage' + 304: + description: | + Not Modified. + Empty body because the client has already the latest version of the requested resource (Will be supported in future). + content: {} + 404: + description: | + Not Found. + Requested Subscription does not exist. + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + security: + - OAuth2Security: + - apim:subscription_view + x-code-samples: + - lang: Curl + source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" + "https://127.0.0.1:9443/api/am/publisher/v2/subscriptions/64eca60b-2e55-4c38-8603-e9e6bad7d809/usage"' + operationId: getSubscriptionUsage + + /subscriptions/{subscriptionId}/subscriber-info: + get: + tags: + - Subscriber + summary: Get Details of a Subscriber + description: | + This operation can be used to get details of a user who subscribed to the API. + parameters: + - $ref: '#/components/parameters/subscriptionId' + responses: + 200: + description: | + OK. + Details of the subscriber are returned. + content: + application/json: + schema: + $ref: '#/components/schemas/SubscriberInfo' + 404: + $ref: '#/components/responses/NotFound' + security: + - OAuth2Security: + - apim:subscription_view + x-code-samples: + - lang: Curl + source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" + "https://127.0.0.1:9443/api/am/publisher/v2/subscriptions/64eca60b-2e55-4c38-8603-e9e6bad7d809/subscriber-info"' + operationId: getSubscriberInfoBySubscriptionId + + /subscriptions/block-subscription: + post: + tags: + - Subscriptions + summary: Block a Subscription + description: | + This operation can be used to block a subscription. Along with the request, `blockState` must be specified as a query parameter. + + 1. `BLOCKED` : Subscription is completely blocked for both Production and Sandbox environments. + 2. `PROD_ONLY_BLOCKED` : Subscription is blocked for Production environment only. + parameters: + - $ref: '#/components/parameters/subscriptionId-Q' + - name: blockState + in: query + description: | + Subscription block state. + required: true + schema: + type: string + enum: + - BLOCKED + - PROD_ONLY_BLOCKED + - $ref: '#/components/parameters/If-Match' + responses: + 200: + description: | + OK. + Subscription was blocked successfully. + headers: + ETag: + description: | + Entity Tag of the blocked subscription. + Used by caches, or in conditional requests (Will be supported in future). + schema: + type: string + Last-Modified: + description: | + Date and time the subscription has been blocked. + Used by caches, or in conditional requests (Will be supported in future). + schema: + type: string + content: {} + 400: + $ref: '#/components/responses/BadRequest' + 404: + $ref: '#/components/responses/NotFound' + 412: + $ref: '#/components/responses/PreconditionFailed' + security: + - OAuth2Security: + - apim:subscription_block + x-code-samples: + - lang: Curl + source: 'curl -k -X POST -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" + "https://127.0.0.1:9443/api/am/publisher/v2/subscriptions/block-subscription?subscriptionId=64eca60b-2e55-4c38-8603-e9e6bad7d809&blockState=PROD_ONLY_BLOCKED"' + operationId: blockSubscription + + /subscriptions/unblock-subscription: + post: + tags: + - Subscriptions + summary: Unblock a Subscription + description: | + This operation can be used to unblock a subscription specifying the subscription Id. The subscription will be fully unblocked after performing this operation. + parameters: + - $ref: '#/components/parameters/subscriptionId-Q' + - $ref: '#/components/parameters/If-Match' + responses: + 200: + description: | + OK. + Subscription was unblocked successfully. + headers: + ETag: + description: | + Entity Tag of the unblocked subscription. + Used by caches, or in conditional requests (Will be supported in future). + schema: + type: string + Last-Modified: + description: | + Date and time the subscription has been unblocked. + Used by caches, or in conditional requests (Will be supported in future). + schema: + type: string + content: {} + 400: + $ref: '#/components/responses/BadRequest' + 404: + $ref: '#/components/responses/NotFound' + 412: + $ref: '#/components/responses/PreconditionFailed' + security: + - OAuth2Security: + - apim:subscription_block + x-code-samples: + - lang: Curl + source: 'curl -k -X POST -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" + "https://127.0.0.1:9443/api/am/publisher/v2/subscriptions/unblock-subscription?subscriptionId=64eca60b-2e55-4c38-8603-e9e6bad7d809"' + operationId: unBlockSubscription + + + ###################################################### + # The "Thorttling Tier Collection" resource APIs + ###################################################### + /throttling-policies/{policyLevel}: + get: + tags: + - Throttling Policies + summary: Get All Throttling Policies for the Given Type + description: | + This operation can be used to list the available policies for a given policy level. Tier level should be specified as a path parameter and should be one of `subscription` and `api`. + `subscription` is for Subscription Level policies and `api` is for Resource Level policies + operationId: getAllThrottlingPolicies + parameters: + - $ref: '#/components/parameters/limit' + - $ref: '#/components/parameters/offset' + - $ref: '#/components/parameters/policyLevel' + - $ref: '#/components/parameters/If-None-Match' + responses: + 200: + description: | + OK. + List of policies returned. + headers: + ETag: + description: | + Entity Tag of the response resource. + Used by caches, or in conditional requests (Will be supported in future). + schema: + type: string + Content-Type: + description: The content type of the body. + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/ThrottlingPolicyList' + 304: + description: | + Not Modified. + Empty body because the client has already the latest version of the requested resource (Will be supported in future). + content: {} + 406: + $ref: '#/components/responses/NotAcceptable' + security: + - OAuth2Security: + - apim:api_view + x-code-samples: + - lang: Curl + source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" + "https://127.0.0.1:9443/api/am/publisher/v2/throttling-policies/api"' + + ###################################################### + # The "Subscription Throttling Based on Quota Type" resource APIs + ###################################################### + /throttling-policies/streaming/subscription: + get: + tags: + - Throttling Policies + summary: Get subscription throttling policies based on quota type + description: | + This operation can be used to list the available subscription policies for a given tenent ID based on the given quota type. + Quota Type should be provide as a query parameters and supported Quota types are "requestCount" ,"bandwidthVolume" and "eventCount" + operationId: getSubscriptionThrottlingPolicies + parameters: + - $ref: '#/components/parameters/tierQuotaType' + - $ref: '#/components/parameters/If-None-Match' + responses: + 200: + description: | + OK. + List of subscription policies returned. + headers: + ETag: + description: | + Entity Tag of the response resource. + Used by caches, or in conditional requests (Will be supported in future). + schema: + type: string + Content-Type: + description: The content type of the body. + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/ThrottlingPolicyList' + 304: + description: | + Not Modified. + Empty body because the client has already the latest version of the requested resource (Will be supported in future). + content: {} + 406: + $ref: '#/components/responses/NotAcceptable' + security: + - OAuth2Security: + - apim:api_view + x-code-samples: + - lang: Curl + source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" + "https://127.0.0.1:9443/api/am/publisher/v2/throttling-policies/subscription?tierQuotaType=RequestCountLimit"' + + ###################################################### + # The "Individual Throttling Tier" resource APIs + ###################################################### + /throttling-policies/{policyLevel}/{policyName}: + get: + tags: + - Throttling Policies + summary: Get Details of a Policy + description: | + This operation can be used to retrieve details of a single policy by specifying the policy level and policy name. + operationId: getThrottlingPolicyByName + parameters: + - $ref: '#/components/parameters/policyName' + - $ref: '#/components/parameters/policyLevel' + - $ref: '#/components/parameters/If-None-Match' + responses: + 200: + description: | + OK. + Tier returned + headers: + ETag: + description: | + Entity Tag of the response resource. + Used by caches, or in conditional requests (Will be supported in future). + schema: + type: string + Last-Modified: + description: | + Date and time the resource has been modifed the last time. + Used by caches, or in conditional requests (Will be supported in future). + schema: + type: string + Content-Type: + description: | + The content type of the body. + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/ThrottlingPolicy' + 304: + description: | + Not Modified. + Empty body because the client has already the latest version of the requested resource (Will be supported in future). + content: {} + 404: + $ref: '#/components/responses/NotFound' + 406: + $ref: '#/components/responses/NotAcceptable' + security: + - OAuth2Security: + - apim:api_view + x-code-samples: + - lang: Curl + source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" + "https://127.0.0.1:9443/api/am/publisher/v2/throttling-policies/api/Platinum"' + + ###################################################### + # The "Mediation Policy Collection" resource APIs + ###################################################### + /mediation-policies: + get: + tags: + - Global Mediation Policies + summary: | + Get all global level mediation policies + description: | + This operation provides you a list of available all global level mediation policies. + operationId: getAllGlobalMediationPolicies + parameters: + - $ref: '#/components/parameters/limit' + - $ref: '#/components/parameters/offset' + - name: query + in: query + description: -Not supported yet- + schema: + type: string + - $ref: '#/components/parameters/If-None-Match' + responses: + 200: + description: | + OK. + List of mediation policies is returned. + headers: + ETag: + description: | + Entity Tag of the response resource. Used by caches, or in conditional requests (Will be supported in future). + schema: + type: string + Content-Type: + description: The content type of the body. + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/MediationList' + 304: + description: | + Not Modified. + Empty body because the client has already the latest version of the requested resource (Will be supported in future). + content: {} + 406: + $ref: '#/components/responses/NotAcceptable' + security: + - OAuth2Security: + - apim:api_view + - apim:mediation_policy_view + x-code-samples: + - lang: Curl + source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" + "https://127.0.0.1:9443/api/am/publisher/v2/mediation-policies"' + x-examples: + $ref: docs/examples/mediation-policies/mediation_policies_get.yaml + + ################################################################### + # The "Individual Mediation Policy" resource + ################################################################### + /mediation-policies/{mediationPolicyId}/content: + get: + tags: + - Global Mediation Policy + summary: Download a Global Mediation Policy + description: | + This operation can be used to download a particular global mediation policy. + operationId: getGlobalMediationPolicyContent + parameters: + - $ref: '#/components/parameters/mediationPolicyId' + - $ref: '#/components/parameters/If-None-Match' + responses: + 200: + description: | + OK. + Mediation policy returned. + headers: + ETag: + description: | + Entity Tag of the response resource. + Used by caches, or in conditional requests (Will be supported in future). + schema: + type: string + Last-Modified: + description: | + Date and time the resource has been modifed the last time. + Used by caches, or in conditional requests (Will be supported in future). + schema: + type: string + Content-Type: + description: | + The content type of the body. + schema: + type: string + content: {} + 304: + description: | + Not Modified. + Empty body because the client has already the latest version of the requested resource (Will be supported in future). + content: {} + 404: + $ref: '#/components/responses/NotFound' + security: + - OAuth2Security: + - apim:api_view + - apim:mediation_policy_view + x-code-samples: + - lang: Curl + source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" + "https://127.0.0.1:9443/api/am/publisher/v2/mediation-policies/d48a3412-1b85-49be-99f4-b81a3722ae73/content" + > mediation.xml' + + /apis/{apiId}/client-certificates: + get: + tags: + - Client Certificates + summary: Retrieve/ Search Uploaded Client Certificates + description: | + This operation can be used to retrieve and search the uploaded client certificates. + parameters: + - $ref: '#/components/parameters/limit' + - $ref: '#/components/parameters/offset' + - name: alias + in: query + description: Alias for the client certificate + schema: + type: string + - $ref: '#/components/parameters/apiId' + responses: + 200: + description: | + OK. Successful response with the list of matching certificate information in the body. + headers: + Content-Type: + description: | + The content type of the body. + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/ClientCertificates' + 400: + $ref: '#/components/responses/BadRequest' + 500: + $ref: '#/components/responses/InternalServerError' + security: + - OAuth2Security: + - apim:api_view + - apim:client_certificates_view + x-code-samples: + - lang: Curl + source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" + "https://127.0.0.1:9443/api/am/publisher/v2/apis/d48a3412-1b85-49be-99f4-b81a3722ae73/client-certificates?alias=wso2carbon"' + operationId: getAPIClientCertificates + + post: + tags: + - Client Certificates + summary: Upload a New Certificate + description: | + This operation can be used to upload a new certificate for an endpoint. + parameters: + - $ref: '#/components/parameters/apiId' + requestBody: + content: + multipart/form-data: + schema: + required: + - alias + - certificate + - tier + properties: + certificate: + type: string + description: The certificate that needs to be uploaded. + format: binary + alias: + maxLength: 30 + minLength: 1 + type: string + description: Alias for the certificate + tier: + type: string + description: api tier to which the certificate should be applied. + required: true + responses: + 200: + description: | + OK. + The Certificate added successfully. + headers: + Location: + description: | + The URL of the newly created resource. + schema: + type: string + Content-Type: + description: | + The content type of the body. + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/ClientCertMetadata' + 400: + $ref: '#/components/responses/BadRequest' + 500: + $ref: '#/components/responses/InternalServerError' + security: + - OAuth2Security: + - apim:api_create + - apim:client_certificates_add + x-code-samples: + - lang: Curl + source: 'curl -k -X POST -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" + -H "Content-Type: multipart/form-data" -F certificate=@test.crt -F alias=wso2carbon + -F apiId=fea749dd-d548-4a8b-b308-34903b39a34b -F tier=Gold "https://127.0.0.1:9443/api/am/publisher/v2/apis/d48a3412-1b85-49be-99f4-b81a3722ae73/client-certificates"' + operationId: addAPIClientCertificate + + /apis/{apiId}/client-certificates/{alias}: + get: + tags: + - Client Certificates + summary: Get the Certificate Information + description: | + This operation can be used to get the information about a certificate. + parameters: + - name: alias + in: path + required: true + schema: + type: string + - $ref: '#/components/parameters/apiId' + responses: + 200: + description: | + OK. + headers: + Content-Type: + description: | + The content type of the body. + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/CertificateInfo' + 400: + $ref: '#/components/responses/BadRequest' + 404: + $ref: '#/components/responses/NotFound' + 500: + $ref: '#/components/responses/InternalServerError' + security: + - OAuth2Security: + - apim:api_view + - apim:client_certificates_view + x-code-samples: + - lang: Curl + source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" + "https://127.0.0.1:9443/api/am/publisher/v2/apis/d48a3412-1b85-49be-99f4-b81a3722ae73/client-certificates/wso2carbon"' + operationId: getAPIClientCertificateByAlias + + put: + tags: + - Client Certificates + summary: Update a Certificate + description: | + This operation can be used to update an uploaded certificate. + parameters: + - name: alias + in: path + description: Alias for the certificate + required: true + schema: + maxLength: 30 + minLength: 1 + type: string + - $ref: '#/components/parameters/apiId' + requestBody: + content: + multipart/form-data: + schema: + properties: + certificate: + type: string + description: The certificate that needs to be uploaded. + format: binary + tier: + type: string + description: The tier of the certificate + responses: + 200: + description: | + OK. + The Certificate updated successfully. + headers: + Location: + description: | + The URL of the newly created resource. + schema: + type: string + Content-Type: + description: | + The content type of the body. + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/ClientCertMetadata' + 400: + $ref: '#/components/responses/BadRequest' + 404: + $ref: '#/components/responses/NotFound' + 500: + $ref: '#/components/responses/InternalServerError' + security: + - OAuth2Security: + - apim:api_create + - apim:client_certificates_update + x-code-samples: + - lang: Curl + source: 'curl -k -X PUT -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" + -H "Content-Type: multipart/form-data" -F certificate=@test.crt -F alias=wso2carbon + -F apiId=fea749dd-d548-4a8b-b308-34903b39a34b -F tier=Gold "https://127.0.0.1:9443/api/am/publisher/v2/apis/d48a3412-1b85-49be-99f4-b81a3722ae73/client-certificates/wso2carbon"' + operationId: updateAPIClientCertificateByAlias + + delete: + tags: + - Client Certificates + summary: Delete a Certificate + description: | + This operation can be used to delete an uploaded certificate. + parameters: + - name: alias + in: path + description: | + The alias of the certificate that should be deleted. + required: true + schema: + type: string + - $ref: '#/components/parameters/apiId' + responses: + 200: + description: | + OK. + The Certificate deleted successfully. + headers: + Content-Type: + description: | + The content type of the body. + schema: + type: string + content: {} + 400: + $ref: '#/components/responses/BadRequest' + 404: + $ref: '#/components/responses/NotFound' + 500: + $ref: '#/components/responses/InternalServerError' + security: + - OAuth2Security: + - apim:api_create + - apim:client_certificates_update + x-code-samples: + - lang: Curl + source: 'curl -k -X DELETE -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" + "https://127.0.0.1:9443/api/am/publisher/v2/apis/d48a3412-1b85-49be-99f4-b81a3722ae73/client-certificates/wso2carbon"' + operationId: deleteAPIClientCertificateByAlias + + /apis/{apiId}/client-certificates/{alias}/content: + get: + tags: + - Client Certificates + summary: Download a Certificate + description: | + This operation can be used to download a certificate which matches the given alias. + parameters: + - $ref: '#/components/parameters/apiId' + - name: alias + in: path + required: true + schema: + type: string + responses: + 200: + description: | + OK. + headers: + Content-Type: + description: | + The content type of the body. + schema: + type: string + content: {} + 400: + $ref: '#/components/responses/BadRequest' + 404: + $ref: '#/components/responses/NotFound' + 500: + $ref: '#/components/responses/InternalServerError' + security: + - OAuth2Security: + - apim:api_view + - apim:client_certificates_view + x-code-samples: + - lang: Curl + source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" + "https://127.0.0.1:9443/api/am/publisher/v2/apis/d48a3412-1b85-49be-99f4-b81a3722ae73/client-certificates/wso2carbon/content"' + operationId: getAPIClientCertificateContentByAlias + + ###################################################### + # The "Certificate Management" resource APIs + ###################################################### + /endpoint-certificates: + get: + tags: + - Endpoint Certificates + summary: Retrieve/Search Uploaded Certificates + description: | + This operation can be used to retrieve and search the uploaded certificates. + parameters: + - $ref: '#/components/parameters/limit' + - $ref: '#/components/parameters/offset' + - name: alias + in: query + description: Alias for the certificate + schema: + maxLength: 30 + type: string + - name: endpoint + in: query + description: Endpoint of which the certificate is uploaded + schema: + type: string + responses: + 200: + description: | + OK. Successful response with the list of matching certificate information in the body. + headers: + Content-Type: + description: | + The content type of the body. + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/Certificates' + 400: + $ref: '#/components/responses/BadRequest' + 404: + $ref: '#/components/responses/NotFound' + 500: + $ref: '#/components/responses/InternalServerError' + security: + - OAuth2Security: + - apim:api_view + - apim:ep_certificates_view + x-code-samples: + - lang: Curl + source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" + "https://127.0.0.1:9443/api/am/publisher/v2/endpoint-certificates?alias=wso2carbon&endpoint=www.abc.com"' + operationId: getEndpointCertificates + + post: + tags: + - Endpoint Certificates + summary: Upload a new Certificate. + description: | + This operation can be used to upload a new certificate for an endpoint. + requestBody: + content: + multipart/form-data: + schema: + required: + - alias + - certificate + - endpoint + properties: + certificate: + type: string + description: The certificate that needs to be uploaded. + format: binary + alias: + maxLength: 30 + minLength: 1 + type: string + description: Alias for the certificate + endpoint: + type: string + description: Endpoint to which the certificate should be applied. + required: true + responses: + 200: + description: | + OK. + The Certificate added successfully. + headers: + Location: + description: | + The URL of the newly created resource. + schema: + type: string + Content-Type: + description: | + The content type of the body. + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/CertMetadata' + 400: + $ref: '#/components/responses/BadRequest' + 500: + $ref: '#/components/responses/InternalServerError' + security: + - OAuth2Security: + - apim:api_create + - apim:ep_certificates_add + x-code-samples: + - lang: Curl + source: 'curl -k -X POST -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" + -H "Content-Type: multipart/form-data" -F certificate=@test.crt -F alias=alias + -F "endpoint=endpoint=https://www.abc.com" "https://127.0.0.1:9443/api/am/publisher/v2/apis/d48a3412-1b85-49be-99f4-b81a3722ae73/endpoint-certificates"' + operationId: addEndpointCertificate + + /endpoint-certificates/{alias}: + get: + tags: + - Endpoint Certificates + summary: Get the Certificate Information + description: | + This operation can be used to get the information about a certificate. + parameters: + - name: alias + in: path + required: true + schema: + type: string + responses: + 200: + description: | + OK. + headers: + Content-Type: + description: | + The content type of the body. + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/CertificateInfo' + 400: + $ref: '#/components/responses/BadRequest' + 404: + $ref: '#/components/responses/NotFound' + 500: + $ref: '#/components/responses/InternalServerError' + security: + - OAuth2Security: + - apim:api_view + - apim:ep_certificates_view + x-code-samples: + - lang: Curl + source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" + "https://127.0.0.1:9443/api/am/publisher/v2/endpoint-certificates/wso2carbon"' + operationId: getEndpointCertificateByAlias + + put: + tags: + - Endpoint Certificates + summary: Update a certificate. + description: | + This operation can be used to update an uploaded certificate. + parameters: + - name: alias + in: path + description: Alias for the certificate + required: true + schema: + maxLength: 30 + minLength: 1 + type: string + requestBody: + content: + multipart/form-data: + schema: + required: + - certificate + properties: + certificate: + type: string + description: The certificate that needs to be uploaded. + format: binary + required: true + responses: + 200: + description: | + OK. + The Certificate updated successfully. + headers: + Location: + description: | + The URL of the newly created resource. + schema: + type: string + Content-Type: + description: | + The content type of the body. + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/CertMetadata' + 400: + $ref: '#/components/responses/BadRequest' + 404: + $ref: '#/components/responses/NotFound' + 500: + $ref: '#/components/responses/InternalServerError' + security: + - OAuth2Security: + - apim:api_create + - apim:ep_certificates_update + x-code-samples: + - lang: Curl + source: 'curl -k -X PUT -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" + -H "Content-Type: multipart/form-data" -F certificate=@test.crt "https://127.0.0.1:9443/api/am/publisher/v2/apis/d48a3412-1b85-49be-99f4-b81a3722ae73/endpoint-certificates/wso2carbon"' + operationId: updateEndpointCertificateByAlias + + delete: + tags: + - Endpoint Certificates + summary: Delete a certificate. + description: | + This operation can be used to delete an uploaded certificate. + parameters: + - name: alias + in: path + description: | + The alias of the certificate that should be deleted. + required: true + schema: + type: string + responses: + 200: + description: | + OK. + The Certificate deleted successfully. + headers: + Content-Type: + description: | + The content type of the body. + schema: + type: string + content: {} + 400: + $ref: '#/components/responses/BadRequest' + 404: + $ref: '#/components/responses/NotFound' + 500: + $ref: '#/components/responses/InternalServerError' + security: + - OAuth2Security: + - apim:api_create + - apim:ep_certificates_update + x-code-samples: + - lang: Curl + source: 'curl -k -X DELETE -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" + "https://127.0.0.1:9443/api/am/publisher/v2/endpoint-certificates/wso2carbon"' + operationId: deleteEndpointCertificateByAlias + + /endpoint-certificates/{alias}/content: + get: + tags: + - Endpoint Certificates + summary: Download a Certificate + description: | + This operation can be used to download a certificate which matches the given alias. + parameters: + - name: alias + in: path + required: true + schema: + type: string + responses: + 200: + description: | + OK. + headers: + Content-Type: + description: | + The content type of the body. + schema: + type: string + content: {} + 400: + $ref: '#/components/responses/BadRequest' + 404: + $ref: '#/components/responses/NotFound' + 500: + $ref: '#/components/responses/InternalServerError' + security: + - OAuth2Security: + - apim:api_view + - apim:ep_certificates_view + x-code-samples: + - lang: Curl + source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" + "https://127.0.0.1:9443/api/am/publisher/v2/endpoint-certificates/wso2carbon/content"' + operationId: getEndpointCertificateContentByAlias + + ###################################################### + # The "Content Search Results" resource APIs + ###################################################### + /search: + get: + tags: + - Unified Search + summary: | + Retrieve/Search APIs and API Documents by Content + description: | + This operation provides you a list of available APIs and API Documents qualifying the given keyword match. + parameters: + - $ref: '#/components/parameters/limit' + - $ref: '#/components/parameters/offset' + - name: query + in: query + description: | + **Search**. + + You can search by proving a keyword. + schema: + type: string + - $ref: '#/components/parameters/If-None-Match' + responses: + 200: + description: | + OK. + List of qualifying APIs and API documents is returned. + headers: + ETag: + description: | + Entity Tag of the response resource. Used by caches, or in conditional requests (Will be supported in future). + schema: + type: string + Content-Type: + description: The content type of the body. + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/SearchResultList' + 304: + description: | + Not Modified. + Empty body because the client has already the latest version of the requested resource (Will be supported in future). + content: {} + 406: + $ref: '#/components/responses/NotAcceptable' + security: + - OAuth2Security: + - apim:api_view + - apim:api_import_export + - apim:api_product_import_export + x-code-samples: + - lang: Curl + source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" + "https://127.0.0.1:9443/api/am/publisher/v2/search?query=pizza"' + x-examples: + $ref: docs/examples/apis/search_get.yaml + operationId: search + + ###################################################### + # The "API Product Collection" resource APIs + ###################################################### + /api-products: + get: + tags: + - API Products + summary: | + Retrieve/Search API Products + description: | + This operation provides you a list of available API Products qualifying under a given search condition. + + Each retrieved API Product is represented with a minimal amount of attributes. If you want to get complete details of an API Product, you need to use **Get details of an API Product** operation. + parameters: + - $ref: '#/components/parameters/limit' + - $ref: '#/components/parameters/offset' + - name: query + in: query + schema: + type: string + - $ref: '#/components/parameters/Accept' + - $ref: '#/components/parameters/If-None-Match' + responses: + 200: + description: | + OK. + List of qualifying API Products is returned. + headers: + ETag: + description: | + Entity Tag of the response resource. Used by caches, or in conditional requests (Will be supported in future). + schema: + type: string + Content-Type: + description: The content type of the body. + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/APIProductList' + 304: + description: | + Not Modified. + Empty body because the client has already the latest version of the requested resource (Will be supported in future). + content: {} + 406: + $ref: '#/components/responses/NotAcceptable' + security: + - OAuth2Security: + - apim:api_view + x-code-samples: + - lang: Curl + source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" + "https://127.0.0.1:9443/api/am/publisher/v2/api-products?query=PizzaAPIProduct"' + operationId: getAllAPIProducts + + post: + tags: + - API Products + summary: Create a New API Product + description: | + This operation can be used to create a new API Product specifying the details of the API Product in the payload. + requestBody: + description: API object that needs to be added + content: + application/json: + schema: + $ref: '#/components/schemas/APIProduct' + required: true + responses: + 201: + description: | + 'Created. + Successful response with the newly created object as entity in the body. + Location header contains URL of newly created entity.' + headers: + ETag: + description: | + Entity Tag of the response resource. Used by caches, or in conditional requests (Will be supported in future). + schema: + type: string + Location: + description: | + The URL of the newly created resource. + schema: + type: string + Content-Type: + description: | + The content type of the body. + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/APIProduct' + 400: + $ref: '#/components/responses/BadRequest' + 415: + $ref: '#/components/responses/UnsupportedMediaType' + security: + - OAuth2Security: + - apim:api_publish + x-code-samples: + - lang: Curl + source: 'curl -k -X POST -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" + -H "Content-Type: application/json" -d @data.json "https://127.0.0.1:9443/api/am/publisher/v2/api-products"' + operationId: createAPIProduct + + ################################################################ + # The "Individual API Product" resource APIs + ################################################################ + /api-products/{apiProductId}: + get: + tags: + - API Products + summary: Get Details of an API Product + description: | + Using this operation, you can retrieve complete details of a single API Product. You need to provide the Id of the API to retrive it. + parameters: + - $ref: '#/components/parameters/apiProductId' + - $ref: '#/components/parameters/Accept' + - $ref: '#/components/parameters/If-None-Match' + responses: + 200: + description: | + OK. + Requested API Product is returned + headers: + ETag: + description: | + Entity Tag of the response resource. Used by caches, or in conditional requests (Will be supported in future). + schema: + type: string + Last-Modified: + description: | + Date and time the resource has been modifed the last time. + Used by caches, or in conditional requests (Will be supported in future). + schema: + type: string + Content-Type: + description: | + The content type of the body. + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/APIProduct' + 304: + description: | + Not Modified. + Empty body because the client has already the latest version of the requested resource (Will be supported in future). + content: {} + 404: + $ref: '#/components/responses/NotFound' + 406: + $ref: '#/components/responses/NotAcceptable' + security: + - OAuth2Security: + - apim:api_publish + x-code-samples: + - lang: Curl + source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" + "https://127.0.0.1:9443/api/am/publisher/v2/api-products/5bca47e1-8233-46a5-9295-525dca337f33"' + operationId: getAPIProduct + + put: + tags: + - API Products + summary: Update an API Product + description: | + This operation can be used to update an existing API product. + But the properties `name`, `provider` and `version` cannot be changed. + parameters: + - $ref: '#/components/parameters/apiProductId' + - $ref: '#/components/parameters/If-Match' + requestBody: + description: API object that needs to be added + content: + application/json: + schema: + $ref: '#/components/schemas/APIProduct' + required: true + responses: + 200: + description: | + OK. + Successful response with updated API product object + headers: + ETag: + description: | + Entity Tag of the response resource. Used by caches, or in conditional requests (Will be supported in future). + schema: + type: string + Last-Modified: + description: | + Date and time the resource has been modifed the last time. + Used by caches, or in conditional requests (Will be supported in future). + schema: + type: string + Location: + description: | + The URL of the newly created resource. + schema: + type: string + Content-Type: + description: | + The content type of the body. + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/APIProduct' + 400: + $ref: '#/components/responses/BadRequest' + 403: + $ref: '#/components/responses/Forbidden' + 404: + $ref: '#/components/responses/NotFound' + 412: + $ref: '#/components/responses/PreconditionFailed' + security: + - OAuth2Security: + - apim:api_publish + x-code-samples: + - lang: Curl + source: 'curl -k -X PUT -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" + -H "Content-Type: application/json" -d @data.json "https://127.0.0.1:9443/api/am/publisher/v2/api-products/5bca47e1-8233-46a5-9295-525dca337f33"' + operationId: updateAPIProduct + + + delete: + tags: + - API Products + summary: Delete an API Product + description: | + This operation can be used to delete an existing API Product proving the Id of the API Product. + parameters: + - $ref: '#/components/parameters/apiProductId' + - $ref: '#/components/parameters/If-Match' + responses: + 200: + description: | + OK. + Resource successfully deleted. + content: {} + 403: + $ref: '#/components/responses/Forbidden' + 404: + $ref: '#/components/responses/NotFound' + 412: + $ref: '#/components/responses/PreconditionFailed' + security: + - OAuth2Security: + - apim:api_publish + - apim:api_product_import_export + x-code-samples: + - lang: Curl + source: 'curl -k -X DELETE -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" + "https://127.0.0.1:9443/api/am/publisher/v2/api-products/5bca47e1-8233-46a5-9295-525dca337f33"' + operationId: deleteAPIProduct + + /api-products/{apiProductId}/thumbnail: + get: + tags: + - API Products + summary: Get Thumbnail Image + description: | + This operation can be used to download a thumbnail image of an API product. + parameters: + - $ref: '#/components/parameters/apiProductId' + - $ref: '#/components/parameters/Accept' + - $ref: '#/components/parameters/If-None-Match' + responses: + 200: + description: | + OK. + Thumbnail image returned + headers: + ETag: + description: | + Entity Tag of the response resource. + Used by caches, or in conditional requests (Will be supported in future). + schema: + type: string + Last-Modified: + description: | + Date and time the resource has been modifed the last time. + Used by caches, or in conditional requests (Will be supported in future). + schema: + type: string + Content-Type: + description: | + The content type of the body. + schema: + type: string + content: {} + 304: + description: | + Not Modified. + Empty body because the client has already the latest version of the requested resource (Will be supported in future). + content: {} + 404: + $ref: '#/components/responses/NotFound' + 406: + $ref: '#/components/responses/NotAcceptable' + security: + - OAuth2Security: + - apim:api_publish + x-code-samples: + - lang: Curl + source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" + "https://127.0.0.1:9443/api/am/publisher/v2/api-products/5bca47e1-8233-46a5-9295-525dca337f33/thumbnail" + > image.jpeg' + operationId: getAPIProductThumbnail + + put: + tags: + - API Products + summary: Upload a Thumbnail Image + description: | + This operation can be used to upload a thumbnail image of an API Product. The thumbnail to be uploaded should be given as a form data parameter `file`. + parameters: + - $ref: '#/components/parameters/apiProductId' + - $ref: '#/components/parameters/If-Match' + requestBody: + content: + multipart/form-data: + schema: + required: + - file + properties: + file: + type: string + description: Image to upload + format: binary + required: true + responses: + 200: + description: | + OK. + Image updated + headers: + ETag: + description: | + Entity Tag of the response resource. + Used by caches, or in conditional requests (Will be supported in future). + schema: + type: string + Last-Modified: + description: | + Date and time the resource has been modifed the last time. + Used by caches, or in conditional requests (Will be supported in future). + schema: + type: string + Location: + description: | + The URL of the uploaded thumbnail image of the API Product. + schema: + type: string + Content-Type: + description: | + The content type of the body. + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/FileInfo' + 400: + $ref: '#/components/responses/BadRequest' + 404: + $ref: '#/components/responses/NotFound' + 412: + $ref: '#/components/responses/PreconditionFailed' + security: + - OAuth2Security: + - apim:api_publish + x-code-samples: + - lang: Curl + source: 'curl -k -X PUT -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" + -H "Content-Type: multipart/form-data" -F file=@image.jpeg "https://127.0.0.1:9443/api/am/publisher/v2/api-products/d48a3412-1b85-49be-99f4-b81a3722ae73/thumbnail"' + operationId: updateAPIProductThumbnail + + /api-products/{apiProductId}/swagger: + get: + tags: + - API Products + summary: Get Swagger Definition + description: | + This operation can be used to retrieve the swagger definition of an API. + parameters: + - $ref: '#/components/parameters/apiProductId' + - $ref: '#/components/parameters/Accept' + - $ref: '#/components/parameters/If-None-Match' + responses: + 200: + description: | + OK. + Requested swagger document of the API is returned + headers: + ETag: + description: | + Entity Tag of the response resource. Used by caches, or in conditional requests (Will be supported in future). + schema: + type: string + Last-Modified: + description: | + Date and time the resource has been modifed the last time. + Used by caches, or in conditional requests (Will be supported in future). + schema: + type: string + Content-Type: + description: | + The content type of the body. + schema: + type: string + content: {} + 304: + description: | + Not Modified. + Empty body because the client has already the latest version of the requested resource (Will be supported in future). + content: {} + 404: + $ref: '#/components/responses/NotFound' + 406: + $ref: '#/components/responses/NotAcceptable' + security: + - OAuth2Security: + - apim:api_publish + x-code-samples: + - lang: Curl + source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" + "https://127.0.0.1:9443/api/am/publisher/v2/api-products/5bca47e1-8233-46a5-9295-525dca337f33/swagger"' + operationId: getAPIProductSwagger + + /api-products/{apiProductId}/is-outdated: + get: + tags: + - API Products + summary: Check Whether API Product is Outdated + description: | + This operation can be used to retrieve the status indicating if an API Product is outdated due to updating of dependent APIs (This resource is not supported at the moment) + parameters: + - $ref: '#/components/parameters/apiProductId' + - $ref: '#/components/parameters/Accept' + - $ref: '#/components/parameters/If-None-Match' + responses: + 200: + description: | + OK. + Requested swagger document of the API is returned + headers: + ETag: + description: | + Entity Tag of the response resource. Used by caches, or in conditional requests (Will be supported in future). + schema: + type: string + Last-Modified: + description: | + Date and time the resource has been modifed the last time. + Used by caches, or in conditional requests (Will be supported in future). + schema: + type: string + Content-Type: + description: | + The content type of the body. + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/APIProductOutdatedStatus' + 304: + description: | + Not Modified. + Empty body because the client has already the latest version of the requested resource (Will be supported in future). + content: {} + 404: + $ref: '#/components/responses/NotFound' + 406: + $ref: '#/components/responses/NotAcceptable' + security: + - OAuth2Security: + - apim:api_publish + operationId: getIsAPIProductOutdated + + /api-products/{apiProductId}/documents: + get: + tags: + - API Product Documents + summary: Get a List of Documents of an API Product + description: | + This operation can be used to retrive a list of documents belonging to an API Product by providing the id of the API Product. + parameters: + - $ref: '#/components/parameters/apiProductId' + - $ref: '#/components/parameters/limit' + - $ref: '#/components/parameters/offset' + - $ref: '#/components/parameters/Accept' + - $ref: '#/components/parameters/If-None-Match' + responses: + 200: + description: | + OK. + Document list is returned. + headers: + ETag: + description: | + Entity Tag of the response resource. Used by caches, or in conditional requests (Will be supported in future). + schema: + type: string + Content-Type: + description: | + The content type of the body. + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/DocumentList' + 304: + description: | + Not Modified. + Empty body because the client has already the latest version of the requested resource (Will be supported in future). + content: {} + 404: + $ref: '#/components/responses/NotFound' + 406: + $ref: '#/components/responses/NotAcceptable' + security: + - OAuth2Security: + - apim:api_publish + x-code-samples: + - lang: Curl + source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" + "https://127.0.0.1:9443/api/am/publisher/v2/api-products/5bca47e1-8233-46a5-9295-525dca337f33/documents"' + operationId: getAPIProductDocuments + + post: + tags: + - API Product Documents + summary: Add a New Document to an API Product + description: | + This operation can be used to add a new documentation to an API Product. This operation only adds the metadata of a document. To add the actual content we need to use **Upload the content of an API Product document ** API once we obtain a document Id by this operation. + parameters: + - $ref: '#/components/parameters/apiProductId' + requestBody: + description: Document object that needs to be added + content: + application/json: + schema: + $ref: '#/components/schemas/Document' + required: true + responses: + 201: + description: | + Created. + Successful response with the newly created Document object as entity in the body. + Location header contains URL of newly added document. + headers: + ETag: + description: | + Entity Tag of the response resource. + Used by caches, or in conditional requests (Will be supported in future). + schema: + type: string + Location: + description: | + Location to the newly created Document. + schema: + type: string + Content-Type: + description: | + The content type of the body. + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/Document' + 400: + $ref: '#/components/responses/BadRequest' + 415: + $ref: '#/components/responses/UnsupportedMediaType' + security: + - OAuth2Security: + - apim:api_publish + x-code-samples: + - lang: Curl + source: 'curl -k -X POST -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" + -H "Content-Type: application/json" -d @data.json "https://127.0.0.1:9443/api/am/publisher/v2/api-products/5bca47e1-8233-46a5-9295-525dca337f33/documents"' + operationId: addAPIProductDocument + + /api-products/{apiProductId}/documents/{documentId}: + get: + tags: + - API Product Documents + summary: Get a Document of an API Product + description: | + This operation can be used to retrieve a particular document's metadata associated with an API. + parameters: + - $ref: '#/components/parameters/apiProductId' + - $ref: '#/components/parameters/documentId' + - $ref: '#/components/parameters/Accept' + - $ref: '#/components/parameters/If-None-Match' + responses: + 200: + description: | + OK. + Document returned. + headers: + ETag: + description: | + Entity Tag of the response resource. + Used by caches, or in conditional requests (Will be supported in future). + schema: + type: string + Last-Modified: + description: | + Date and time the resource has been modifed the last time. + Used by caches, or in conditional requests (Will be supported in future). + schema: + type: string + Content-Type: + description: | + The content type of the body. + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/Document' + 304: + description: | + Not Modified. + Empty body because the client has already the latest version of the requested resource (Will be supported in future). + content: {} + 404: + $ref: '#/components/responses/NotFound' + 406: + $ref: '#/components/responses/NotAcceptable' + security: + - OAuth2Security: + - apim:api_publish + x-code-samples: + - lang: Curl + source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" + "https://127.0.0.1:9443/api/am/publisher/v2/api-products/5bca47e1-8233-46a5-9295-525dca337f33/documents/83312daf-0d8a-427b-8f72-12755b7901d3"' + operationId: getAPIProductDocument + + put: + tags: + - API Product Documents + summary: Update a Document of an API Product + description: | + This operation can be used to update metadata of an API's document. + parameters: + - $ref: '#/components/parameters/apiProductId' + - $ref: '#/components/parameters/documentId' + - $ref: '#/components/parameters/If-Match' + requestBody: + description: Document object that needs to be added + content: + application/json: + schema: + $ref: '#/components/schemas/Document' + required: true + responses: + 200: + description: | + OK. + Document updated + headers: + ETag: + description: | + Entity Tag of the response resource. + Used by caches, or in conditional requests (Will be supported in future). + schema: + type: string + Last-Modified: + description: | + Date and time the resource has been modifed the last time. + Used by caches, or in conditional requests (Will be supported in future). + schema: + type: string + Location: + description: | + The URL of the updated document. + schema: + type: string + Content-Type: + description: | + The content type of the body. + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/Document' + 400: + $ref: '#/components/responses/BadRequest' + 404: + $ref: '#/components/responses/NotFound' + 412: + $ref: '#/components/responses/PreconditionFailed' + security: + - OAuth2Security: + - apim:api_publish + x-code-samples: + - lang: Curl + source: 'curl -k -X PUT -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" + -H "Content-Type: application/json" -d @data.json "https://127.0.0.1:9443/api/am/publisher/v2/api-products/5bca47e1-8233-46a5-9295-525dca337f33/documents/83312daf-0d8a-427b-8f72-12755b7901d3"' + operationId: updateAPIProductDocument + + delete: + tags: + - API Product Documents + summary: Delete a Document of an API Product + description: | + This operation can be used to delete a document associated with an API Product. + parameters: + - $ref: '#/components/parameters/apiProductId' + - $ref: '#/components/parameters/documentId' + - $ref: '#/components/parameters/If-Match' + responses: + 200: + description: | + OK. + Resource successfully deleted. + content: {} + 404: + $ref: '#/components/responses/NotFound' + 412: + $ref: '#/components/responses/PreconditionFailed' + security: + - OAuth2Security: + - apim:api_publish + x-code-samples: + - lang: Curl + source: 'curl -k -X DELETE -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" + "https://127.0.0.1:9443/api/am/publisher/v2/api-products/5bca47e1-8233-46a5-9295-525dca337f33/documents/83312daf-0d8a-427b-8f72-12755b7901d3"' + operationId: deleteAPIProductDocument + + /api-products/{apiProductId}/documents/{documentId}/content: + get: + tags: + - API Product Documents + summary: Get the Content of an API Product Document + description: | + This operation can be used to retrive the content of an API's document. + + The document can be of 3 types. In each cases responses are different. + + 1. **Inline type**: + The content of the document will be retrieved in `text/plain` content type + + _Sample cURL_ : `curl -k -H "Authorization:Bearer 579f0af4-37be-35c7-81a4-f1f1e9ee7c51" -F inlineContent=@"docs.txt" -X POST "https://localhost:9443/api/am/publisher/v2/apis/995a4972-3178-4b17-a374-756e0e19127c/documents/43c2bcce-60e7-405f-bc36-e39c0c5e189e/content` + 2. **FILE type**: + The file will be downloaded with the related content type (eg. `application/pdf`) + 3. **URL type**: + The client will recieve the URL of the document as the Location header with the response with - `303 See Other` + parameters: + - $ref: '#/components/parameters/apiProductId' + - $ref: '#/components/parameters/documentId' + - $ref: '#/components/parameters/Accept' + - $ref: '#/components/parameters/If-None-Match' + responses: + 200: + description: | + OK. + File or inline content returned. + headers: + ETag: + description: | + Entity Tag of the response resource. + Used by caches, or in conditional requests (Will be supported in future). + schema: + type: string + Last-Modified: + description: | + Date and time the resource has been modifed the last time. + Used by caches, or in conditional requests (Will be supported in future). + schema: + type: string + Content-Type: + description: | + The content type of the body. + schema: + type: string + content: {} + 303: + description: | + See Other. + Source can be retrived from the URL specified at the Location header. + headers: + Location: + description: | + The Source URL of the document. + schema: + type: string + content: {} + 304: + description: | + Not Modified. + Empty body because the client has already the latest version of the requested resource (Will be supported in future). + content: {} + 404: + $ref: '#/components/responses/NotFound' + 406: + $ref: '#/components/responses/NotAcceptable' + security: + - OAuth2Security: + - apim:api_publish + x-code-samples: + - lang: Curl + source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" + "https://127.0.0.1:9443/api/am/publisher/v2/api-products/5bca47e1-8233-46a5-9295-525dca337f33/documents/83312daf-0d8a-427b-8f72-12755b7901d3/content"' + operationId: getAPIProductDocumentContent + + post: + tags: + - API Product Documents + summary: Upload the Content of an API Product Document + description: | + Thid operation can be used to upload a file or add inline content to an API Product document. + + **IMPORTANT:** + * Either **file** or **inlineContent** form data parameters should be specified at one time. + * Document's source type should be **FILE** in order to upload a file to the document using **file** parameter. + * Document's source type should be **INLINE** in order to add inline content to the document using **inlineContent** parameter. + parameters: + - $ref: '#/components/parameters/apiProductId' + - $ref: '#/components/parameters/documentId' + - $ref: '#/components/parameters/If-Match' + requestBody: + content: + multipart/form-data: + schema: + properties: + file: + type: string + description: Document to upload + format: binary + inlineContent: + type: string + description: Inline content of the document + responses: + 200: + description: | + OK. + Document updated + headers: + ETag: + description: | + Entity Tag of the response resource. + Used by caches, or in conditional requests (Will be supported in future). + schema: + type: string + Last-Modified: + description: | + Date and time the resource has been modifed the last time. + Used by caches, or in conditional requests (Will be supported in future). + schema: + type: string + Location: + description: | + The URL of the updated content of the document. + schema: + type: string + Content-Type: + description: | + The content type of the body. + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/Document' + 400: + $ref: '#/components/responses/BadRequest' + 404: + $ref: '#/components/responses/NotFound' + 412: + $ref: '#/components/responses/PreconditionFailed' + security: + - OAuth2Security: + - apim:api_publish + x-code-samples: + - lang: Curl + source: 'curl -k -X POST -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" + -H "Content-Type: multipart/form-data" -F file=@sample.pdf "https://127.0.0.1:9443/api/am/publisher/v2/api-products/5bca47e1-8233-46a5-9295-525dca337f33/documents/83312daf-0d8a-427b-8f72-12755b7901d3/content"' + operationId: addAPIProductDocumentContent + + ###################################################### + # The "API Product Revisions" resource API + ###################################################### + /api-products/{apiProductId}/revisions: + + #-------------------------------------------- + # List available revisions of an API Product + #-------------------------------------------- + get: + tags: + - API Product Revisions + summary: List available revisions of an API Product + description: | + List available revisions of an API Product + operationId: getAPIProductRevisions + parameters: + - $ref: '#/components/parameters/apiProductId' + - name: query + in: query + schema: + type: string + responses: + 200: + description: | + OK. + List of API Product revisions are returned. + content: + application/json: + schema: + $ref: '#/components/schemas/APIRevisionList' + 404: + $ref: '#/components/responses/NotFound' + security: + - OAuth2Security: + - apim:api_publish + - apim:api_product_import_export + x-code-samples: + - lang: Curl + source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" + "https://127.0.0.1:9443/api/am/publisher/v2/api-products/890a4f4d-09eb-4877-a323-57f6ce2ed79b/revisions?query=deployed:true"' + + #-------------------------------------------- + # Create a new API Product revision + #-------------------------------------------- + post: + tags: + - API Product Revisions + summary: Create a new API Product revision + description: | + Create a new API Product revision + operationId: createAPIProductRevision + parameters: + - $ref: '#/components/parameters/apiProductId' + requestBody: + description: API Product object that needs to be added + content: + application/json: + schema: + $ref: '#/components/schemas/APIRevision' + responses: + 201: + description: | + Created. + Successful response with the newly created APIRevision object as the entity in the body. + content: + application/json: + schema: + $ref: '#/components/schemas/APIRevision' + 404: + $ref: '#/components/responses/NotFound' + 412: + $ref: '#/components/responses/PreconditionFailed' + security: + - OAuth2Security: + - apim:api_publish + x-code-samples: + - lang: Curl + source: 'curl -k -X POST -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" + -H "Content-Type: application/json" -d @data.json + "https://127.0.0.1:9443/api/am/publisher/v2/api-products/890a4f4d-09eb-4877-a323-57f6ce2ed79b/revisions"' + + ###################################################### + # The "API Revisions" individual resource API Product + ###################################################### + /api-products/{apiProductId}/revisions/{revisionId}: + + #-------------------------------------------- + # Get a revision + #-------------------------------------------- + get: + tags: + - API Product Revisions + summary: Retrieve a revision of an API Product + description: | + Retrieve a revision of an API Product + operationId: getAPIProductRevision + parameters: + - $ref: '#/components/parameters/apiProductId' + - $ref: '#/components/parameters/revisionId' + responses: + 200: + description: | + OK. + An API revision is returned. + content: + application/json: + schema: + $ref: '#/components/schemas/APIRevision' + 404: + $ref: '#/components/responses/NotFound' + security: + - OAuth2Security: + - apim:api_publish + x-code-samples: + - lang: Curl + source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" + "https://127.0.0.1:9443/api/am/publisher/v2/api-products/890a4f4d-09eb-4877-a323-57f6ce2ed79b/revisions/e0824883-3e86-403a-aec1-22bbc454eb7c"' + + #-------------------------------------------- + # Delete a revision + #-------------------------------------------- + delete: + tags: + - API Product Revisions + summary: Delete a revision of an API Product + description: | + Delete a revision of an API Product + operationId: deleteAPIProductRevision + parameters: + - $ref: '#/components/parameters/apiProductId' + - $ref: '#/components/parameters/revisionId' + responses: + 200: + description: | + OK. + List of remaining API revisions are returned. + content: + application/json: + schema: + $ref: '#/components/schemas/APIRevisionList' + 204: + description: | + No Content. + Successfully deleted the revision + 404: + $ref: '#/components/responses/NotFound' + security: + - OAuth2Security: + - apim:api_publish + x-code-samples: + - lang: Curl + source: 'curl -k -X DELETE -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" + "https://127.0.0.1:9443/api/am/publisher/v2/api-products/890a4f4d-09eb-4877-a323-57f6ce2ed79b/revisions/e0824883-3e86-403a-aec1-22bbc454eb7c"' + + /api-products/{apiProductId}/deploy-revision: + + #-------------------------------------------- + # List available deployed revision deployment details of an API Product + #-------------------------------------------- + get: + tags: + - API Product Revisions + summary: List available deployed revision deployment details of an API Product + description: | + List available deployed revision deployment details of an API Product + operationId: getAPIProductRevisionDeployments + parameters: + - $ref: '#/components/parameters/apiProductId' + responses: + 200: + description: | + OK. + List of deployed revision deployment details are returned. + content: + application/json: + schema: + $ref: '#/components/schemas/APIRevisionDeploymentList' + 404: + $ref: '#/components/responses/NotFound' + security: + - OAuth2Security: + - apim:api_publish + x-code-samples: + - lang: Curl + source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" + "https://127.0.0.1:9443/api/am/publisher/v2/api-products/890a4f4d-09eb-4877-a323-57f6ce2ed79b/deploy-revision"' + + #-------------------------------------------- + # Deploy a revision + #-------------------------------------------- + post: + tags: + - API Product Revisions + summary: Deploy a revision + description: | + Deploy a revision + operationId: deployAPIProductRevision + parameters: + - $ref: '#/components/parameters/apiProductId' + - $ref: '#/components/parameters/revisionId-Q' + requestBody: + description: Deployment object that needs to be added + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/APIRevisionDeployment' + responses: + 200: + description: | + OK. + 201: + description: | + Created. + Successful response with the newly deployed APIRevisionDeployment List object as the entity in the body. + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/APIRevisionDeployment' + 404: + $ref: '#/components/responses/NotFound' + security: + - OAuth2Security: + - apim:api_publish + x-code-samples: + - lang: Curl + source: 'curl -k -X POST -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" + "https://127.0.0.1:9443/api/am/publisher/v2/api-products/890a4f4d-09eb-4877-a323-57f6ce2ed79b/deploy-revision?revisionId=e0824883-3e86-403a-aec1-22bbc454eb7c"' + + /api-products/{apiProductId}/undeploy-revision: + #-------------------------------------------- + # Un-Deploy a revision from deployed gateway + #-------------------------------------------- + post: + tags: + - API Product Revisions + summary: Un-Deploy a revision + description: | + Un-Deploy a revision + operationId: undeployAPIProductRevision + parameters: + - $ref: '#/components/parameters/apiProductId' + - $ref: '#/components/parameters/revisionId-Q' + - $ref: '#/components/parameters/revisionNum-Q' + - name: allEnvironments + in: query + schema: + type: boolean + default: false + requestBody: + description: Deployment object that needs to be added + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/APIRevisionDeployment' + responses: + 200: + description: | + OK. + 201: + description: | + Created. + Successful response with the newly undeployed APIRevisionDeploymentList object as the entity in the body. + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/APIRevisionDeployment' + 404: + $ref: '#/components/responses/NotFound' + security: + - OAuth2Security: + - apim:api_publish + - apim:api_product_import_export + x-code-samples: + - lang: Curl + source: 'curl -k -X POST -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" + "https://127.0.0.1:9443/api/am/publisher/v2/api-products/890a4f4d-09eb-4877-a323-57f6ce2ed79b/undeploy-revision?revisionId=e0824883-3e86-403a-aec1-22bbc454eb7c"' + + /api-products/{apiProductId}/restore-revision: + + #-------------------------------------------------------- + # Restore a revision to the working copy of the API Product + #-------------------------------------------------------- + post: + tags: + - API Product Revisions + summary: Restore a revision + description: | + Restore a revision to the working copy of the API Product + operationId: restoreAPIProductRevision + parameters: + - $ref: '#/components/parameters/apiProductId' + - $ref: '#/components/parameters/revisionId-Q' + responses: + 201: + description: | + Restored. + Successful response with the newly restored API Product object as the entity in the body. + content: + application/json: + schema: + $ref: '#/components/schemas/APIProduct' + 404: + $ref: '#/components/responses/NotFound' + security: + - OAuth2Security: + - apim:api_publish + x-code-samples: + - lang: Curl + source: 'curl -k -X POST -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" + "https://127.0.0.1:9443/api/am/publisher/v2/api-products/890a4f4d-09eb-4877-a323-57f6ce2ed79b/restore-revision?revisionId=e0824883-3e86-403a-aec1-22bbc454eb7c"' + + /api-products/export: + get: + tags: + - Import Export + summary: Export an API Product + description: | + This operation can be used to export the details of a particular API Product as a zip file. + parameters: + - name: name + in: query + description: | + API Product Name + schema: + type: string + - name: version + in: query + description: | + Version of the API Product + schema: + type: string + - name: providerName + in: query + description: | + Provider name of the API Product + schema: + type: string + - name: revisionNumber + in: query + description: | + Revision number of the API Product + schema: + type: string + - name: format + in: query + description: | + Format of output documents. Can be YAML or JSON. + schema: + type: string + enum: + - JSON + - YAML + - name: preserveStatus + in: query + description: | + Preserve API Product Status on export + schema: + type: boolean + - name: latestRevision + in: query + description: | + Export the latest revision of the API Product + schema: + type: boolean + default: false + responses: + 200: + description: | + OK. + Export Successful. + headers: + Content-Type: + description: | + The content type of the body. + schema: + type: string + content: + application/zip: + schema: + type: string + format: binary + 404: + $ref: '#/components/responses/NotFound' + 500: + $ref: '#/components/responses/InternalServerError' + security: + - OAuth2Security: + - apim:api_import_export + x-code-samples: + - lang: Curl + source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" + "https://127.0.0.1:9443/api/am/publisher/v2/api-products/export?name=LeasingAPIProduct&version=1.0.0&revisionNumber=2&provider=admin&format=YAML" + > exportAPIProduct.zip' + operationId: exportAPIProduct + + /api-products/import: + post: + tags: + - Import Export + summary: Import an API Product + description: | + This operation can be used to import an API Product. + parameters: + - name: preserveProvider + in: query + description: | + Preserve Original Provider of the API Product. This is the user choice to keep or replace the API Product provider + required: false + schema: + type: boolean + - name: rotateRevision + in: query + description: | + Once the revision max limit reached, undeploy and delete the earliest revision and create a new revision + required: false + schema: + type: boolean + - name: importAPIs + in: query + description: | + Whether to import the dependent APIs or not. + schema: + type: boolean + - name: overwriteAPIProduct + in: query + description: | + Whether to update the API Product or not. This is used when updating already existing API Products. + schema: + type: boolean + - name: overwriteAPIs + in: query + description: | + Whether to update the dependent APIs or not. This is used when updating already existing dependent APIs of an API Product. + schema: + type: boolean + requestBody: + content: + multipart/form-data: + schema: + required: + - file + properties: + file: + type: string + description: | + Zip archive consisting on exported API Product configuration + format: binary + responses: + 200: + description: | + Created. + API Product Imported Successfully. + content: {} + 403: + $ref: '#/components/responses/Forbidden' + 404: + $ref: '#/components/responses/NotFound' + 409: + $ref: '#/components/responses/Conflict' + 500: + $ref: '#/components/responses/InternalServerError' + security: + - OAuth2Security: + - apim:api_product_import_export + x-code-samples: + - lang: Curl + source: 'curl -k -X POST -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" + -F file=@admin-PizzaShackAPIProduct.zip "https://127.0.0.1:9443/api/am/admin/v2/api-products/importt?preserveProvider=false&overwriteAPIProduct=false&overwriteAPIs=false&importAPIs=false"' + operationId: importAPIProduct + + ###################################################### + # Roles resource APIs + ###################################################### + /roles/{roleId}: + head: + tags: + - Roles + summary: Check Whether Given Role Name already Exist + description: | + Using this operation, user can check a given role name exists or not. + operationId: validateSystemRole + parameters: + - $ref: '#/components/parameters/roleId' + responses: + 200: + description: OK. Requested role name exists. + content: {} + 404: + $ref: '#/components/responses/NotFound' + security: + - OAuth2Security: + - apim:api_create + - apim:api_publish + x-code-samples: + - lang: Curl + source: 'curl -k -I -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" + "https://127.0.0.1:9443/api/am/publisher/v2/roles/SW50ZXJuYWwvcHVibGlzaGVyCQ"' + + /me/roles/{roleId}: + head: + tags: + - Roles + summary: Validate Whether the Logged-in User has the Given Role + description: | + Using this operation, logged-in user can check whether he has given role. + operationId: validateUserRole + parameters: + - $ref: '#/components/parameters/roleId' + responses: + 200: + description: OK. Requested user has the role. + content: {} + 404: + $ref: '#/components/responses/NotFound' + security: + - OAuth2Security: + - apim:api_create + x-code-samples: + - lang: Curl + source: 'curl -k -I -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" + "https://127.0.0.1:9443/api/am/publisher/v2/me/roles/SW50ZXJuYWwvcHVibGlzaGVyCQ"' + + ###################################################### + # The "ExternalStore Collection" resource APIs + ###################################################### + /external-stores: + get: + tags: + - External Stores + summary: Retrieve External Stores List to Publish an API + description: | + Retrieve external stores list configured to publish an API + operationId: getAllExternalStores + responses: + 200: + description: | + OK. + External Stores list returned + content: + application/json: + schema: + $ref: '#/components/schemas/ExternalStore' + 500: + $ref: '#/components/responses/InternalServerError' + security: + - OAuth2Security: + - apim:api_view + x-code-samples: + - lang: Curl + source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" + "https://127.0.0.1:9443/api/am/publisher/v2/external-stores"' + + ###################################################### + # The Publisher settings resource APIs + ###################################################### + /settings: + get: + tags: + - Settings + summary: Retreive Publisher Settings + description: | + Retreive publisher settings + responses: + 200: + description: | + OK. + Settings returned + content: + application/json: + schema: + $ref: '#/components/schemas/Settings' + 404: + $ref: '#/components/responses/NotFound' + security: + - OAuth2Security: + - apim:publisher_settings + x-code-samples: + - lang: Curl + source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" + "https://127.0.0.1:9443/api/am/publisher/v2/settings"' + operationId: getSettings + + ###################################################### + # The tenant resource APIs + ###################################################### + /tenants: + get: + tags: + - Tenants + summary: | + Get Tenants by State + description: | + This operation is to get tenants by state + operationId: getTenantsByState + parameters: + - name: state + in: query + description: | + The state represents the current state of the tenant + + Supported states are [active, inactive] + schema: + type: string + default: active + enum: + - active + - inactive + - $ref: '#/components/parameters/limit' + - $ref: '#/components/parameters/offset' + responses: + 200: + description: | + OK. + Tenant names returned. + headers: + Content-Type: + description: | + The content type of the body. + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/TenantList' + 404: + $ref: '#/components/responses/NotFound' + 406: + $ref: '#/components/responses/NotAcceptable' + security: + - OAuth2Security: + - apim:api_view + x-code-samples: + - lang: Curl + source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" + "https://127.0.0.1:9443/api/am/publisher/v2/tenants?state=active"' + + /tenants/{tenantDomain}: + head: + tags: + - Tenants + summary: Check Whether the Given Tenant already Exists + description: | + Using this operation, user can check whether a given tenant exists or not. + operationId: getTenantExistence + parameters: + - $ref: '#/components/parameters/tenantDomain' + responses: + 200: + description: OK. Requested tenant exists. + content: {} + 404: + $ref: '#/components/responses/NotFound' + security: + - OAuth2Security: + - apim:api_view + x-code-samples: + - lang: Curl + source: 'curl -k -I -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" + "https://127.0.0.1:9443/api/am/publisher/v2/tenants/wso2.com"' + x-examples: + $ref: docs/examples/tenants/tenants.yaml + + #################################################### + # Publisher Alerts management REST API + #################################################### + /alert-types: + get: + tags: + - Alerts + summary: | + Get the list of API Publisher alert types. + description: | + This operation is used to get the list of supportd alert types for the 'publisher' agent. + operationId: getPublisherAlertTypes + responses: + 200: + description: | + OK. + The list of publisher alert types are returned. + headers: + Content-Type: + description: | + The content type of the body. + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/AlertTypesList' + 500: + $ref: '#/components/responses/InternalServerError' + security: + - OAuth2Security: + - apim:pub_alert_manage + x-code-samples: + - lang: Curl + source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" + "https://127.0.0.1:9443/api/am/publisher/v2/alert-types"' + x-examples: + $ref: docs/examples/alerts/alerts.yaml#/get + + /alert-subscriptions: + get: + tags: + - Alert Subscriptions + summary: | + Get the List of API Publisher Alert Types Subscribed by the User + description: | + This operation is used to get the list of subscribed alert types by the user. + operationId: getSubscribedAlertTypes + responses: + 200: + description: | + OK. + The list of subscribed alert types are returned. + headers: + Content-Type: + description: | + The content type of the body. + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/AlertsInfo' + 500: + $ref: '#/components/responses/InternalServerError' + security: + - OAuth2Security: + - apim:pub_alert_manage + x-code-samples: + - lang: Curl + source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" + "https://127.0.0.1:9443/api/am/publisher/v2/alert-subscriptions"' + x-examples: + $ref: docs/examples/alerts/alerts_subscriptions.yaml#/get + + put: + tags: + - Alert Subscriptions + summary: | + Subscribe to the Selected Tlert types by the User + description: | + This operation is used to get the list of subscribed alert types by the user. + operationId: subscribeToAlerts + requestBody: + description: The alerts list and the email list to subscribe. + content: + application/json: + schema: + $ref: '#/components/schemas/AlertsInfo' + required: true + responses: + 201: + description: | + OK. + Successful response with the newly subscribed alerts. + headers: + Content-Type: + description: | + The content type of the body. + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/AlertsInfoResponse' + 400: + $ref: '#/components/responses/BadRequest' + 500: + $ref: '#/components/responses/InternalServerError' + security: + - OAuth2Security: + - apim:pub_alert_manage + x-code-samples: + - lang: Curl + source: 'curl -k -X PUT -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" + -H "Content-Type: application/json" -d @data.json "https://127.0.0.1:9443/api/am/publisher/v2/alert-subscriptions"' + x-examples: + $ref: docs/examples/alerts/alerts_subscriptions.yaml#/put + + delete: + tags: + - Alert Subscriptions + summary: | + Unsubscribe User from All the Alert Types + description: | + This operation is used to unsubscribe the respective user from all the alert types. + operationId: unsubscribeAllAlerts + responses: + 200: + description: | + OK. + The user is unsubscribed from the alerts successfully. + headers: + Content-Type: + description: | + The content type of the body. + schema: + type: string + content: {} + 500: + $ref: '#/components/responses/InternalServerError' + security: + - OAuth2Security: + - apim:pub_alert_manage + x-code-samples: + - lang: Curl + source: 'curl -k -X DELETE -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" + "https://127.0.0.1:9443/api/am/publisher/v2/alert-subscriptions"' + x-examples: + $ref: docs/examples/alerts/alerts_subscriptions.yaml#/delete + + /alerts/{alertType}/configurations: + get: + tags: + - Alert Configuration + summary: | + Get All AbnormalRequestsPerMin Alert Configurations + description: | + This operation is used to get all configurations of the AbnormalRequestsPerMin alert type. + operationId: getAllAlertConfigs + parameters: + - $ref: '#/components/parameters/alertType' + responses: + 200: + description: | + OK. + The Developer Portal alert configuration. + headers: + Content-Type: + description: | + The content type of the body. + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/AlertConfigList' + 500: + $ref: '#/components/responses/InternalServerError' + security: + - OAuth2Security: + - apim:pub_alert_manage + x-code-samples: + - lang: Curl + source: 'curl -k -X DELETE -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" + "https://127.0.0.1:9443/api/am/publisher/v2/alerts/{alertType}/configurations"' + x-examples: + $ref: docs/examples/alerts/alerts_config.yaml#/get + + /alerts/{alertType}/configurations/{configurationId}: + put: + tags: + - Alert Configuration + summary: | + Add AbnormalRequestsPerMin Alert Configurations. + description: | + This operation is used to add configuration for the AbnormalRequestsPerMin alert type. + operationId: addAlertConfig + parameters: + - $ref: '#/components/parameters/alertType' + - $ref: '#/components/parameters/configurationId' + requestBody: + description: Configuration for AbnormalRequestCount alert type + content: + application/json: + schema: + $ref: '#/components/schemas/AlertConfigInfo' + required: true + responses: + 201: + description: | + Created. + Successful response with newly created object as entity. + Location header contains URL of newly created entity. + headers: + Location: + description: | + The location of the newly created entity. + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/AlertConfig' + 400: + $ref: '#/components/responses/BadRequest' + 500: + $ref: '#/components/responses/InternalServerError' + security: + - OAuth2Security: + - apim:pub_alert_manage + x-examples: + $ref: docs/examples/alerts/alerts_config.yaml#/put + + delete: + tags: + - Alert Configuration + summary: | + Delete the Selected Configuration from AbnormalRequestsPerMin Alert Type. + description: | + This operation is used to delete configuration from the AbnormalRequestsPerMin alert type. + operationId: deleteAlertConfig + parameters: + - $ref: '#/components/parameters/alertType' + - $ref: '#/components/parameters/configurationId' + responses: + 200: + description: | + OK. + The alert config is deleted successfully. + content: {} + 400: + $ref: '#/components/responses/BadRequest' + 404: + $ref: '#/components/responses/NotFound' + 500: + $ref: '#/components/responses/InternalServerError' + security: + - OAuth2Security: + - apim:pub_alert_manage + x-examples: + $ref: docs/examples/alerts/alerts_config.yaml#/delete + + ###################################################### + # The "Label Collection" resource API + ###################################################### + /labels: + get: + tags: + - Label Collection + summary: Get all Registered Labels + description: | + Get all registered Labels + responses: + 200: + description: | + OK. + Labels returned + content: + application/json: + schema: + $ref: '#/components/schemas/LabelList' + security: + - OAuth2Security: + - apim:api_view + x-code-samples: + - lang: Curl + source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" + "https://127.0.0.1:9443/api/am/publisher/v2/labels"' + operationId: getLabels + + ###################################################### + # The "API Category Collection" resource API + ###################################################### + /api-categories: + get: + tags: + - API Category (Collection) + summary: Get all API categories + description: | + Get all API categories + responses: + 200: + description: | + OK. + Categories returned + content: + application/json: + schema: + $ref: '#/components/schemas/APICategoryList' + security: + - OAuth2Security: + - apim:api_view + x-code-samples: + - lang: Curl + source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" + "https://127.0.0.1:9443/api/am/publisher/v2/api-categories"' + operationId: getAllAPICategories + + ###################################################### + # The "Scopes" resource APIs + ###################################################### + /scopes: + get: + tags: + - Scopes + summary: Get All Available Shared Scopes + description: | + This operation can be used to get all the available Shared Scopes. + operationId: getSharedScopes + parameters: + - $ref: '#/components/parameters/limit' + - $ref: '#/components/parameters/offset' + responses: + 200: + description: | + OK. + Shared Scope list is returned. + headers: + Content-Type: + description: | + The content type of the body. + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/ScopeList' + 500: + $ref: '#/components/responses/InternalServerError' + security: + - OAuth2Security: + - apim:api_view + x-code-samples: + - lang: Curl + source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" + "https://127.0.0.1:9443/api/am/publisher/v2/scopes"' + + post: + tags: + - Scopes + summary: Add a New Shared Scope + description: | + This operation can be used to add a new Shared Scope. + operationId: addSharedScope + requestBody: + description: Scope object that needs to be added + content: + application/json: + schema: + $ref: '#/components/schemas/Scope' + required: true + responses: + 201: + description: | + Created. + Successful response with the newly created Scope object as an entity in the body. + headers: + Content-Type: + description: | + The content type of the body. + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/Scope' + 400: + $ref: '#/components/responses/BadRequest' + 415: + $ref: '#/components/responses/UnsupportedMediaType' + security: + - OAuth2Security: + - apim:shared_scope_manage + x-code-samples: + - lang: Curl + source: 'curl -k -X POST -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" + -H "Content-Type: application/json" -d @data.json "https://127.0.0.1:9443/api/am/publisher/v2/scopes"' + + /scopes/{scopeId}: + get: + tags: + - Scopes + summary: Get a Shared Scope by Scope Id + description: | + This operation can be used to retrieve details of a Shared Scope by a given scope Id. + operationId: getSharedScope + parameters: + - $ref: '#/components/parameters/scopeId' + responses: + 200: + description: | + OK. + Requested Shared Scope is returned. + headers: + Content-Type: + description: | + The content type of the body. + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/Scope' + 404: + $ref: '#/components/responses/NotFound' + security: + - OAuth2Security: + - apim:api_view + x-code-samples: + - lang: Curl + source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" + "https://127.0.0.1:9443/api/am/publisher/v2/scopes/01234567-0123-0123-0123-012345678901"' + + put: + tags: + - Scopes + summary: Update a Shared Scope + description: | + This operation can be used to update a Shared Scope by a given scope Id. + operationId: updateSharedScope + parameters: + - $ref: '#/components/parameters/scopeId' + requestBody: + description: Scope object that needs to be updated + content: + application/json: + schema: + $ref: '#/components/schemas/Scope' + required: true + responses: + 200: + description: | + OK. + Successful response with updated Scope object + headers: + Content-Type: + description: | + The content type of the body. + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/Scope' + 400: + $ref: '#/components/responses/BadRequest' + 404: + $ref: '#/components/responses/NotFound' + security: + - OAuth2Security: + - apim:shared_scope_manage + x-code-samples: + - lang: Curl + source: 'curl -k -X PUT -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" + -H "Content-Type: application/json" -d @data.json "https://127.0.0.1:9443/api/am/publisher/v2/scopes/01234567-0123-0123-0123-012345678901"' + + delete: + tags: + - Scopes + summary: Delete a Shared Scope + description: | + This operation can be used to delete a Shared Scope proving the Id of the scope. + operationId: deleteSharedScope + parameters: + - $ref: '#/components/parameters/scopeId' + responses: + 200: + description: | + OK. + Resource successfully deleted. + content: {} + 404: + $ref: '#/components/responses/NotFound' + security: + - OAuth2Security: + - apim:shared_scope_manage + x-code-samples: + - lang: Curl + source: 'curl -k -X DELETE -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" + "https://127.0.0.1:9443/api/am/publisher/v2/scopes/01234567-0123-0123-0123-012345678901"' + + head: + tags: + - Scopes + summary: Check Given Scope Name already Exists + description: | + Using this operation, user can check a given scope name exists or not. + operationId: validateScope + parameters: + - $ref: '#/components/parameters/scopeName' + responses: + 200: + description: OK. Requested scope name exists. + content: {} + 404: + $ref: '#/components/responses/NotFound' + security: + - OAuth2Security: + - apim:api_create + - apim:api_publish + x-code-samples: + - lang: Curl + source: 'curl -k -I -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" + "https://127.0.0.1:9443/api/am/publisher/v2/scopes/YXBpbTphcGlfdmlldw"' + + /scopes/{scopeId}/usage: + get: + tags: + - Scopes + summary: Get usages of a Shared Scope by Scope Id + description: | + This operation can be used to retrieve usages of a Shared Scope by a given scope Id. + operationId: getSharedScopeUsages + parameters: + - $ref: '#/components/parameters/scopeId' + responses: + 200: + description: | + OK. + Usages of the shared scope is returned. + headers: + Content-Type: + description: | + The content type of the body. + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/SharedScopeUsage' + 404: + $ref: '#/components/responses/NotFound' + security: + - OAuth2Security: + - apim:api_view + x-code-samples: + - lang: Curl + source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" + "https://127.0.0.1:9443/api/am/publisher/v2/scopes/01234567-0123-0123-0123-012345678901/usage"' + + ###################################################### + # The "Key Managers Collection" resource API + ###################################################### + /key-managers: + get: + tags: + - Key Managers (Collection) + summary: Get All Key Managers + description: | + Get all Key managers + responses: + 200: + description: | + OK. + Categories returned + content: + application/json: + schema: + $ref: '#/components/schemas/KeyManagerList' + security: + - OAuth2Security: + - apim:api_create + x-code-samples: + - lang: Curl + source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" + "https://127.0.0.1:9443/api/am/publisher/v2/key-managers"' + operationId: getAllKeyManagers + + ###################################################### + # The "Deployments" resource APIs + ###################################################### + /deployments: + get: + tags: + - Deployments + summary: Retrieve Deployment Environments Details + description: | + This operation can be used to retrieve cloud clusters information defines in tenant-conf.json file. + + With that you can deploy an API to selected cloud environments. + operationId: deploymentsGet + responses: + 200: + description: | + OK. Successful response with the list of deployment environments information in the body. + headers: + Content-Type: + description: | + The content type of the body. + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/DeploymentList' + 400: + $ref: '#/components/responses/BadRequest' + 404: + $ref: '#/components/responses/NotFound' + 500: + $ref: '#/components/responses/InternalServerError' + security: + - OAuth2Security: + - apim:api_view + x-code-samples: + - lang: Curl + source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" + "https://127.0.0.1:9443/api/am/publisher/v2/deployments"' + + /apis/{apiId}/deployments: + get: + tags: + - DeploymentStatus + summary: Retrieve Deployment Status Details + description: | + This operation can be used to retrieve the status of deployments in cloud clusters. + + With that you can get the status of the deployed APIs in cloud environments. + operationId: deploymentsGetStatus + parameters: + - $ref: '#/components/parameters/apiId' + responses: + 200: + description: | + OK. Successful response with the list of deployment environments information in the body. + headers: + Content-Type: + description: | + The content type of the body. + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/DeploymentStatusList' + 400: + $ref: '#/components/responses/BadRequest' + 404: + $ref: '#/components/responses/NotFound' + 500: + $ref: '#/components/responses/InternalServerError' + security: + - OAuth2Security: + - apim:api_view + x-code-samples: + - lang: Curl + source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" + "https://127.0.0.1:9443/api/am/publisher/v2/apis/92bc1330-1848-4fe8-b992-c792186c212e/deployments/"' + + /apis/validate-asyncapi: + post: + tags: + - Validation + summary: Validate an AsyncAPI Specification + description: + This operation can be used to validate and AsyncAPI Specification and retrieve a summary. Provide either 'url' + or 'file' to specify the definition. + operationId: validateAsyncAPISpecification + parameters: + - name: returnContent + in: query + description: + Specify whether to return the full content of the AsyncAPI specification in the response. This is only + applicable when using url based validation + schema: + type: boolean + default: false + requestBody: + content: + multipart/form-data: + schema: + properties: + url: + type: string + description: AsyncAPI definition url + file: + type: string + description: AsyncAPI definition as a file + format: binary + responses: + 200: + description: + OK. + API definition validation information is returned + headers: + Content-Type: + description: + The content type of the body. + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/AsyncAPISpecificationValidationResponse' + 400: + $ref: '#/components/responses/BadRequest' + 404: + $ref: '#/components/responses/NotFound' + security: + - OAuth2Security: + - apim:api_create + + /apis/import-asyncapi: + post: + tags: + - APIs + summary: import an AsyncAPI Specification + description: + This operation can be used to create and API from the AsyncAPI Specification. Provide either 'url' or 'file' + to specify the definition. + + Specify additionalProperties with **at least** API's name, version, context and endpointConfig. + operationId: importAsyncAPISpecification + requestBody: + content: + multipart/form-data: + schema: + properties: + file: + type: string + description: Definition to upload as a file + format: binary + url: + type: string + description: Definition url + additionalProperties: + type: string + description: Additional attributes specified as a stringified JSON with API's schema + responses: + 201: + description: + Created. Successful response with the newly created object as entity in the body. + Location header contains URL of newly created entity. + headers: + Etag: + description: + Entity Tag of the respons resource. Used by caches, or in conditional requests (Will be supported in the future). + schema: + type: string + Location: + description: + The URL of the newly created resource. + schema: + type: string + Content-type: + description: + The content type of the body. + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/API' + 400: + $ref: '#/components/responses/BadRequest' + 415: + $ref: '#/components/responses/UnsupportedMediaType' + security: + - OAuth2Security: + - apim:api_create + + /apis/{apiId}/asyncapi: + get: + tags: + - APIs + summary: Get AsyncAPI definition + description: | + This operation can be used to retrieve the AsyncAPI definition of an API. + parameters: + - $ref: '#/components/parameters/apiId' + - $ref: '#/components/parameters/If-None-Match' + responses: + 200: + description: | + OK. + Requested AsyncAPI definition of the API is returned + headers: + ETag: + description: | + Entity Tag of the response resource. Used by caches, or in conditional requests (Willl= be supported in future). + schema: + type: string + Last-Modified: + description: | + Date and time the resource has beed modified the last time. + Used by caches, or in conditional request (Will be supported in future). + schema: + type: string + Content-Type: + description: | + The content type of the body. + schema: + type: string + content: + application/json: + schema: + type: string + example: "" + 304: + description: | + Not Modified. + Empty body because the client has already the latest version of the requested resource (Will be supported in future). + content: { } + 404: + $ref: '#/components/responses/NotFound' + 406: + $ref: '#/components/responses/NotAcceptable' + security: + - OAuth2Security: + - apim:api_view + + put: + tags: + - APIs + summary: Update AsyncAPI definition + description: | + This operation can be used to update the AsyncAPI definition of an existing API. AsyncAPI definition to be updated is passed as a form data parameter 'apiDefinition'. + parameters: + - $ref: '#/components/parameters/apiId' + - $ref: '#/components/parameters/If-Match' + requestBody: + content: + multipart/form-data: + schema: + properties: + apiDefinition: + type: string + description: AsyncAPI definition of the API + url: + type: string + description: AsyncAPI definition URL of the API + file: + type: string + description: AsyncAPI definition as a file + format: binary + responses: + 200: + description: | + OK. + Successful response with updated AsyncAPI definition + headers: + ETag: + description: | + Entity Tag of the response resource. Used by caches, or in conditional requests (Will be supported in future). + schema: + type: string + Last-Modified: + description: | + Date and time the resource has beed modified the last time. + Use =d by caches, or in conditional requests (Will be supported in future). + schema: + type: string + Location: + description: | + The URL of the newly created resource. + schema: + type: string + Content-Type: + description: | + The content type of the body. + schema: + type: string + content: + application/json: + schema: + type: string + example: "" + 400: + $ref: '#/components/responses/BadRequest' + 403: + $ref: '#/components/responses/Forbidden' + 404: + $ref: '#/components/responses/NotFound' + 412: + $ref: '#/components/responses/PreconditionFailed' + security: + - OAuth2Security: + - apim:api_create + +components: + schemas: + Comment: + title: Comment + required: + - content + type: object + properties: + id: + type: string + readOnly: true + example: 943d3002-000c-42d3-a1b9-d6559f8a4d49 + content: + maxLength: 512 + type: string + example: This is a comment + createdTime: + type: string + readOnly: true + example : 2021-02-11-09:57:25 + createdBy: + type: string + readOnly: true + example: admin + updatedTime: + type: string + readOnly: true + example : 2021-02-12-19:57:25 + category: + type: string + default: general + parentCommentId: + type: string + example: 6f38aea2-f41e-4ac9-b3f2-a9493d00ba97 + entryPoint: + type: string + enum: [devPortal, publisher] + commenterInfo: + $ref: '#/components/schemas/CommenterInfo' + replies: + $ref: '#/components/schemas/CommentList' + CommentList: + title: Comments List + type: object + properties: + count: + type: integer + description: | + Number of Comments returned. + example: 1 + list: + type: array + items: + $ref: '#/components/schemas/Comment' + pagination: + $ref: '#/components/schemas/Pagination' + CommenterInfo: + type: object + properties: + firstName: + type: string + example: John + lastName: + type: string + example: David + fullName: + type: string + example: John David + APIList: + title: API List + type: object + properties: + count: + type: integer + description: | + Number of APIs returned. + example: 1 + list: + type: array + items: + $ref: '#/components/schemas/APIInfo' + pagination: + $ref: '#/components/schemas/Pagination' + APIListExpanded: + title: API List + type: object + properties: + count: + type: integer + description: | + Number of APIs returned. + example: 1 + list: + type: array + items: + $ref: '#/components/schemas/API' + pagination: + $ref: '#/components/schemas/Pagination' + + APIInfo: + title: API Info object with basic API details. + type: object + properties: + id: + type: string + example: 01234567-0123-0123-0123-012345678901 + name: + type: string + example: CalculatorAPI + description: + type: string + example: A calculator API that supports basic operations + context: + type: string + example: CalculatorAPI + version: + type: string + example: 1.0.0 + provider: + type: string + description: | + If the provider value is not given, the user invoking the API will be used as the provider. + example: admin + type: + type: string + example: HTTP + lifeCycleStatus: + type: string + example: CREATED + workflowStatus: + type: string + example: APPROVED + hasThumbnail: + type: boolean + example: true + securityScheme: + type: array + items: + type: string + + Topic: + title: Topic object + required: + - name + - mode + - description + type: object + properties: + id: + type: string + description: id + readOnly: true + example: 1222344 + name: + maxLength: 50 + minLength: 1 + pattern: '(^[^~!@#;:%^*()+={}|\\<>"'',&$\s+]*$)' + type: string + example: PizzaShackAPI + mode: + maxLength: 32766 + type: string + example: This is a simple API for Pizza Shack online pizza delivery store. + description: + maxLength: 32766 + type: string + example: This is a simple API for Pizza Shack online pizza delivery store. + TopicList: + title: Topic List + type: object + properties: + count: + type: integer + description: | + Number of Topics returned. + example: 1 + list: + type: array + items: + $ref: '#/components/schemas/Topic' + pagination: + $ref: '#/components/schemas/Pagination' + API: + title: API object + required: + - context + - name + - version + type: object + properties: + id: + type: string + description: | + UUID of the api registry artifact + readOnly: true + example: 01234567-0123-0123-0123-012345678901 + name: + maxLength: 50 + minLength: 1 + pattern: '(^[^~!@#;:%^*()+={}|\\<>"'',&$\s+]*$)' + type: string + example: PizzaShackAPI + description: + maxLength: 32766 + type: string + example: This is a simple API for Pizza Shack online pizza delivery store. + context: + maxLength: 82 + minLength: 1 + type: string + example: pizza + version: + maxLength: 30 + minLength: 1 + type: string + pattern: '^[^~!@#;:%^*()+={}|\\<>"'',&/$]+$' + example: 1.0.0 + provider: + maxLength: 50 + type: string + description: | + If the provider value is not given user invoking the api will be used as the provider. + example: admin + lifeCycleStatus: + type: string + example: CREATED + x-otherScopes: + - apim:api_publish + wsdlInfo: + $ref: '#/components/schemas/WSDLInfo' + wsdlUrl: + type: string + readOnly: true + example: /apimgt/applicationdata/wsdls/admin--soap1.wsdl + testKey: + type: string + readOnly: true + example: 8swdwj9080edejhj + responseCachingEnabled: + type: boolean + example: true + cacheTimeout: + type: integer + example: 300 + destinationStatsEnabled: + type: string + example: Disabled + hasThumbnail: + type: boolean + example: false + isDefaultVersion: + type: boolean + example: false + isRevision: + type: boolean + example: false + revisionedApiId: + type: string + description: | + UUID of the api registry artifact + readOnly: true + example: 01234567-0123-0123-0123-012345678901 + revisionId: + type: integer + example: 1 + enableSchemaValidation: + type: boolean + example: false + enableStore: + type: boolean + example: true + x-otherScopes: + - apim:api_publish + type: + type: string + description: The api creation type to be used. Accepted values are HTTP, + WS, SOAPTOREST, GRAPHQL, WEBSUB, SSE + example: HTTP + default: HTTP + enum: + - HTTP + - WS + - SOAPTOREST + - SOAP + - GRAPHQL + - WEBSUB + - SSE + transport: + type: array + description: | + Supported transports for the API (http and/or https). + example: + - http + - https + items: + type: string + tags: + type: array + example: + - pizza + - food + items: + type: string + x-otherScopes: + - apim:api_publish + policies: + type: array + example: + - Unlimited + items: + type: string + x-otherScopes: + - apim:api_publish + apiThrottlingPolicy: + type: string + description: The API level throttling policy selected for the particular + API + example: Unlimited + x-otherScopes: + - apim:api_publish + authorizationHeader: + type: string + description: | + Name of the Authorization header used for invoking the API. If it is not set, Authorization header name specified + in tenant or system level will be used. + example: Authorization + securityScheme: + type: array + description: | + Types of API security, the current API secured with. It can be either OAuth2 or mutual SSL or both. If + it is not set OAuth2 will be set as the security for the current API. + example: + - oauth2 + items: + type: string + maxTps: + $ref: '#/components/schemas/APIMaxTps' + visibility: + type: string + description: The visibility level of the API. Accepts one of the following. + PUBLIC, PRIVATE, RESTRICTED. + example: PUBLIC + default: PUBLIC + enum: + - PUBLIC + - PRIVATE + - RESTRICTED + x-otherScopes: + - apim:api_publish + visibleRoles: + type: array + description: The user roles that are able to access the API in Developer Portal + example: [] + items: + type: string + x-otherScopes: + - apim:api_publish + visibleTenants: + type: array + example: [] + items: + type: string + endpointSecurity: + $ref: '#/components/schemas/APIEndpointSecurity' + gatewayEnvironments: + type: array + description: | + List of gateway environments the API is available + example: + - Production and Sandbox + items: + type: string + x-otherScopes: + - apim:api_publish + deploymentEnvironments: + type: array + description: | + List of selected deployment environments and clusters + items: + $ref: '#/components/schemas/DeploymentEnvironments' + x-otherScopes: + - apim:api_publish + labels: + type: array + description: | + Labels of micro-gateway environments attached to the API. + example: [] + items: + type: string + mediationPolicies: + type: array + example: + - name: json_to_xml_in_message + type: in + - name: xml_to_json_out_message + type: out + - name: json_fault + type: fault + items: + $ref: '#/components/schemas/MediationPolicy' + subscriptionAvailability: + type: string + description: The subscription availability. Accepts one of the following. + CURRENT_TENANT, ALL_TENANTS or SPECIFIC_TENANTS. + example: CURRENT_TENANT + default: CURRENT_TENANT + enum: + - CURRENT_TENANT + - ALL_TENANTS + - SPECIFIC_TENANTS + x-otherScopes: + - apim:api_publish + subscriptionAvailableTenants: + type: array + example: [] + items: + type: string + additionalProperties: + type: object + additionalProperties: + type: string + description: Map of custom properties of API + x-otherScopes: + - apim:api_publish + monetization: + $ref: '#/components/schemas/APIMonetizationInfo' + accessControl: + type: string + description: | + Is the API is restricted to certain set of publishers or creators or is it visible to all the + publishers and creators. If the accessControl restriction is none, this API can be modified by all the + publishers and creators, if not it can only be viewable/modifiable by certain set of publishers and creators, + based on the restriction. + default: NONE + enum: + - NONE + - RESTRICTED + accessControlRoles: + type: array + description: The user roles that are able to view/modify as API publisher + or creator. + example: [] + items: + type: string + businessInformation: + $ref: '#/components/schemas/APIBusinessInformation' + x-otherScopes: + - apim:api_publish + corsConfiguration: + $ref: '#/components/schemas/APICorsConfiguration' + websubSubscriptionConfiguration: + $ref: '#/components/schemas/WebsubSubscriptionConfiguration' + workflowStatus: + type: string + example: APPROVED + createdTime: + type: string + lastUpdatedTime: + type: string + x-otherScopes: + - apim:api_publish + endpointConfig: + type: object + properties: {} + description: | + Endpoint configuration of the API. This can be used to provide different types of endpoints including Simple REST Endpoints, Loadbalanced and Failover. + + `Simple REST Endpoint` + { + "endpoint_type": "http", + "sandbox_endpoints": { + "url": "https://localhost:9443/am/sample/pizzashack/v1/api/" + }, + "production_endpoints": { + "url": "https://localhost:9443/am/sample/pizzashack/v1/api/" + } + } + + `Loadbalanced Endpoint` + + { + "endpoint_type": "load_balance", + "algoCombo": "org.apache.synapse.endpoints.algorithms.RoundRobin", + "sessionManagement": "", + "sandbox_endpoints": [ + { + "url": "https://localhost:9443/am/sample/pizzashack/v1/api/1" + }, + { + "endpoint_type": "http", + "template_not_supported": false, + "url": "https://localhost:9443/am/sample/pizzashack/v1/api/2" + } + ], + "production_endpoints": [ + { + "url": "https://localhost:9443/am/sample/pizzashack/v1/api/3" + }, + { + "endpoint_type": "http", + "template_not_supported": false, + "url": "https://localhost:9443/am/sample/pizzashack/v1/api/4" + } + ], + "sessionTimeOut": "", + "algoClassName": "org.apache.synapse.endpoints.algorithms.RoundRobin" + } + + `Failover Endpoint` + + { + "production_failovers":[ + { + "endpoint_type":"http", + "template_not_supported":false, + "url":"https://localhost:9443/am/sample/pizzashack/v1/api/1" + } + ], + "endpoint_type":"failover", + "sandbox_endpoints":{ + "url":"https://localhost:9443/am/sample/pizzashack/v1/api/2" + }, + "production_endpoints":{ + "url":"https://localhost:9443/am/sample/pizzashack/v1/api/3" + }, + "sandbox_failovers":[ + { + "endpoint_type":"http", + "template_not_supported":false, + "url":"https://localhost:9443/am/sample/pizzashack/v1/api/4" + } + ] + } + + `Default Endpoint` + + { + "endpoint_type":"default", + "sandbox_endpoints":{ + "url":"default" + }, + "production_endpoints":{ + "url":"default" + } + } + + `Endpoint from Endpoint Registry` + { + "endpoint_type": "Registry", + "endpoint_id": "{registry-name:entry-name:version}", + } + example: + endpoint_type: http + sandbox_endpoints: + url: https://localhost:9443/am/sample/pizzashack/v1/api/ + production_endpoints: + url: https://localhost:9443/am/sample/pizzashack/v1/api/ + endpointImplementationType: + type: string + example: INLINE + default: ENDPOINT + enum: + - INLINE + - ENDPOINT + scopes: + type: array + items: + $ref: '#/components/schemas/APIScope' + operations: + type: array + example: + - target: /order/{orderId} + verb: POST + authType: Application & Application User + throttlingPolicy: Unlimited + - target: /menu + verb: GET + authType: Application & Application User + throttlingPolicy: Unlimited + items: + $ref: '#/components/schemas/APIOperations' + threatProtectionPolicies: + type: object + properties: + list: + type: array + items: + type: object + properties: + policyId: + type: string + priority: + type: integer + categories: + type: array + description: | + API categories + items: + type: string + example: "" + x-otherScopes: + - apim:api_publish + keyManagers: + type: object + properties: {} + description: | + API Key Managers + readOnly: true + serviceInfo: + type: object + properties: + key: + type: string + example: PetStore-1.0.0 + name: + type: string + example: PetStore + version: + type: string + example: 1.0.0 + outdated: + type: boolean + example: false + x-scopes: + - apim:api_create + - apim:api_import_export + + #----------------------------------------------------- + # The API Revision resource + #----------------------------------------------------- + APIRevision: + title: API Info object with basic API details + properties: + displayName: + type: string + example: REVISION 1 + id: + type: string + example: c26b2b9b-4632-4ca4-b6f3-521c8863990c + description: + type: string + example: removed a post resource + createdTime: + type: string + format: date-time + apiInfo: + $ref: '#/components/schemas/APIRevisionAPIInfo' + deploymentInfo: + type: array + items: + $ref: '#/components/schemas/APIRevisionDeployment' + + #----------------------------------------------------- + # The API Revision - API Info resource + #----------------------------------------------------- + APIRevisionAPIInfo: + title: API Info object with basic Revisioned API details + readOnly: true + properties: + id: + type: string + example: 01234567-0123-0123-0123-012345678901 + + #----------------------------------------------------- + # The API Revision List resource + #----------------------------------------------------- + APIRevisionList: + title: API Revisions List + properties: + count: + type: integer + description: | + Number of API revisions returned + example: 1 + list: + type: array + items: + $ref: '#/components/schemas/APIRevision' + #----------------------------------------------------- + # The API Revision Deployment List resource + #----------------------------------------------------- + APIRevisionDeploymentList: + title: API Revision to Deployment mapped object with basic API deployment details + properties: + list: + type: array + items: + $ref: '#/components/schemas/APIRevisionDeployment' + #----------------------------------------------------- + # The API Revision Deployment resource + #----------------------------------------------------- + APIRevisionDeployment: + title: APIRevisionDeployment Info object with basic API deployment details + properties: + revisionUuid: + type: string + example: c26b2b9b-4632-4ca4-b6f3-521c8863990c + name: + type: string + example: default + vhost: + maxLength: 255 + minLength: 1 + # hostname regex as per RFC 1123 (http://tools.ietf.org/html/rfc1123) and appended * + pattern: '^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-]*[A-Za-z0-9])$' + type: string + example: mg.wso2.com + displayOnDevportal: + type: boolean + example: true + deployedTime: + type: string + format: date-time + + AuditReport: + title: Resource for Audit Report + type: object + properties: + report: + type: string + description: | + The API Security Audit Report + grade: + type: string + description: | + The overall grade of the Security Audit + example: "27.95" + numErrors: + type: integer + description: | + The number of errors in the API Definition + example: 20 + externalApiId: + type: string + description: | + The External API ID + example: fd21f9f7-3674-49cf-8a83-dca401f635de + APIProductList: + title: API Product List + type: object + properties: + count: + type: integer + description: | + Number of API Products returned. + example: 1 + list: + type: array + items: + $ref: '#/components/schemas/APIProductInfo' + pagination: + $ref: '#/components/schemas/Pagination' + APIProductInfo: + title: API Info object with basic API details. + type: object + properties: + id: + type: string + description: | + UUID of the api product + readOnly: true + example: 01234567-0123-0123-0123-012345678901 + name: + type: string + description: Name of the API Product + example: PizzaShackAPIProduct + context: + type: string + example: pizzaproduct + description: + type: string + description: A brief description about the API + example: This is a simple API for Pizza Shack online pizza delivery store + provider: + type: string + description: | + If the provider value is not given, the user invoking the API will be used as the provider. + example: admin + hasThumbnail: + type: boolean + example: true + state: + type: string + description: | + State of the API product. Only published api products are visible on the Developer Portal + enum: + - CREATED + - PUBLISHED + securityScheme: + type: array + description: | + Types of API security, the current API secured with. It can be either OAuth2 or mutual SSL or both. If + it is not set OAuth2 will be set as the security for the current API. + example: + - oauth2 + items: + type: string + APIProduct: + title: API Product object + required: + - name + type: object + properties: + id: + type: string + description: | + UUID of the api product + readOnly: true + example: 01234567-0123-0123-0123-012345678901 + name: + maxLength: 50 + minLength: 1 + type: string + description: Name of the API Product + example: PizzaShackAPIProduct + context: + maxLength: 60 + minLength: 1 + type: string + example: pizzaproduct + description: + type: string + description: A brief description about the API + example: This is a simple API for Pizza Shack online pizza delivery store + provider: + maxLength: 50 + type: string + description: | + If the provider value is not given, the user invoking the API will be used as the provider. + example: admin + hasThumbnail: + type: boolean + example: false + state: + type: string + description: | + State of the API product. Only published api products are visible on the Developer Portal + enum: + - CREATED + - PUBLISHED + enableSchemaValidation: + type: boolean + example: false + enableStore: + type: boolean + example: true + testKey: + type: string + readOnly: true + example: 8swdwj9080edejhj + isRevision: + type: boolean + example: false + revisionedApiProductId: + type: string + description: | + UUID of the api product registry artifact + readOnly: true + example: 01234567-0123-0123-0123-012345678901 + revisionId: + type: integer + example: 1 + responseCachingEnabled: + type: boolean + example: true + cacheTimeout: + type: integer + example: 300 + visibility: + type: string + description: The visibility level of the API. Accepts one of the following. + PUBLIC, PRIVATE, RESTRICTED. + example: PUBLIC + default: PUBLIC + enum: + - PUBLIC + - PRIVATE + - RESTRICTED + visibleRoles: + type: array + description: The user roles that are able to access the API + example: [] + items: + type: string + visibleTenants: + type: array + example: [] + items: + type: string + accessControl: + type: string + description: | + Defines whether the API Product is restricted to certain set of publishers or creators or is it visible to all the + publishers and creators. If the accessControl restriction is none, this API Product can be modified by all the + publishers and creators, if not it can only be viewable/modifiable by certain set of publishers and creators, + based on the restriction. + default: NONE + enum: + - NONE + - RESTRICTED + accessControlRoles: + type: array + description: The user roles that are able to view/modify as API Product + publisher or creator. + example: [] + items: + type: string + gatewayEnvironments: + type: array + description: | + List of gateway environments the API Product is available + example: + - Production and Sandbox + items: + type: string + apiType: + type: string + description: The API type to be used. Accepted values are API, APIPRODUCT + example: APIPRODUCT + enum: + - API + - APIPRODUCT + transport: + type: array + description: | + Supported transports for the API (http and/or https). + example: + - http + - https + items: + type: string + tags: + type: array + example: + - pizza + - food + items: + type: string + policies: + type: array + example: + - Unlimited + items: + type: string + apiThrottlingPolicy: + type: string + description: The API level throttling policy selected for the particular + API Product + example: Unlimited + authorizationHeader: + type: string + description: | + Name of the Authorization header used for invoking the API. If it is not set, Authorization header name specified + in tenant or system level will be used. + example: Authorization + securityScheme: + type: array + description: | + Types of API security, the current API secured with. It can be either OAuth2 or mutual SSL or both. If + it is not set OAuth2 will be set as the security for the current API. + example: + - oauth2 + items: + type: string + subscriptionAvailability: + type: string + description: The subscription availability. Accepts one of the following. + CURRENT_TENANT, ALL_TENANTS or SPECIFIC_TENANTS. + example: CURRENT_TENANT + default: ALL_TENANTS + enum: + - CURRENT_TENANT + - ALL_TENANTS + - SPECIFIC_TENANTS + subscriptionAvailableTenants: + type: array + example: [] + items: + type: string + x-otherScopes: + - apim:api_publish + additionalProperties: + type: object + additionalProperties: + type: string + description: Map of custom properties of API + monetization: + $ref: '#/components/schemas/APIMonetizationInfo' + businessInformation: + $ref: '#/components/schemas/APIProductBusinessInformation' + corsConfiguration: + $ref: '#/components/schemas/APICorsConfiguration' + createdTime: + type: string + lastUpdatedTime: + type: string + apis: + type: array + description: | + APIs and resources in the API Product. + example: + - name: PizzaShackAPI + apiId: 01234567-0123-0123-0123-012345678901 + version: "1.0" + operations: + - target: /order/{orderId} + verb: POST + authType: Application & Application User + throttlingPolicy: Unlimited + - target: /menu + verb: GET + authType: Application & Application User + throttlingPolicy: Unlimited + items: + $ref: '#/components/schemas/ProductAPI' + scopes: + type: array + example: [] + items: + $ref: '#/components/schemas/APIScope' + categories: + type: array + description: | + API categories + example: [] + items: + type: string + ProductAPI: + title: ProductAPI + required: + - apiId + type: object + properties: + name: + type: string + example: PizzaShackAPI + apiId: + type: string + example: 01234567-0123-0123-0123-012345678901 + version: + type: string + example: "1.0" + operations: + type: array + items: + $ref: '#/components/schemas/APIOperations' + ResourcePath: + title: ResourcePath + required: + - id + type: object + properties: + id: + type: integer + example: 1 + resourcePath: + type: string + example: /menu + httpVerb: + type: string + example: GET + ResourcePathList: + title: ResourcePath List + type: object + properties: + count: + type: integer + description: | + Number of API Resource Paths returned. + example: 1 + list: + type: array + items: + $ref: '#/components/schemas/ResourcePath' + pagination: + $ref: '#/components/schemas/Pagination' + APIProductOutdatedStatus: + title: APIProduct is outdated status + type: object + properties: + isOutdated: + type: boolean + description: | + Indicates if an API Product is outdated + example: true + APIProductBusinessInformation: + type: object + properties: + businessOwner: + maxLength: 120 + type: string + example: businessowner + businessOwnerEmail: + type: string + example: businessowner@wso2.com + technicalOwner: + maxLength: 120 + type: string + example: technicalowner + technicalOwnerEmail: + type: string + example: technicalowner@wso2.com + Claim: + title: Claim + type: object + properties: + name: + type: string + example: email + URI: + type: string + example: http://wso2.org/claims/emailaddress + value: + type: string + example: admin@wso2.com + SubscriberInfo: + title: SubscriberInfo + type: object + properties: + name: + type: string + example: admin + claims: + type: array + items: + $ref: '#/components/schemas/Claim' + Application: + title: Application + required: + - name + - throttlingTier + type: object + properties: + applicationId: + type: string + example: 01234567-0123-0123-0123-012345678901 + name: + type: string + example: CalculatorApp + subscriber: + type: string + example: admin + throttlingTier: + type: string + example: Unlimited + description: + type: string + example: Sample calculator application + groupId: + type: string + example: "" + ApplicationInfo: + title: Application info object with basic application details + type: object + properties: + applicationId: + type: string + example: 01234567-0123-0123-0123-012345678901 + name: + type: string + example: CalculatorApp + subscriber: + type: string + example: admin + description: + type: string + example: Sample calculator application + subscriptionCount: + type: integer + DocumentList: + title: Document List + type: object + properties: + count: + type: integer + description: | + Number of Documents returned. + example: 1 + list: + type: array + items: + $ref: '#/components/schemas/Document' + pagination: + $ref: '#/components/schemas/Pagination' + Document: + title: Document + required: + - name + - sourceType + - type + - visibility + type: object + properties: + documentId: + type: string + readOnly: true + example: 01234567-0123-0123-0123-012345678901 + name: + maxLength: 60 + minLength: 1 + type: string + example: PizzaShackDoc + type: + type: string + example: HOWTO + enum: + - HOWTO + - SAMPLES + - PUBLIC_FORUM + - SUPPORT_FORUM + - API_MESSAGE_FORMAT + - SWAGGER_DOC + - OTHER + summary: + maxLength: 32766 + minLength: 1 + type: string + example: Summary of PizzaShackAPI Documentation + sourceType: + type: string + example: INLINE + enum: + - INLINE + - MARKDOWN + - URL + - FILE + sourceUrl: + type: string + readOnly: true + example: "" + fileName: + type: string + readOnly: true + example: "" + inlineContent: + type: string + example: This is doc content. This can have many lines. + otherTypeName: + type: string + readOnly: true + example: "" + visibility: + type: string + example: API_LEVEL + enum: + - OWNER_ONLY + - PRIVATE + - API_LEVEL + createdTime: + type: string + readOnly: true + createdBy: + type: string + example: admin + lastUpdatedTime: + type: string + readOnly: true + lastUpdatedBy: + type: string + readOnly: true + example: admin + GraphQLSchema: + title: GraphQL Schema + required: + - name + type: object + properties: + name: + type: string + example: admin--HackerNewsAPI.graphql + schemaDefinition: + type: string + GraphQLQueryComplexityInfo: + title: GraphQL Query Complexity Info + type: object + properties: + list: + type: array + items: + $ref: '#/components/schemas/GraphQLCustomComplexityInfo' + GraphQLCustomComplexityInfo: + title: GraphQL Custom Complexity Info + required: + - complexityValue + - field + - type + type: object + properties: + type: + type: string + description: | + The type found within the schema of the API + example: Country + field: + type: string + description: | + The field which is found under the type within the schema of the API + example: name + complexityValue: + type: integer + description: | + The complexity value allocated for the associated field under the specified type + example: 1 + GraphQLSchemaTypeList: + title: List of types and corresponding fields of the GraphQL Schema + type: object + properties: + typeList: + type: array + items: + $ref: '#/components/schemas/GraphQLSchemaType' + GraphQLSchemaType: + title: Single type and corresponding fields found within the GraphQL Schema + type: object + properties: + type: + type: string + description: | + Type found within the GraphQL Schema + example: Country + fieldList: + type: array + description: | + Array of fields under current type + example: + - code + - name + items: + type: string + MediationList: + title: Mediation List + type: object + properties: + count: + type: integer + description: | + Number of mediation sequences returned. + example: 1 + list: + type: array + items: + $ref: '#/components/schemas/MediationInfo' + pagination: + $ref: '#/components/schemas/Pagination' + MediationInfo: + title: MediationInfo + required: + - id + - name + - type + type: object + properties: + name: + type: string + example: json_fault.xml + id: + type: string + example: 01234567-0123-0123-0123-012345678901 + type: + type: string + example: in + enum: + - in + - out + - fault + Mediation: + title: Mediation + required: + - name + - type + type: object + properties: + id: + type: string + example: 01234567-0123-0123-0123-012345678901 + name: + type: string + example: json_fault.xml + type: + type: string + example: in + enum: + - in + - out + - fault + ThrottlingPolicyList: + title: Throttling policy list + type: object + properties: + count: + type: integer + description: | + Number of Tiers returned. + example: 1 + list: + type: array + items: + $ref: '#/components/schemas/ThrottlingPolicy' + pagination: + $ref: '#/components/schemas/Pagination' + ThrottlingPolicy: + title: Tier + required: + - name + - requestCount + - stopOnQuotaReach + - tierPlan + - unitTime + type: object + properties: + name: + type: string + example: Platinum + description: + type: string + example: Allows 50 request(s) per minute. + policyLevel: + type: string + example: api + enum: + - subscription + - api + displayName: + type: string + example: Platinum + attributes: + type: object + additionalProperties: + type: string + description: | + Custom attributes added to the policy policy + example: {} + requestCount: + type: integer + description: | + Maximum number of requests which can be sent within a provided unit time + format: int64 + example: 50 + dataUnit: + description: | + Unit of data allowed to be transfered. Allowed values are "KB", "MB" and "GB" + type: string + example: KB + unitTime: + type: integer + format: int64 + example: 60000 + timeUnit: + type: string + example: min + rateLimitCount: + type: integer + default: 0 + description: Burst control request count + example: 10 + rateLimitTimeUnit: + type: string + description: Burst control time unit + example: min + quotaPolicyType: + type: string + description: Default quota limit type + enum: + - REQUESTCOUNT + - BANDWIDTHVOLUME + example: REQUESTCOUNT + tierPlan: + type: string + description: | + This attribute declares whether this policy is available under commercial or free + example: FREE + enum: + - FREE + - COMMERCIAL + stopOnQuotaReach: + type: boolean + description: | + By making this attribute to false, you are capabale of sending requests + even if the request count exceeded within a unit time + example: true + monetizationProperties: + type: object + additionalProperties: + type: string + description: Properties of a tier plan which are related to monetization + example: {} + SubscriptionList: + title: Subscription List + type: object + properties: + count: + type: integer + description: | + Number of Subscriptions returned. + example: 1 + list: + type: array + items: + $ref: '#/components/schemas/Subscription' + pagination: + $ref: '#/components/schemas/Pagination' + Subscription: + title: Subscription + required: + - applicationInfo + - subscriptionId + - subscriptionStatus + - throttlingPolicy + type: object + properties: + subscriptionId: + type: string + example: 01234567-0123-0123-0123-012345678901 + applicationInfo: + $ref: '#/components/schemas/ApplicationInfo' + throttlingPolicy: + type: string + example: Unlimited + subscriptionStatus: + type: string + example: BLOCKED + enum: + - BLOCKED + - PROD_ONLY_BLOCKED + - UNBLOCKED + - ON_HOLD + - REJECTED + - TIER_UPDATE_PENDING + APIMonetizationUsage: + title: API monetization usage object + type: object + properties: + properties: + type: object + additionalProperties: + type: string + description: Map of custom properties related to monetization usage + APIRevenue: + title: API revenue data object + type: object + properties: + properties: + type: object + additionalProperties: + type: string + description: Map of custom properties related to API revenue + MediationPolicy: + title: Mediation Policy + required: + - name + type: object + properties: + id: + type: string + example: 69ea3fa6-55c6-472e-896d-e449dd34a824 + name: + type: string + example: log_in_message + type: + type: string + example: in + shared: + type: boolean + example: true + Error: + title: Error object returned with 4XX HTTP Status + required: + - code + - message + type: object + properties: + code: + type: integer + format: int64 + message: + type: string + description: Error message. + description: + type: string + description: | + A detail description about the error message. + moreInfo: + type: string + description: | + Preferably an url with more details about the error. + error: + type: array + description: | + If there are more than one error list them out. + For example, list out validation errors by each field. + items: + $ref: '#/components/schemas/ErrorListItem' + ErrorListItem: + title: Description of individual errors that may have occurred during a request. + required: + - code + - message + type: object + properties: + code: + type: string + message: + type: string + description: | + Description about individual errors occurred + description: + type: string + description: | + A detail description about the error message. + Environment: + title: Environment + required: + - endpoints + - name + - serverUrl + - showInApiConsole + - type + type: object + properties: + name: + type: string + example: default + displayName: + type: string + example: Default + type: + type: string + example: hybrid + serverUrl: + type: string + example: https://localhost:9443/services/ + showInApiConsole: + type: boolean + example: true + endpoints: + $ref: '#/components/schemas/EnvironmentEndpoints' + vhosts: + type: array + items: + $ref: '#/components/schemas/VHost' + EnvironmentList: + title: Environment List + type: object + properties: + count: + type: integer + description: | + Number of Environments returned. + example: 1 + list: + type: array + items: + $ref: '#/components/schemas/Environment' + EnvironmentEndpoints: + title: Environment Endpoints + type: object + properties: + http: + type: string + description: HTTP environment URL + example: http://localhost:8280 + https: + type: string + description: HTTPS environment URL + example: https://localhost:8243 + ws: + type: string + description: WS environment URL + example: http://localhost:9099 + wss: + type: string + description: WSS environment URL + example: https://localhost:8099 + VHost: + title: Virtual Host + type: object + properties: + host: + type: string + example: mg.wso2.com + httpContext: + type: string + example: pets + httpPort: + type: integer + example: 80 + httpsPort: + type: integer + example: 443 + wsPort: + type: integer + example: 9099 + wssPort: + type: integer + example: 8099 + FileInfo: + title: File Information including meta data + type: object + properties: + relativePath: + type: string + description: relative location of the file (excluding the base context and + host of the Publisher API) + example: apis/01234567-0123-0123-0123-012345678901/thumbnail + mediaType: + type: string + description: media-type of the file + example: image/jpeg + APIMaxTps: + type: object + properties: + production: + type: integer + format: int64 + example: 1000 + sandbox: + type: integer + format: int64 + example: 1000 + APIEndpointSecurity: + type: object + properties: + type: + type: string + description: Accepts one of the following, basic or digest. + example: BASIC + enum: + - BASIC + - DIGEST + username: + type: string + example: admin + password: + type: string + example: password + APIBusinessInformation: + type: object + properties: + businessOwner: + maxLength: 120 + type: string + example: businessowner + businessOwnerEmail: + type: string + example: businessowner@wso2.com + pattern: '^[a-zA-Z0-9.!#$%&’*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$' + technicalOwner: + maxLength: 120 + type: string + example: technicalowner + technicalOwnerEmail: + type: string + example: technicalowner@wso2.com + + WebsubSubscriptionConfiguration: + type: object + properties: + secret: + type: string + description: Secret key to be used for subscription + signingAlgorithm: + type: string + description: The algorithm used for signing + signatureHeader: + type: string + description: The header uses to send the signature + + APICorsConfiguration: + type: object + properties: + corsConfigurationEnabled: + type: boolean + default: false + accessControlAllowOrigins: + type: array + items: + type: string + accessControlAllowCredentials: + type: boolean + default: false + accessControlAllowHeaders: + type: array + items: + type: string + accessControlAllowMethods: + type: array + items: + type: string + description: | + CORS configuration for the API + Endpoint: + title: Endpoints + type: object + properties: + id: + type: string + description: | + UUID of the Endpoint entry + example: 01234567-0123-0123-0123-012345678901 + name: + type: string + description: | + name of the Endpoint entry + example: Endpoint 1 + endpointConfig: + type: object + properties: + endpointType: + type: string + example: FAIL_OVER + enum: + - SINGLE + - LOAD_BALANCED + - FAIL_OVER + list: + type: array + items: + $ref: '#/components/schemas/EndpointConfig' + endpointSecurity: + type: object + properties: + enabled: + type: boolean + example: false + type: + type: string + example: basic + username: + type: string + example: basic + password: + type: string + example: basic + maxTps: + type: integer + description: Endpoint max tps + format: int64 + example: 1000 + type: + type: string + example: http + EndpointConfig: + title: Endpoint Configuration + type: object + properties: + url: + type: string + description: | + Service url of the endpoint + example: http://localhost:8280 + timeout: + type: string + description: | + Time out of the endpoint + example: "1000" + attributes: + type: array + items: + type: object + properties: + name: + type: string + example: Suspension time + value: + type: string + example: 2s + EndpointList: + title: Endpoint List + type: object + properties: + count: + type: integer + description: | + Number of Endpoints returned. + example: 1 + list: + type: array + items: + $ref: '#/components/schemas/Endpoint' + Scope: + title: Scope + required: + - name + type: object + properties: + id: + type: string + description: | + UUID of the Scope. Valid only for shared scopes. + readOnly: true + example: 01234567-0123-0123-0123-012345678901 + name: + maxLength: 255 + minLength: 1 + type: string + description: | + name of Scope + example: apim:api_view + displayName: + maxLength: 255 + type: string + description: | + display name of Scope + example: api_view + description: + maxLength: 512 + type: string + description: | + description of Scope + example: This Scope can used to view Apis + bindings: + type: array + description: | + role bindings list of the Scope + example: + - admin + - Internal/creator + - Internal/publisher + items: + type: string + usageCount: + type: integer + description: | + usage count of Scope + readOnly: true + example: 3 + SharedScopeUsage: + title: SharedScopeUsage + required: + - id + - name + type: object + properties: + id: + type: string + description: | + UUID of the Scope. Valid only for shared scopes. + example: 01234567-0123-0123-0123-012345678901 + name: + type: string + description: | + name of Scope + example: apim:api_view + usedApiList: + type: array + description: | + API list which have used the shared scope + items: + $ref: '#/components/schemas/SharedScopeUsedAPIInfo' + SharedScopeUsedAPIInfo: + title: API object using shared scope + required: + - context + - name + - version + type: object + properties: + name: + type: string + example: CalculatorAPI + context: + type: string + example: CalculatorAPI + version: + type: string + example: 1.0.0 + provider: + type: string + description: | + If the provider value is not given user invoking the api will be used as the provider. + example: admin + usedResourceList: + type: array + description: | + Resource list which have used the shared scope within this API + items: + $ref: '#/components/schemas/SharedScopeUsedAPIResourceInfo' + SharedScopeUsedAPIResourceInfo: + title: API resource object using shared scope + type: object + properties: + target: + type: string + example: /add + verb: + type: string + example: POST + APIScope: + title: APIScope + required: + - scope + type: object + properties: + scope: + $ref: '#/components/schemas/Scope' + shared: + type: boolean + description: | + States whether scope is shared. This will not be honored when updating/adding scopes to APIs or when + adding/updating Shared Scopes. + example: true + APIOperations: + title: Operation + type: object + properties: + id: + type: string + example: postapiresource + target: + type: string + example: /order/{orderId} + verb: + type: string + example: POST + authType: + type: string + example: Application & Application User + default: Any + throttlingPolicy: + type: string + example: Unlimited + scopes: + type: array + example: [] + items: + type: string + usedProductIds: + type: array + example: [] + items: + type: string + amznResourceName: + type: string + example: "" + amznResourceTimeout: + type: integer + payloadSchema: + type: string + example: "" + uriMapping: + type: string + example: "" + ScopeList: + title: Scope List + type: object + properties: + count: + type: integer + description: | + Number of Scopes returned. + example: 1 + list: + type: array + items: + $ref: '#/components/schemas/Scope' + pagination: + $ref: '#/components/schemas/Pagination' + ExternalStore: + title: External Store + type: object + properties: + id: + type: string + description: | + The external store identifier, which is a unique value. + example: Store123# + displayName: + type: string + description: | + The name of the external API Store that is displayed in the Publisher UI. + example: UKStore + type: + type: string + description: | + The type of the Store. This can be a WSO2-specific API Store or an external one. + example: wso2 + endpoint: + type: string + description: | + The endpoint URL of the external store + example: http://localhost:9764/store + APIExternalStore: + title: API External Store + type: object + properties: + id: + type: string + description: | + The external store identifier, which is a unique value. + example: Store123# + lastUpdatedTime: + type: string + description: | + The recent timestamp which a given API is updated in the external store. + example: 2019-09-09T13:57:16.229 + APIExternalStoreList: + title: API External Store List + type: object + properties: + count: + type: integer + description: | + Number of external stores returned. + example: 1 + list: + type: array + items: + $ref: '#/components/schemas/APIExternalStore' + ExternalStoreList: + title: External Store List + type: object + properties: + count: + type: integer + description: | + Number of external stores returned. + example: 1 + list: + type: array + items: + $ref: '#/components/schemas/ExternalStore' + Certificates: + title: Certificates + type: object + properties: + count: + type: integer + example: 1 + certificates: + type: array + items: + $ref: '#/components/schemas/CertMetadata' + pagination: + $ref: '#/components/schemas/Pagination' + description: Representation of a list of certificates + CertMetadata: + title: Certificate + type: object + properties: + alias: + type: string + example: wso2carbon + endpoint: + type: string + example: www.abc.com + description: Representation of the details of a certificate + CertificateInfo: + title: Certificate information + type: object + properties: + status: + type: string + example: Active + validity: + $ref: '#/components/schemas/CertificateValidity' + version: + type: string + example: V3 + subject: + type: string + example: CN=wso2.com, OU=wso2, O=wso2, L=Colombo, ST=Western, C=LK + CertificateValidity: + title: Certificate Valid period + type: object + properties: + from: + type: string + example: 12-12-2017 + to: + type: string + example: 01-01-2019 + ClientCertificates: + title: Client Certificates + type: object + properties: + count: + type: integer + example: 1 + certificates: + type: array + items: + $ref: '#/components/schemas/ClientCertMetadata' + pagination: + $ref: '#/components/schemas/Pagination' + description: Representation of a list of client certificates + ClientCertMetadata: + title: Client certificate meta data + type: object + properties: + alias: + type: string + example: wso2carbon + apiId: + type: string + example: 64eca60b-2e55-4c38-8603-e9e6bad7d809 + tier: + type: string + example: Gold + description: Meta data of certificate + Label: + title: Label + required: + - name + type: object + properties: + name: + type: string + example: marketing_store + description: + type: string + example: Public microgateway for marketing + access_urls: + type: array + example: https://localhost:9095 + items: + type: string + LabelList: + title: Label List + type: object + properties: + count: + type: integer + description: | + Number of Labels returned. + example: 1 + list: + type: array + items: + $ref: '#/components/schemas/Label' + pagination: + $ref: '#/components/schemas/Pagination' + LifecycleState: + title: Lifecycle State + type: object + properties: + state: + type: string + example: Created + checkItems: + type: array + items: + type: object + properties: + name: + type: string + example: Deprecate old versions after publishing the API + value: + type: boolean + example: false + requiredStates: + type: array + example: [] + items: + type: string + availableTransitions: + type: array + items: + type: object + properties: + event: + type: string + example: Publish + targetState: + type: string + example: Published + LifecycleHistory: + title: Lifecycle history item list + type: object + properties: + count: + type: integer + example: 1 + list: + type: array + items: + $ref: '#/components/schemas/LifecycleHistoryItem' + LifecycleHistoryItem: + title: Lifecycle history item + type: object + properties: + previousState: + type: string + example: Created + postState: + type: string + example: Published + user: + type: string + example: admin + updatedTime: + type: string + format: dateTime + example: 2019-02-31T23:59:60Z + WorkflowResponse: + title: workflow Response + required: + - workflowStatus + type: object + properties: + workflowStatus: + type: string + description: | + This attribute declares whether this workflow task is approved or rejected. + example: APPROVED + enum: + - CREATED + - APPROVED + - REJECTED + - REGISTERED + jsonPayload: + type: string + description: | + Attributes that returned after the workflow execution + example: null + lifecycleState: + $ref: '#/components/schemas/LifecycleState' + OpenAPIDefinitionValidationResponse: + title: OpenAPI Definition Validation Response + required: + - isValid + type: object + properties: + isValid: + type: boolean + description: | + This attribute declares whether this definition is valid or not. + example: true + content: + type: string + description: | + OpenAPI definition content. + info: + type: object + properties: + name: + type: string + example: PetStore + version: + type: string + example: 1.0.0 + context: + type: string + example: /petstore + description: + type: string + example: A sample API that uses a petstore as an example to demonstrate + swagger-2.0 specification + openAPIVersion: + type: string + example: 3.0.0 + endpoints: + type: array + description: | + contains host/servers specified in the OpenAPI file/URL + items: + type: string + example: https://localhost:9443/am/sample/pizzashack/v1/api/ + description: | + API definition information + errors: + type: array + description: | + If there are more than one error list them out. + For example, list out validation errors by each field. + items: + $ref: '#/components/schemas/ErrorListItem' + WSDLValidationResponse: + title: WSDL Definition Validation Response + required: + - isValid + type: object + properties: + isValid: + type: boolean + description: | + This attribute declares whether this definition is valid or not. + example: true + errors: + type: array + description: | + If there are more than one error list them out. + For example, list out validation errors by each field. + items: + $ref: '#/components/schemas/ErrorListItem' + wsdlInfo: + type: object + properties: + version: + type: string + description: | + WSDL version + example: "1.1" + endpoints: + type: array + description: | + A list of endpoints the service exposes + items: + type: object + properties: + name: + type: string + description: Name of the endpoint + example: StockQuoteSoap + location: + type: string + description: Endpoint URL + example: http://www.webservicex.net/stockquote.asmx + description: Summary of the WSDL including the basic information + GraphQLValidationResponse: + title: GraphQL API definition validation Response + required: + - errorMessage + - isValid + type: object + properties: + isValid: + type: boolean + description: | + This attribute declares whether this definition is valid or not. + example: true + errorMessage: + type: string + description: | + This attribute declares the validation error message + graphQLInfo: + type: object + properties: + operations: + type: array + items: + $ref: '#/components/schemas/APIOperations' + graphQLSchema: + $ref: '#/components/schemas/GraphQLSchema' + description: Summary of the GraphQL including the basic information + ApiEndpointValidationResponse: + title: API Endpoint url validation response + required: + - statusCode + - statusMessage + type: object + properties: + statusCode: + type: integer + description: HTTP status code + example: 200 + statusMessage: + type: string + description: string + example: OK + error: + type: string + description: | + If an error occurs, the error message will be set to this property. + If not, this will remain null. + example: null + ThreatProtectionPolicyList: + title: Threat Protection Policy List + type: object + properties: + list: + type: array + items: + $ref: '#/components/schemas/ThreatProtectionPolicy' + ThreatProtectionPolicy: + title: Threat Protection Policy Schema + required: + - name + - policy + - type + type: object + properties: + uuid: + type: string + description: Policy ID + name: + type: string + description: Name of the policy + type: + type: string + description: Type of the policy + policy: + type: string + description: policy as a json string + SearchResultList: + title: Unified Search Result List + type: object + properties: + count: + type: integer + description: | + Number of results returned. + example: 1 + list: + type: array + items: + type: object + pagination: + $ref: '#/components/schemas/Pagination' + SearchResult: + title: Search Result + required: + - name + type: object + properties: + id: + type: string + example: 01234567-0123-0123-0123-012345678901 + name: + type: string + example: TestAPI + type: + type: string + example: API + enum: + - DOC + - API + - APIProduct + transportType: + type: string + description: Accepted values are HTTP, WS, SOAPTOREST, GRAPHQL + discriminator: + propertyName: name + APISearchResult: + title: API Result + allOf: + - $ref: '#/components/schemas/SearchResult' + - type: object + properties: + description: + type: string + description: A brief description about the API + example: A calculator API that supports basic operations + context: + type: string + description: A string that represents the context of the user's request + example: CalculatorAPI + version: + type: string + description: The version of the API + example: 1.0.0 + provider: + type: string + description: | + If the provider value is not given, the user invoking the API will be used as the provider. + example: admin + status: + type: string + description: This describes in which status of the lifecycle the API is + example: CREATED + thumbnailUri: + type: string + example: /apis/01234567-0123-0123-0123-012345678901/thumbnail + APIProductSearchResult: + title: API Result + allOf: + - $ref: '#/components/schemas/SearchResult' + - type: object + properties: + description: + type: string + description: A brief description about the API + example: A calculator API that supports basic operations + context: + type: string + description: A string that represents the context of the user's request + example: CalculatorAPI + version: + type: string + description: The version of the API Product + example: 1.0.0 + provider: + type: string + description: | + If the provider value is not given, the user invoking the API will be used as the provider. + example: admin + status: + type: string + description: This describes in which status of the lifecycle the APIPRODUCT + is + example: PUBLISHED + thumbnailUri: + type: string + example: /apis/01234567-0123-0123-0123-012345678901/thumbnail + APIMonetizationInfo: + title: API monetization object + required: + - enabled + type: object + properties: + enabled: + type: boolean + description: Flag to indicate the monetization status + example: true properties: - offset: - type: integer - example: 12 - limit: - type: integer - example: 25 - total: - type: integer - example: 1290 - -#----------------------------------------------------- -# The API Info resource -#----------------------------------------------------- - APIInfo: - title: API Info object with basic API details. - properties: - id: - type: string - example: 01234567-0123-0123-0123-012345678901 - name: - type: string - example: CalculatorAPI - description: - type: string - example: A calculator API that supports basic operations - context: - type: string - example: CalculatorAPI - version: - type: string - example: 1.0.0 - provider: - description: | - If the provider value is not given, the user invoking the API will be used as the provider. - type: string - example: admin - status: - type: string - example: CREATED - thumbnailUri: - type: string - example: /apis/01234567-0123-0123-0123-012345678901/thumbnail - -#----------------------------------------------------- -# The API resource -#----------------------------------------------------- - API: - title: API object - required: - - name - - context - - version - - tiers - - isDefaultVersion - - transport - - endpointConfig - - visibility - - type - properties: - id: - type: string - description: | - UUID of the api registry artifact - example: 01234567-0123-0123-0123-012345678901 - name: - type: string - description: Name of the API - example: CalculatorAPI - description: - type: string - description: A brief description about the API - example: A calculator API that supports basic operations - context: - type: string - description: A string that represents the context of the user's request - example: CalculatorAPI - version: - type: string - description: The version of the API - example: 1.0.0 - provider: - description: | - If the provider value is not given user invoking the api will be used as the provider. - type: string - example: admin - apiDefinition: - description: | - Swagger definition of the API which contains details about URI templates and scopes - type: string - example: "{\"paths\":{\"/substract\":{\"get\":{\"x-auth-type\":\"Application & Application User\",\"x-throttling-tier\":\"Unlimited\",\"parameters\":[{\"name\":\"x\",\"required\":true,\"type\":\"string\",\"in\":\"query\"},{\"name\":\"y\",\"required\":true,\"type\":\"string\",\"in\":\"query\"}],\"responses\":{\"200\":{}}}},\"/add\":{\"get\":{\"x-auth-type\":\"Application & Application User\",\"x-throttling-tier\":\"Unlimited\",\"parameters\":[{\"name\":\"x\",\"required\":true,\"type\":\"string\",\"in\":\"query\"},{\"name\":\"y\",\"required\":true,\"type\":\"string\",\"in\":\"query\"}],\"responses\":{\"200\":{}}}}},\"swagger\":\"2.0\",\"info\":{\"title\":\"CalculatorAPI\",\"version\":\"1.0.0\"}}" - wsdlUri: - description: | - WSDL URL if the API is based on a WSDL endpoint - type: string - example: "http://www.webservicex.com/globalweather.asmx?wsdl" - status: - type: string - description: This describes in which status of the lifecycle the API is - example: CREATED - responseCaching: - type: string - example: Disabled - cacheTimeout: - type: integer - example: 300 - destinationStatsEnabled: - type: string - example: Disabled - isDefaultVersion: - type: boolean - example: false - type: - type: string - description: The transport to be set. Accepted values are HTTP, WS - enum: - - HTTP - - WS - example: HTTP - default: HTTP - transport: - description: | - Supported transports for the API (http and/or https). - type: array - items: + type: object + additionalProperties: + type: string + description: Map of custom properties related to monetization + DocumentSearchResult: + title: Document Result + allOf: + - $ref: '#/components/schemas/SearchResult' + - type: object + properties: + docType: + type: string + example: HOWTO + enum: + - HOWTO + - SAMPLES + - PUBLIC_FORUM + - SUPPORT_FORUM + - API_MESSAGE_FORMAT + - SWAGGER_DOC + - OTHER + summary: + type: string + example: Summary of Calculator Documentation + sourceType: + type: string + example: INLINE + enum: + - INLINE + - URL + - FILE + sourceUrl: + type: string + example: "" + otherTypeName: + type: string + example: "" + visibility: + type: string + example: API_LEVEL + enum: + - OWNER_ONLY + - PRIVATE + - API_LEVEL + apiName: + type: string + description: The name of the associated API + example: TestAPI + apiVersion: + type: string + description: The version of the associated API + example: 1.0.0 + apiProvider: + type: string + example: admin + apiUUID: + type: string + associatedType: + type: string + MockResponsePayloadList: + title: Mock Response Payload list + type: object + properties: + list: + type: array + items: + $ref: '#/components/schemas/MockResponsePayloadInfo' + MockResponsePayloadInfo: + title: Mock Response Payload info object + type: object + properties: + path: + type: string + description: path of the resource + example: /menu + content: + type: string + description: new modified code + example: "var accept = \"\\\"\"+mc.getProperty('AcceptHeader')+\"\\\"\"\ + ;\nvar responseCode = mc.getProperty('query.param.responseCode');\nvar\ + \ responseCodeStr = \"\\\"\"+responseCode+\"\\\"\";\nvar responses = [];\n\ + \nif (!responses[200]) {\n responses [200] = [];\n}\nresponses[200][\"\ + application/json\"] = \n[ {\n \"price\" : \"string\",\n \"description\"\ + \ : \"string\",\n \"name\" : \"string\",\n \"image\" : \"string\"\n\ + } ]\n\n/*if (!responses[304]) {\n responses[304] = [];\n}\nresponses[304][\"\ + application/(json or xml)\"] = {}/<>*/\n\nif (!responses[406]) {\n responses\ + \ [406] = [];\n}\nresponses[406][\"application/json\"] = \n{\n \"message\"\ + \ : \"string\",\n \"error\" : [ {\n \"message\" : \"string\",\n \ + \ \"code\" : 0\n } ],\n \"description\" : \"string\",\n \"code\" :\ + \ 0,\n \"moreInfo\" : \"string\"\n}\n\nresponses[501] = [];\nresponses[501][\"\ + application/json\"] = {\n\"code\" : 501,\n\"description\" : \"Not Implemented\"\ + }\nresponses[501][\"application/xml\"] = 501Not\ + \ Implemented;\n\nif (!responses[responseCode])\ + \ {\n responseCode = 501;\n}\n\nif (responseCode == null) {\n responseCode\ + \ = 200;\n responseCodeStr = \"200\";\n}\n\nif (accept == null || !responses[responseCode][accept])\ + \ {\n accept = \"application/json\";\n}\n\nif (accept === \"application/json\"\ + ) {\n mc.setProperty('CONTENT_TYPE', 'application/json');\n mc.setProperty('HTTP_SC',\ + \ responseCodeStr);\n mc.setPayloadJSON(responses[responseCode][\"application/json\"\ + ]);\n} else if (accept === \"application/xml\") {\n mc.setProperty('CONTENT_TYPE',\ + \ 'application/xml');\n mc.setProperty('HTTP_SC', responseCodeStr);\n\ + \ mc.setPayloadXML(responses[responseCode][\"application/xml\"]);\n}" + verb: + type: string + example: POST + ResourcePolicyList: + title: Resource policy List + type: object + properties: + list: + type: array + items: + $ref: '#/components/schemas/ResourcePolicyInfo' + count: + type: integer + description: | + Number of policy resources returned. + example: 1 + ResourcePolicyInfo: + title: Resource policy Info object with conversion policy resource details. + type: object + properties: + id: + type: string + description: | + UUID of the resource policy registry artifact + readOnly: true + example: 01234567-0123-0123-0123-012345678901 + httpVerb: + type: string + description: HTTP verb used for the resource path + example: get + resourcePath: + type: string + description: A string that represents the resource path of the api for the + related resource policy + example: checkPhoneNumber + content: + type: string + description: The resource policy content + example:
+ Settings: + title: SettingsDTO + type: object + properties: + devportalUrl: type: string - example: ["http","https"] - tags: - type: array - description: Search keywords related to the API - items: + description: The Developer Portal URL + example: https://localhost:9443/devportal + environment: + type: array + items: + $ref: '#/components/schemas/Environment' + scopes: + type: array + example: + - apim:api_create + - apim:api_publish + items: + type: string + monetizationAttributes: + type: array + example: [] + items: + $ref: '#/components/schemas/MonetizationAttribute' + securityAuditProperties: + type: object + properties: {} + externalStoresEnabled: + type: boolean + description: | + Is External Stores configuration enabled + example: true + docVisibilityEnabled: + type: boolean + description: | + Is Document Visibility configuration enabled + example: false + crossTenantSubscriptionEnabled: + type: boolean + description: | + Is Cross Tenant Subscriptions Enabled + example: false + default: false + deployments: + type: array + items: + $ref: '#/components/schemas/Deployments' + SecurityAuditAttribute: + title: SecurityAuditAttributeDTO + type: object + properties: + isGlobal: + type: boolean + example: false + overrideGlobal: + type: boolean + example: false + apiToken: type: string - example: ["substract","add"] - tiers: - type: array - description: The subscription tiers selected for the particular API - items: + example: b1267ytf-b7gc-4aee-924d-ece81241efec + collectionId: type: string - example: ["Unlimited"] - apiLevelPolicy: - description: The policy selected for the particular API - type: string - example: "Unlimited" - maxTps: - properties: - production: - type: integer - format: int64 - example: 1000 - sandbox: - type: integer - format: int64 - example: 1000 - thumbnailUri: - type: string - example: "/apis/01234567-0123-0123-0123-012345678901/thumbnail" - visibility: - type: string - description: The visibility level of the API. Accepts one of the following. PUBLIC, PRIVATE, RESTRICTED OR CONTROLLED. - enum: - - PUBLIC - - PRIVATE - - RESTRICTED - - CONTROLLED - example: PUBLIC - visibleRoles: - type: array - description: The user roles that are able to access the API - items: - type: string - example: [] - endpointConfig: - type: string - example: "{\"production_endpoints\":{\"url\":\"https://localhost:9443/am/sample/pizzashack/v1/api/\",\"config\":{\"suspendErrorCode\":\"101000\",\"suspendDuration\":\"2000\",\"suspendMaxDuration\":\"3\",\"factor\":\"2\",\"retryErroCode\":\"101000\",\"retryTimeOut\":\"4\",\"retryDelay\":\"1000\",\"actionSelect\":\"fault\",\"actionDuration\":\"3000\"}},\"sandbox_endpoints\":{\"url\":\"https://localhost:9443/am/sample/pizzashack/v1/api/\",\"config\":null},\"endpoint_type\":\"http\"}" - endpointSecurity: - properties: - type: + example: 456ef957-5a79-449f-83y3-9027945d3c60 + baseUrl: + type: string + WSDLInfo: + title: WSDL information of the API. This is only available if the API is a SOAP + API. + type: object + properties: + type: + type: string + description: Indicates whether the WSDL is a single WSDL or an archive in + ZIP format + enum: + - WSDL + - ZIP + Pagination: + title: Pagination + type: object + properties: + offset: + type: integer + example: 0 + limit: + type: integer + example: 1 + total: + type: integer + example: 10 + next: + type: string + description: | + Link to the next subset of resources qualified. + Empty if no more resources are to be returned. + previous: + type: string + description: | + Link to the previous subset of resources qualified. + Empty if current subset is the first subset returned. + MonetizationAttribute: + title: Monetization attribute object + type: object + properties: + required: + type: boolean + description: | + Is attribute required + example: true + name: + type: string + description: | + Name of the attribute + displayName: + type: string + description: | + Display name of the attribute + description: + type: string + description: | + Description of the attribute + hidden: + type: boolean + description: | + Is attribute hidden + default: + type: string + description: | + Default value of the attribute + Tenant: + title: Tenant + type: object + properties: + domain: + type: string + description: tenant domain + example: wso2.com + status: + type: string + description: current status of the tenant active/inactive + example: active + TenantList: + title: Tenant list + type: object + properties: + count: + type: integer + description: | + Number of tenants returned. + example: 1 + list: + type: array + items: + $ref: '#/components/schemas/Tenant' + pagination: + $ref: '#/components/schemas/Pagination' + AlertTypesList: + title: Alert Types List + type: object + properties: + count: + type: integer + description: The number of alerts + example: 3 + alerts: + type: array + items: + $ref: '#/components/schemas/AlertType' + AlertType: + title: Alert Type + type: object + properties: + id: + type: integer + description: The alert Id + example: 1 + name: + type: string + description: The name of the alert. + example: AbnormalRequestTime + requireConfiguration: + type: boolean + description: Whether the alert type require additional configurations. + example: true + Alert: + title: Alert + type: object + properties: + id: + type: integer + description: The alert Id + example: 1 + name: + type: string + description: The name of the alert. + example: AbnormalRequestsPerMin + configuration: + type: array + items: + $ref: '#/components/schemas/AlertConfig' + AlertsInfo: + title: Alerts Info + type: object + properties: + alerts: + type: array + items: + $ref: '#/components/schemas/Alert' + emailList: + type: array + items: type: string - example: basic - description: Accepts one of the following, basic or digest. - enum: - - basic - - digest - username: + AlertsInfoResponse: + title: Alerts Info Response + type: object + properties: + alerts: + type: array + items: + $ref: '#/components/schemas/Alert' + emailList: + type: array + items: type: string - example: admin - password: + failedConfigurations: + type: array + items: + $ref: '#/components/schemas/AlertConfig' + AlertConfigList: + title: Alert Configuration List + type: object + properties: + count: + type: integer + example: 1 + list: + type: array + items: + $ref: '#/components/schemas/AlertConfig' + AlertConfig: + title: Alert Configuration + type: object + properties: + configurationId: + type: string + description: The alert config subscription id. + example: UGl6emFTaGFja0FQSSsxLjAuMCtEZWZhdWx0QXBwbGljYXRpb24K + configuration: + type: object + additionalProperties: type: string - example: password - gatewayEnvironments: - description: | - Comma separated list of gateway environments. - type: string - example: Production and Sandbox - sequences: - type: array - items: - $ref: '#/definitions/Sequence' - example: [] - subscriptionAvailability: - type: string - description: The subscription availability. Accepts one of the following. current_tenant, all_tenants or specific_tenants. - enum: - - current_tenant - - all_tenants - - specific_tenants - example: current_tenant - subscriptionAvailableTenants: - type: array - items: - type: string - example: ["tenant1", "tenant2"] + description: The config parameters. + example: + apiName: PizzaShackAPI + apiVersion: 1.0.0 + applicationName: DefaultApplication + requestConunt: "12" + AlertConfigInfo: + title: Alert Configuration Info + type: object additionalProperties: - type: object - description : Map of custom properties of API - accessControl: type: string - description: | - Is the API is restricted to certain set of publishers or creators or is it visible to all the - publishers and creators. If the accessControl restriction is none, this API can be modified by all the - publishers and creators, if not it can only be viewable/modifiable by certain set of publishers and creators, - based on the restriction. enum: - - NONE - - RESTRICTED - accessControlRoles: - type: array - description: The user roles that are able to view/modify as API publisher or creator. - items: - type: string - example: [admin] - businessInformation: + description: The config parameters. + example: + apiName: PizzaShackAPI + apiVersion: 1.0.0 + applicationName: DefaultApplication + requestConunt: "12" + APICategory: + title: API Category + required: + - name + type: object + properties: + id: + type: string + example: 01234567-0123-0123-0123-012345678901 + name: + type: string + example: Finance + description: + type: string + example: Finance related APIs + APICategoryList: + title: API Category List + type: object + properties: + count: + type: integer + description: | + Number of API categories returned. + example: 1 + list: + type: array + items: + $ref: '#/components/schemas/APICategory' + KeyManagerInfo: + title: Key Manager Info + required: + - name + - type + type: object + properties: + id: + type: string + example: 01234567-0123-0123-0123-012345678901 + name: + type: string + example: WSO2 IS + displayName: + type: string + description: | + display name of Keymanager + example: Keymanager1 + type: + type: string + example: IS + description: + type: string + example: This is a key manager for Developers + enabled: + type: boolean + example: true + additionalProperties: + type: array + items: + type: object + properties: {} + KeyManagerList: + title: Key Manager List + type: object + properties: + count: + type: integer + description: | + Number of Key managers returned. + example: 1 + list: + type: array + items: + $ref: '#/components/schemas/KeyManagerInfo' + DeploymentList: + title: Deployment List + type: object + properties: + count: + type: integer + description: | + Number of deployment clusters returned. + example: 1 + list: + type: array + items: + $ref: '#/components/schemas/Deployments' + Deployments: + title: Deployments + required: + - clusters + - name + type: object + properties: + name: + type: string + example: Kubernetes + clusters: + type: array + items: + $ref: '#/components/schemas/DeploymentClusterInfo' + DeploymentClusterInfo: + title: DeploymentClusterInfo + required: + - accessURL + - clusterName + - displayName + - properties + type: object + properties: + clusterName: + type: string + example: minikube + accessURL: + type: string + example: https://api.com + displayName: + type: string + example: kubernetes-minikube properties: - businessOwner: - type: string - example: businessowner - businessOwnerEmail: + type: object + additionalProperties: type: string - example: businessowner@wso2.com - technicalOwner: - type: string - example: technicalowner - technicalOwnerEmail: + DeploymentStatusList: + title: DeploymentStatus List + type: object + properties: + count: + type: integer + description: | + Status of the deployments returned. + example: 1 + list: + type: array + items: + $ref: '#/components/schemas/DeploymentStatus' + DeploymentStatus: + title: DeploymentStatus + required: + - clusters + - type + type: object + properties: + type: + type: string + example: Kubernetes + clusters: + type: array + items: + $ref: '#/components/schemas/DeploymentClusterStatus' + DeploymentClusterStatus: + title: DeploymentClusterStatus + required: + - clusterName + - healthStatus + - podsRunning + type: object + properties: + clusterName: + type: string + example: Minikube + podsRunning: + type: integer + healthStatus: + type: array + items: + $ref: '#/components/schemas/PodStatus' + DeploymentEnvironments: + title: DeploymentEnvironments + required: + - clusterName + - type + type: object + properties: + type: + type: string + example: Kubernetes + clusterName: + type: array + example: + - minikube + items: type: string - example: technicalowner@wso2.com - corsConfiguration: - description: | - CORS configuration for the API - properties: - corsConfigurationEnabled: - type: boolean - default: false - accessControlAllowOrigins: - type: array - items: - type: string - accessControlAllowCredentials: - type: boolean - default: false - accessControlAllowHeaders: - type: array - items: + PodStatus: + title: PodStatus + required: + - name + - ready + - status + type: object + properties: + name: + type: string + example: petStore-677bb7cc65-shb2f + ready: + type: string + example: 1/1 + status: + type: string + example: running + creationTimestamp: + type: string + example: 2020-05-12T06:12:00Z + AsyncAPISpecificationValidationResponse: + title: AsyncAPI Specification Validation Response + required: + - isValid + type: object + properties: + isValid: + type: boolean + description: + This attribute declares whether this definition is valid or not. + example: true + content: + type: string + description: + AsyncAPI specification content + info: + type: object + properties: + name: type: string - accessControlAllowMethods: - type: array - items: + example: Streetlights + version: type: string - -#----------------------------------------------------- -# The Application resource -#----------------------------------------------------- - Application: - title: Application - required: - - name - - throttlingTier - properties: - applicationId: - type: string - example: 01234567-0123-0123-0123-012345678901 - name: - type: string - example: CalculatorApp - subscriber: - type: string - example: admin - throttlingTier: - type: string - example: Unlimited - description: - type: string - example: Sample calculator application - groupId: - type: string - example: "" - -#----------------------------------------------------- -# The Document List resource -#----------------------------------------------------- - DocumentList: - title: Document List - properties: - count: + example: 1.0.0 + context: + type: string + example: /streetlights + description: + type: string + example: A sample API that uses a streetlights as an example to demonstrate AsyncAPI specifications + asyncAPIVersion: + type: string + example: 2.0 + endpoints: + type: array + description: + contains host/servers specified in the AsyncAPI file/URL + items: + type: string + example: "https://localhost:9443/am/sample/pizzashack/v1/api/" + description: + API definition information + errors: + type: array + description: + If there are more than one error list them out. + For example, list out validation error by each field. + items: + $ref: '#/components/schemas/ErrorListItem' + responses: + BadRequest: + description: Bad Request. Invalid request or validation error. + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + example: + code: 400 + message: Bad Request + description: Invalid request or validation error + moreInfo: "" + error: [] + Conflict: + description: Conflict. Specified resource already exists. + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + example: + code: 409 + message: Conflict + description: Specified resource already exists + moreInfo: "" + error: [] + Forbidden: + description: Forbidden. The request must be conditional but no condition has + been specified. + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + example: + code: 403 + message: Forbidden + description: The request must be conditional but no condition has been + specified + moreInfo: "" + error: [] + InternalServerError: + description: Internal Server Error. + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + example: + code: 500 + message: Internal Server Error + description: The server encountered an internal error. Please contact + administrator. + moreInfo: "" + error: [] + NotAcceptable: + description: Not Acceptable. The requested media type is not supported. + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + example: + code: 406 + message: Not Acceptable + description: The requested media type is not supported + moreInfo: "" + error: [] + NotFound: + description: Not Found. The specified resource does not exist. + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + example: + code: 404 + message: Not Found + description: The specified resource does not exist + moreInfo: "" + error: [] + PreconditionFailed: + description: Precondition Failed. The request has not been performed because + one of the preconditions is not met. + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + example: + code: 412 + message: Precondition Failed + description: The request has not been performed because one of the preconditions + is not met + moreInfo: "" + error: [] + Unauthorized: + description: Unauthorized. The user is not authorized. + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + example: + code: 401 + message: Unauthorized + description: The user is not authorized + moreInfo: "" + error: [] + UnsupportedMediaType: + description: Unsupported Media Type. The entity of the request was not in a + supported format. + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + example: + code: 415 + message: Unsupported media type + description: The entity of the request was not in a supported format + moreInfo: "" + error: [] + parameters: + replyLimit: + name: replyLimit + in: query + description: | + Maximum size of replies array to return. + schema: type: integer - description: | - Number of Documents returned. - example: 1 - next: - type: string - description: | - Link to the next subset of resources qualified. - Empty if no more resources are to be returned. - example: "/apis/01234567-0123-0123-0123-012345678901/documents?limit=1&offset=2" - previous: + default: 25 + replyOffset: + name: replyOffset + in: query + description: | + Starting point within the complete list of replies. + schema: + type: integer + default: 0 + commentId: + name: commentId + in: path + description: | + Comment Id + required: true + schema: type: string - description: | - Link to the previous subset of resources qualified. - Empty if current subset is the first subset returned. - example: "/apis/01234567-0123-0123-0123-012345678901/documents?limit=1&offset=0" - list: - type: array - items: - $ref: '#/definitions/Document' - -#----------------------------------------------------- -# The Document resource -#----------------------------------------------------- - Document: - title: Document - required: - - name - - type - - sourceType - - visibility - properties: - documentId: + parentCommentID: + name: replyTo + in: query + description: | + ID of the perent comment. + schema: type: string - example: 01234567-0123-0123-0123-012345678901 - name: + includeCommenterInfo: + name: includeCommenterInfo + in: query + description: | + Whether we need to display commentor details. + schema: + type: boolean + default : false + apiId: + name: apiId + in: path + description: | + **API ID** consisting of the **UUID** of the API. + required: true + schema: type: string - example: CalculatorDoc - type: + endpointId: + name: endpointId + in: path + description: | + **Endpoint ID** consisting of the **UUID** of the Endpoint**. + required: true + schema: type: string - enum: - - HOWTO - - SAMPLES - - PUBLIC_FORUM - - SUPPORT_FORUM - - API_MESSAGE_FORMAT - - SWAGGER_DOC - - OTHER - example: HOWTO - summary: + apiId-Q: + name: apiId + in: query + description: | + **API ID** consisting of the **UUID** of the API. + The combination of the provider of the API, name of the API and the version is also accepted as a valid API I. + Should be formatted as **provider-name-version**. + required: true + schema: type: string - example: "Summary of Calculator Documentation" - sourceType: + apiId-Q-Opt: + name: apiId + in: query + description: | + **API ID** consisting of the **UUID** of the API. + The combination of the provider of the API, name of the API and the version is also accepted as a valid API I. + Should be formatted as **provider-name-version**. + schema: type: string - enum: - - INLINE - - URL - - FILE - example: INLINE - sourceUrl: + labelType-Q: + name: labelType + in: query + description: | + **API ID** consisting of the **UUID** of the API. + The combination of the provider of the API, name of the API and the version is also accepted as a valid API I. + Should be formatted as **provider-name-version**. + schema: type: string - example: "" - otherTypeName: + name: + name: name + in: path + description: | + Name of the API + required: true + schema: type: string - example: "" - visibility: + version: + name: version + in: path + description: | + Version of the API + required: true + schema: type: string - enum: - - OWNER_ONLY - - PRIVATE - - API_LEVEL - example: API_LEVEL - -#----------------------------------------------------- -# The Mediation List resource -#----------------------------------------------------- - mediationList: - title: Mediation List - properties: - count: - type: integer - description: | - Number of mediation sequences returned. - example: 1 - next: + apiName-Q: + name: name + in: query + description: | + Name of the API + schema: type: string - description: | - Link to the next subset of sequences qualified. - Empty if no more sequences are to be returned. - example: "" - previous: + apiVersion-Q: + name: version + in: query + description: | + Version of the API + schema: type: string - description: | - Link to the previous subset of sequences qualified. - Empty if current subset is the first subset returned. - example: "" - list: - type: array - items: - $ref: '#/definitions/MediationInfo' - -#----------------------------------------------------- -# The MediationInfo resource -#----------------------------------------------------- - MediationInfo: - title: MediationInfo - required: - - name - - type - - id - properties: - name: + apiProvider-Q: + name: providerName + in: query + description: | + Provider name of the API + schema: type: string - example: json_fault.xml - id: + documentId: + name: documentId + in: path + description: | + Document Identifier + required: true + schema: type: string - example: 01234567-0123-0123-0123-012345678901 - type: + applicationId: + name: applicationId + in: path + description: | + **Application Identifier** consisting of the UUID of the Application. + required: true + schema: type: string - enum: - - in - - out - - fault - example: in -#----------------------------------------------------- -# The Mediation resource -#----------------------------------------------------- - Mediation: - title: Mediation - required: - - name - - type - - config - properties: - id: + subscriptionId: + name: subscriptionId + in: path + description: | + Subscription Id + required: true + schema: type: string - example: 01234567-0123-0123-0123-012345678901 - name: + mediationPolicyId: + name: mediationPolicyId + in: path + description: | + Mediation policy Id + required: true + schema: type: string - example: json_fault.xml - type: + resourcePolicyId: + name: resourcePolicyId + in: path + description: | + registry resource Id + required: true + schema: type: string - enum: - - in - - out - - fault - example: in - config: + subscriptionId-Q: + name: subscriptionId + in: query + description: | + Subscription Id + required: true + schema: type: string - example: ' - - - - ' - -#----------------------------------------------------- -# The MediationInfo resource -#----------------------------------------------------- - Wsdl: - title: Wsdl - required: - - name - properties: - name: - type: string - example: admin--calculatorAPI2.0.wsdl - wsdlDefinition: - type: string + # API Revision Identifier + # Specified as part of the path expression + revisionId: + name: revisionId + in: path + description: | + Revision ID of an API + required: true + schema: + type: string -# The Tier List resource -#----------------------------------------------------- - TierList: - title: Tier List - properties: - count: - type: integer - description: | - Number of Tiers returned. - example: 1 - next: + # API Revision Identifier + # Specified as part of the query string + revisionId-Q: + name: revisionId + in: query + description: | + Revision ID of an API + schema: type: string - description: | - Link to the next subset of resources qualified. - Empty if no more resources are to be returned. - example: "/tiers/api?limit=1&offset=2" - previous: + revisionNum-Q: + name: revisionNumber + in: query + description: | + Revision Number of an API + schema: type: string - description: | - Link to the previous subset of resources qualified. - Empty if current subset is the first subset returned. - example: "/tiers/api?limit=1&offset=0" - list: - type: array - items: - $ref: '#/definitions/Tier' - -#----------------------------------------------------- -# The Tier resource -#----------------------------------------------------- - Tier: - title: Tier - required: - - name - - tierPlan - - requestCount - - unitTime - - stopOnQuotaReach - properties: - name: + policyName: + name: policyName + in: path + description: | + Tier name + required: true + schema: type: string - example: Platinum - description: + policyName-Q: + name: policyName + in: query + description: | + Name of the policy + required: true + schema: type: string - example: "Allows 50 request(s) per minute." - tierLevel: + policyLevel: + name: policyLevel + in: path + description: | + List API or Application or Resource type policies. + required: true + schema: type: string enum: - api - - application - - resource - example: api - attributes: - description: | - Custom attributes added to the tier policy - type: object - additionalProperties: - type: string - example: {} - requestCount: - description: | - Maximum number of requests which can be sent within a provided unit time - type: integer - format: int64 - example: 50 - unitTime: - type: integer - format: int64 - example: 60000 - timeUnit: - type: string - example: "min" - tierPlan: - description: | - This attribute declares whether this tier is available under commercial or free - type: string - enum: - - FREE - - COMMERCIAL - example: FREE - stopOnQuotaReach: - description: | - By making this attribute to false, you are capabale of sending requests - even if the request count exceeded within a unit time - type: boolean - example: true - -#----------------------------------------------------- -# The Tier Permission resource -#----------------------------------------------------- - TierPermission: - title: tierPermission - required: - - permissionType - - roles - properties: - permissionType: + - subcription + policyLevel-Q: + name: policyLevel + in: query + description: | + List API or Application or Resource type policies. + required: true + schema: type: string enum: - - allow - - deny - example: deny - roles: - type: array - items: - type: string - example: ["Internal/everyone"] - -#----------------------------------------------------- -# The Subscription List resource -#----------------------------------------------------- - SubscriptionList: - title: Subscription List - properties: - count: + - api + - subcription + limit: + name: limit + in: query + description: | + Maximum size of resource array to return. + schema: type: integer - description: | - Number of Subscriptions returned. - example: 1 - next: - type: string - description: | - Link to the next subset of resources qualified. - Empty if no more resources are to be returned. - example: "/subscriptions?limit=1&offset=2&apiId=01234567-0123-0123-0123-012345678901&groupId=" - previous: - type: string - description: | - Link to the previous subset of resources qualified. - Empty if current subset is the first subset returned. - example: "/subscriptions?limit=1&offset=0&apiId=01234567-0123-0123-0123-012345678901&groupId=" - list: - type: array - items: - $ref: '#/definitions/Subscription' - -#----------------------------------------------------- -# The Subscription resource -#----------------------------------------------------- - Subscription: - title: Subscription - required: - - applicationId - - apiIdentifier - - tier - properties: - subscriptionId: - type: string - example: 01234567-0123-0123-0123-012345678901 - applicationId: - type: string - example: 01234567-0123-0123-0123-012345678901 - apiIdentifier: - type: string - example: 01234567-0123-0123-0123-012345678901 - tier: - type: string - example: Unlimited - status: - type: string - enum: - - BLOCKED - - PROD_ONLY_BLOCKED - - UNBLOCKED - - ON_HOLD - - REJECTED - example: UNBLOCKED - -#----------------------------------------------------- -# The Extended Subscription resource -#----------------------------------------------------- - ExtendedSubscription: - title: Subscription with Ext. Workflow Reference - required: - - workflowId - allOf: - - $ref: '#/definitions/Subscription' - - properties: - workflowId: - type: string - example: 01234567-0123-0123-0123-012345678901 - -#----------------------------------------------------- -# The Sequence resource -#----------------------------------------------------- - Sequence: - title: Sequence - required: - - name - properties: - name: - type: string - example: log_in_message - type: - type: string - example: in - id: + default: 25 + Accept: + name: Accept + in: header + description: | + Media types acceptable for the response. Default is application/json. + schema: type: string - example: 69ea3fa6-55c6-472e-896d-e449dd34a824 - shared: - type: boolean - example: true - -#----------------------------------------------------- -# The Error resource -#----------------------------------------------------- - Error: - title: Error object returned with 4XX HTTP status - required: - - code - - message - properties: - code: + default: application/json + offset: + name: offset + in: query + description: | + Starting point within the complete list of items qualified. + schema: type: integer - format: int64 - message: - type: string - description: Error message. - description: - type: string - description: | - A detail description about the error message. - moreInfo: + default: 0 + If-None-Match: + name: If-None-Match + in: header + description: | + Validator for conditional requests; based on the ETag of the formerly retrieved + variant of the resource. + schema: type: string - description: | - Preferably an url with more details about the error. - error: - type: array - description: | - If there are more than one error list them out. - For example, list out validation errors by each field. - items: - $ref: '#/definitions/ErrorListItem' - -#----------------------------------------------------- -# The Error List Item resource -#----------------------------------------------------- - ErrorListItem: - title: Description of individual errors that may have occurred during a request. - required: - - code - - message - properties: - code: + If-Match: + name: If-Match + in: header + description: | + Validator for conditional requests; based on ETag. + schema: type: string - message: + scopeName: + name: scopeId + in: path + description: | + Scope name + required: true + schema: type: string - description: | - Description about individual errors occurred - -#----------------------------------------------------- -# The Environment resource -#----------------------------------------------------- - Environment: - title: Environment - required: - - name - - type - - serverUrl - - endpoints - - showInApiConsole - properties: - name: + scopeId: + name: scopeId + in: path + description: | + Scope Id consisting the UUID of the shared scope + required: true + schema: type: string - example: Production and Sandbox - type: + expand: + name: expand + in: query + description: | + Defines whether the returned response should contain full details of API + schema: + type: boolean + threatProtectionPolicyId: + name: policyId + in: path + description: | + The UUID of a Policy + required: true + schema: type: string - example: hybrid - serverUrl: + roleId: + name: roleId + in: path + description: | + The Base 64 URL encoded role name with domain. If the given role is in secondary user-store, role ID should be + derived as Base64URLEncode({user-store-name}/{role-name}). If the given role is in PRIMARY user-store, role ID + can be derived as Base64URLEncode(role-name) + required: true + schema: type: string - example: "https://localhost:9443/services/" - showInApiConsole: - type: boolean - example: true - endpoints: - $ref: '#/definitions/EnvironmentEndpoints' - -#----------------------------------------------------- -# The Environment List resource -#----------------------------------------------------- - EnvironmentList: - title: Environment List - properties: - count: - type: integer - description: | - Number of Environments returned. - example: 1 - list: - type: array - items: - $ref: '#/definitions/Environment' - - -#----------------------------------------------------- -# The Environment Endpoint resource -#----------------------------------------------------- - EnvironmentEndpoints : - title: Environment Endpoints - properties: - http: + requestedTenant: + name: X-WSO2-Tenant + in: header + description: | + For cross-tenant invocations, this is used to specify the tenant domain, where the resource need to be + retirieved from. + schema: type: string - description: HTTP environment URL - example: "http://localhost:8280" - https: + apiProductId: + name: apiProductId + in: path + description: | + **API Product ID** consisting of the **UUID** of the API Product. Using the **UUID** in the API call is recommended. + required: true + schema: type: string - description: HTTPS environment URL - example: "https://localhost:8243" - -#----------------------------------------------------- -# The File Information resource -#----------------------------------------------------- - FileInfo : - title: File Information including meta data - properties: - relativePath: + x-encoded: true + x-encoded: true + tenantDomain: + name: tenantDomain + in: path + description: | + The domain of a specific tenant + required: true + schema: type: string - description: relative location of the file (excluding the base context and host of the Publisher API) - example: "apis/01234567-0123-0123-0123-012345678901/thumbnail" - mediaType: + alertType: + name: alertType + in: path + description: The alert type. + required: true + schema: type: string - description: media-type of the file - example: "image/jpeg" - - -#----------------------------------------------------- -# The workflow response resource -#----------------------------------------------------- - Workflow: - title: workflow - required: - - status - properties: - status: - description: | - This attribute declares whether this workflow task is approved or rejected. + configurationId: + name: configurationId + in: path + description: The alert configuration id. + required: true + schema: type: string - enum: - - APPROVED - - REJECTED - example: APPROVED - attributes: - description: | - Custom attributes to complete the workflow task - type: object - additionalProperties: - type: string - example: {} - description: + tierQuotaType: + name: tierQuotaType + description: Filter the subscription base on tier quota type + in: query + schema: type: string - example: "Approve workflow request." \ No newline at end of file + requestBodies: + threatProtectionPolicy: + description: | + Threat protection policy request parameter + content: + application/json: + schema: + $ref: '#/components/schemas/ThreatProtectionPolicy' + required: true + securitySchemes: + OAuth2Security: + type: oauth2 + flows: + password: + tokenUrl: https://localhost:9443/oauth2/token + scopes: + openid: Authorize access to user details + apim:api_view: View API + apim:api_create: Create API + apim:api_delete: Delete API + apim:api_publish: Publish API + apim:subscription_view: View Subscription + apim:subscription_block: Block Subscription + apim:external_services_discover: Discover External Services + apim:threat_protection_policy_create: Create threat protection policies + apim:threat_protection_policy_manage: Update and delete threat protection policies + apim:document_create: Create API documents + apim:document_manage: Update and delete API documents + apim:mediation_policy_view: View mediation policies + apim:mediation_policy_create: Create mediation policies + apim:mediation_policy_manage: Update and delete mediation policies + apim:client_certificates_view: View client certificates + apim:client_certificates_add: Add client certificates + apim:client_certificates_update: Update and delete client certificates + apim:ep_certificates_view: View backend endpoint certificates + apim:ep_certificates_add: Add backend endpoint certificates + apim:ep_certificates_update: Update and delete backend endpoint certificates + apim:publisher_settings: Retrieve store settings + apim:pub_alert_manage: Get/ subscribe/ configure publisher alerts + apim:shared_scope_manage: Manage shared scopes + apim:app_import_export: Import and export applications related operations + apim:api_import_export: Import and export APIs related operations + apim:api_product_import_export: Import and export API Products related operations diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/pom.xml b/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/pom.xml index f033de1d89..ce938982e9 100644 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/pom.xml +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/pom.xml @@ -43,10 +43,22 @@ org.eclipse.osgi org.eclipse.osgi + + + javax.ws.rs + javax.ws.rs + + org.eclipse.osgi org.eclipse.osgi.services + + + javax.ws.rs + javax.ws.rs + + org.testng @@ -55,62 +67,166 @@ org.wso2.tomcat tomcat + + + javax.ws.rs + javax.ws.rs + + org.wso2.tomcat tomcat-servlet-api + + + javax.ws.rs + javax.ws.rs + + org.wso2.carbon org.wso2.carbon.core + + + javax.ws.rs + javax.ws.rs + + org.wso2.carbon org.wso2.carbon.logging + + + javax.ws.rs + javax.ws.rs + + org.wso2.carbon org.wso2.carbon.utils + + + javax.ws.rs + javax.ws.rs + + org.apache.axis2.wso2 axis2 + + + javax.ws.rs + javax.ws.rs + + com.google.code.gson gson + + + javax.ws.rs + javax.ws.rs + + org.wso2.orbit.org.scannotation scannotation + + + javax.ws.rs + javax.ws.rs + + javax.ws.rs jsr311-api + + + javax.ws.rs + javax.ws.rs + + org.wso2.carbon.devicemgt org.wso2.carbon.apimgt.annotations + + + javax.ws.rs + javax.ws.rs + + org.wso2.carbon.governance org.wso2.carbon.governance.api + + + javax.ws.rs + javax.ws.rs + + org.wso2.carbon.governance org.wso2.carbon.governance.lcm + + + javax.ws.rs + javax.ws.rs + + javax.ws.rs javax.ws.rs-api + + + javax.ws.rs + javax.ws.rs + + org.wso2.carbon.devicemgt org.wso2.carbon.device.mgt.common + + + javax.ws.rs + javax.ws.rs + + - org.wso2.carbon.devicemgt - org.wso2.carbon.apimgt.integration.client + org.wso2.carbon.apimgt + org.wso2.carbon.apimgt.api + provided + 9.0.5 + + + javax.ws.rs + javax.ws.rs + + + + + org.wso2.carbon.apimgt + org.wso2.carbon.apimgt.impl + 9.0.5 + provided + + + javax.ws.rs + javax.ws.rs + + com.h2database.wso2 @@ -144,70 +260,62 @@ org.wso2.carbon.apimgt.webapp.publisher.* - org.osgi.framework, - org.osgi.service.component, - org.apache.commons.logging, - javax.servlet, - javax.xml.*, - javax.xml.parsers;version="${javax.xml.parsers.import.pkg.version}";resolution:=optional, - com.google.gson.*, - org.apache.catalina, - org.apache.catalina.core, - org.apache.axis2.*;version="${axis2.osgi.version.range}", - org.wso2.carbon.core, - org.apache.commons.lang, - org.wso2.carbon.utils, - org.wso2.carbon.apimgt.annotations.*, - org.wso2.carbon.governance.lcm.util.*, - org.wso2.carbon.registry.core.*, - io.swagger.annotations, - javax.net.ssl, - org.scannotation, - org.scannotation.archiveiterator, - org.w3c.dom, - org.wso2.carbon.apimgt.integration.client.*, - org.wso2.carbon.context, - org.wso2.carbon.core.util, - org.wso2.carbon.user.api, - org.wso2.carbon.user.core.*, - org.wso2.carbon.utils.multitenancy, - org.wso2.carbon.apimgt.integration.generated.client.publisher.api, - org.wso2.carbon.apimgt.integration.generated.client.publisher.model + com.google.gson;version="2.3",com.google.gson.reflect; + version="2.3",io.swagger.annotations,javax.servlet;version="2.6",javax.xml,javax.xml.bind,javax.xml.bind.annotat + ion,javax.xml.parsers,org.apache.catalina;version="9.0",org.apache.ca + talina.core;version="9.0",org.apache.commons.logging;version="1.2",org.osgi.framework.*;version="${imp.package.version.osgi.framework}", + org.osgi.service.*;version="${imp.package.version.osgi.service}",org.scannotation;version="1.0",org.scannotation.archiveiterator;ve + rsion="1.0",org.w3c.dom,org.wso2.carbon.apimgt.annotations.api,org.ws + o2.carbon.apimgt.api,org.wso2.carbon.apimgt.api.model,org.wso2.carbon + .apimgt.impl,org.wso2.carbon.apimgt.webapp.publisher,org.wso2.carbon. + apimgt.webapp.publisher.config,org.wso2.carbon.apimgt.webapp.publishe + r.dto,org.wso2.carbon.apimgt.webapp.publisher.exception,org.wso2.carb + on.apimgt.webapp.publisher.lifecycle.listener,org.wso2.carbon.apimgt. + webapp.publisher.lifecycle.util,org.wso2.carbon.base;version="1.0",or + g.wso2.carbon.context;version="4.6",org.wso2.carbon.core;version="4.6 + ",org.wso2.carbon.core.util;version="4.6",org.wso2.carbon.registry.co + re.service;version="1.0",org.wso2.carbon.user.api;version="1.0",org.w + so2.carbon.user.core.service;version="4.6",org.wso2.carbon.user.core. + tenant;version="4.6",org.wso2.carbon.utils;version="4.6",org.wso2.car + bon.utils.multitenancy;version="4.6" - javax.ws.rs-api, - scribe;scope=compile|runtime;inline=false; + + jsr311-api;scope=compile|runtime;inline=false + - * + - - org.jacoco - jacoco-maven-plugin - - ${basedir}/target/coverage-reports/jacoco-unit.exec - - - - jacoco-initialize - - prepare-agent - - - - jacoco-site - test - - report - - - ${basedir}/target/coverage-reports/jacoco-unit.exec - ${basedir}/target/coverage-reports/site - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/main/java/org/wso2/carbon/apimgt/webapp/publisher/APIPublisherServiceImpl.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/main/java/org/wso2/carbon/apimgt/webapp/publisher/APIPublisherServiceImpl.java index 2fe35e472b..a6b98ad438 100644 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/main/java/org/wso2/carbon/apimgt/webapp/publisher/APIPublisherServiceImpl.java +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/main/java/org/wso2/carbon/apimgt/webapp/publisher/APIPublisherServiceImpl.java @@ -18,15 +18,34 @@ */ package org.wso2.carbon.apimgt.webapp.publisher; -import feign.FeignException; -import org.wso2.carbon.apimgt.integration.generated.client.publisher.model.*; -import org.wso2.carbon.apimgt.integration.client.publisher.PublisherClient; +import org.wso2.carbon.apimgt.api.APIManagementException; +import org.wso2.carbon.apimgt.api.APIProvider; +import org.wso2.carbon.apimgt.api.FaultGatewaysException; +import org.wso2.carbon.apimgt.api.model.API; +import org.wso2.carbon.apimgt.api.model.APIIdentifier; +import org.wso2.carbon.apimgt.api.model.APIRevision; +import org.wso2.carbon.apimgt.api.model.APIRevisionDeployment; +import org.wso2.carbon.apimgt.api.model.CORSConfiguration; +import org.wso2.carbon.apimgt.api.model.Scope; +import org.wso2.carbon.apimgt.api.model.Tier; +import org.wso2.carbon.apimgt.api.model.URITemplate; +import org.wso2.carbon.apimgt.impl.APIConstants; +import org.wso2.carbon.apimgt.impl.APIManagerFactory; import org.wso2.carbon.apimgt.webapp.publisher.config.WebappPublisherConfig; +import org.wso2.carbon.apimgt.webapp.publisher.dto.ApiUriTemplate; import org.wso2.carbon.apimgt.webapp.publisher.exception.APIManagerPublisherException; -import org.wso2.carbon.apimgt.webapp.publisher.internal.APIPublisherDataHolder; import org.wso2.carbon.context.PrivilegedCarbonContext; import org.wso2.carbon.utils.multitenancy.MultitenantUtils; -import java.util.*; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.Set; + +//import org.wso2.carbon.apimgt.integration.generated.client.publisher.model.*; +//import org.wso2.carbon.apimgt.integration.client.publisher.PublisherClient; /** * This class represents the concrete implementation of the APIPublisherService that corresponds to providing all @@ -39,6 +58,7 @@ public class APIPublisherServiceImpl implements APIPublisherService { private static final String PUBLISHED_STATUS = "PUBLISHED"; private static final String CREATED_STATUS = "CREATED"; private static final String PUBLISH_ACTION = "Publish"; + public static final APIManagerFactory API_MANAGER_FACTORY = APIManagerFactory.getInstance(); @Override public void publishAPI(APIConfig apiConfig) throws APIManagerPublisherException { @@ -47,99 +67,127 @@ public class APIPublisherServiceImpl implements APIPublisherService { PrivilegedCarbonContext.getThreadLocalCarbonContext().setTenantDomain(tenantDomain, true); PrivilegedCarbonContext.getThreadLocalCarbonContext().setUsername(apiConfig.getOwner()); try { - PublisherClient publisherClient = APIPublisherDataHolder.getInstance().getIntegrationClientService() - .getPublisherClient(); + APIProvider apiProvider = API_MANAGER_FACTORY.getAPIProvider(apiConfig.getOwner()); API api = getAPI(apiConfig); - APIList apiList = publisherClient.getApis().apisGet(100, 0, "name:" + api.getName(), CONTENT_TYPE, null); - if (!isExist(api, apiList)) { - api = publisherClient.getApi().apisPost(api, CONTENT_TYPE, null); - if (CREATED_STATUS.equals(api.getStatus())) { - publisherClient.getApi().apisChangeLifecyclePost(PUBLISH_ACTION, api.getId(), null, null, null); + if (!apiProvider.isAPIAvailable(api.getId())) { + API createdAPI = apiProvider.addAPI(api); + if (CREATED_STATUS.equals(createdAPI.getStatus())) { + apiProvider.changeLifeCycleStatus(tenantDomain, createdAPI.getUuid(), PUBLISH_ACTION, null); + APIRevision apiRevision = new APIRevision(); + apiRevision.setApiUUID(createdAPI.getUuid()); + apiRevision.setDescription("Initial Revision"); + String apiRevisionId = apiProvider.addAPIRevision(apiRevision, tenantDomain); + APIRevisionDeployment apiRevisionDeployment = new APIRevisionDeployment(); + apiRevisionDeployment.setDeployment(API_PUBLISH_ENVIRONMENT); + apiRevisionDeployment.setVhost("localhost"); + apiRevisionDeployment.setDisplayOnDevportal(true); + + List apiRevisionDeploymentList = new ArrayList<>(); + apiRevisionDeploymentList.add(apiRevisionDeployment); + apiProvider.deployAPIRevision(createdAPI.getUuid(), apiRevisionId, apiRevisionDeploymentList); + } } else { if (WebappPublisherConfig.getInstance().isEnabledUpdateApi()) { - for (APIInfo apiInfo : apiList.getList()) { - if (api.getName().equals(apiInfo.getName()) && api.getVersion().equals(apiInfo.getVersion())) { - api = publisherClient.getApi().apisApiIdPut(apiInfo.getId(), api, CONTENT_TYPE, null, null); - if (api != null && CREATED_STATUS.equals(api.getStatus())) { - publisherClient.getApi().apisChangeLifecyclePost(PUBLISH_ACTION, api.getId(), null, null, - null); - } + API existingAPI = apiProvider.getAPI(api.getId()); + api.setStatus(existingAPI.getStatus()); + apiProvider.updateAPI(api); + if (api.getId().getName().equals(existingAPI.getId().getName()) && + api.getId().getVersion().equals(existingAPI.getId().getVersion())) { + if (CREATED_STATUS.equals(existingAPI.getStatus())) { + apiProvider.changeLifeCycleStatus(tenantDomain, existingAPI.getUuid(), PUBLISH_ACTION, null); } - } } } - } catch (FeignException e) { + + + } catch (FaultGatewaysException | APIManagementException e) { throw new APIManagerPublisherException(e); } finally { PrivilegedCarbonContext.endTenantFlow(); } } - private boolean isExist(API api, APIList apiList) { - if (apiList == null || apiList.getList() == null || apiList.getList().size() == 0) { - return false; - } - for (APIInfo existingApi : apiList.getList()) { - if (existingApi.getName() != null && existingApi.getName().equals(api. - getName()) && existingApi.getVersion() != null && - existingApi.getVersion().equals(api.getVersion())) { - return true; - } - } - return false; - } - private API getAPI(APIConfig config) { - API api = new API(); - api.setName(config.getName()); + APIIdentifier apiIdentifier = new APIIdentifier(config.getOwner(), config.getName(), config.getVersion()); + API api = new API(apiIdentifier); api.setDescription(""); - String context = config.getContext(); context = context.startsWith("/") ? context : ("/" + context); - api.setContext(context); - api.setVersion(config.getVersion()); - api.setProvider(config.getOwner()); - api.setApiDefinition(APIPublisherUtil.getSwaggerDefinition(config)); - api.setWsdlUri(null); - api.setStatus(PUBLISHED_STATUS); - api.setResponseCaching("DISABLED"); - api.setDestinationStatsEnabled("false"); - api.isDefaultVersion(config.isDefault()); - List transport = new ArrayList<>(); - transport.add("https"); - transport.add("http"); - api.transport(transport); - api.setTags(Arrays.asList(config.getTags())); - api.addTiersItem(UNLIMITED_TIER); - api.setGatewayEnvironments(API_PUBLISH_ENVIRONMENT); + api.setContext(context + "/" + config.getVersion()); +// api.setContext(context); + api.setStatus(CREATED_STATUS); + api.setWsdlUrl(null); + api.setResponseCache("Disabled"); + api.setContextTemplate(context + "/{version}" ); + api.setSwaggerDefinition(APIPublisherUtil.getSwaggerDefinition(config)); + api.setType("HTTP"); + + Set uriTemplates = new HashSet<>(); + Iterator iterator; + for (iterator = config.getUriTemplates().iterator(); iterator.hasNext(); ) { + ApiUriTemplate apiUriTemplate = iterator.next(); + URITemplate uriTemplate = new URITemplate(); + uriTemplate.setAuthType(apiUriTemplate.getAuthType()); + uriTemplate.setHTTPVerb(apiUriTemplate.getHttpVerb()); + uriTemplate.setResourceURI(apiUriTemplate.getResourceURI()); + uriTemplate.setUriTemplate(apiUriTemplate.getUriTemplate()); + Scope scope = new Scope(); + if (apiUriTemplate.getScope() != null) { + scope.setName(apiUriTemplate.getScope().getName()); + scope.setDescription(apiUriTemplate.getScope().getDescription()); + scope.setKey(apiUriTemplate.getScope().getKey()); + scope.setRoles(apiUriTemplate.getScope().getRoles()); + uriTemplate.setScope(scope); + } + uriTemplates.add(uriTemplate); + } + api.setUriTemplates(uriTemplates); + + api.setApiOwner(config.getOwner()); + + + api.setDefaultVersion(config.isDefault()); + api.setTransports("https,http"); + + Set tags = new HashSet<>(); + tags.addAll(Arrays.asList(config.getTags())); + api.setTags(tags); + + Set availableTiers = new HashSet<>(); + availableTiers.add(new Tier(UNLIMITED_TIER)); + api.setAvailableTiers(availableTiers); + + Set environments = new HashSet<>(); + environments.add(API_PUBLISH_ENVIRONMENT); + api.setEnvironments(environments); + if (config.isSharedWithAllTenants()) { - api.setSubscriptionAvailability(API.SubscriptionAvailabilityEnum.all_tenants); - api.setVisibility(API.VisibilityEnum.PUBLIC); + api.setSubscriptionAvailability(APIConstants.SUBSCRIPTION_TO_ALL_TENANTS); + api.setVisibility(APIConstants.API_GLOBAL_VISIBILITY); } else { - api.setSubscriptionAvailability(API.SubscriptionAvailabilityEnum.current_tenant); - api.setVisibility(API.VisibilityEnum.PRIVATE); + api.setSubscriptionAvailability(APIConstants.SUBSCRIPTION_TO_CURRENT_TENANT); + api.setVisibility(APIConstants.API_PRIVATE_VISIBILITY); } - String endpointConfig = "{\"production_endpoints\":{\"url\":\"" + config.getEndpoint() + - "\",\"config\":null},\"implementation_status\":\"managed\",\"endpoint_type\":\"http\"}"; - + // String endpointConfig = "{\"production_endpoints\":{\"url\":\"" + config.getEndpoint() + + // "\",\"config\":null},\"endpoint_type\":\"http\"}"; + String endpointConfig = "{ \"endpoint_type\": \"http\", \"sandbox_endpoints\": { \"url\": \" " + + config.getEndpoint() + "\" }, \"production_endpoints\": { \"url\": \" "+ config.getEndpoint()+"\" } }"; api.setEndpointConfig(endpointConfig); - APICorsConfiguration apiCorsConfiguration = new APICorsConfiguration(); List accessControlAllowOrigins = new ArrayList<>(); accessControlAllowOrigins.add("*"); - apiCorsConfiguration.setAccessControlAllowOrigins(accessControlAllowOrigins); List accessControlAllowHeaders = new ArrayList<>(); accessControlAllowHeaders.add("authorization"); accessControlAllowHeaders.add("Access-Control-Allow-Origin"); accessControlAllowHeaders.add("Content-Type"); accessControlAllowHeaders.add("SOAPAction"); - apiCorsConfiguration.setAccessControlAllowHeaders(accessControlAllowHeaders); - + accessControlAllowHeaders.add("apikey"); + accessControlAllowHeaders.add("testKey"); List accessControlAllowMethods = new ArrayList<>(); accessControlAllowMethods.add("GET"); accessControlAllowMethods.add("PUT"); @@ -147,10 +195,16 @@ public class APIPublisherServiceImpl implements APIPublisherService { accessControlAllowMethods.add("POST"); accessControlAllowMethods.add("PATCH"); accessControlAllowMethods.add("OPTIONS"); - apiCorsConfiguration.setAccessControlAllowMethods(accessControlAllowMethods); - apiCorsConfiguration.setAccessControlAllowCredentials(false); - apiCorsConfiguration.corsConfigurationEnabled(false); - api.setCorsConfiguration(apiCorsConfiguration); + CORSConfiguration corsConfiguration = new CORSConfiguration(false, accessControlAllowOrigins, false, + accessControlAllowHeaders, accessControlAllowMethods); + api.setCorsConfiguration(corsConfiguration); + + api.setAuthorizationHeader("Authorization"); + List keyManagers = new ArrayList<>(); + keyManagers.add("all"); + api.setKeyManagers(keyManagers); + api.setEnableStore(true); + return api; } } diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/main/java/org/wso2/carbon/apimgt/webapp/publisher/internal/APIPublisherDataHolder.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/main/java/org/wso2/carbon/apimgt/webapp/publisher/internal/APIPublisherDataHolder.java index 639c2fe217..9acc17232f 100644 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/main/java/org/wso2/carbon/apimgt/webapp/publisher/internal/APIPublisherDataHolder.java +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/main/java/org/wso2/carbon/apimgt/webapp/publisher/internal/APIPublisherDataHolder.java @@ -18,7 +18,7 @@ */ package org.wso2.carbon.apimgt.webapp.publisher.internal; -import org.wso2.carbon.apimgt.integration.client.service.IntegrationClientService; +//import org.wso2.carbon.apimgt.integration.client.service.IntegrationClientService; import org.wso2.carbon.apimgt.webapp.publisher.APIConfig; import org.wso2.carbon.apimgt.webapp.publisher.APIPublisherService; import org.wso2.carbon.registry.core.service.RegistryService; @@ -37,7 +37,7 @@ public class APIPublisherDataHolder { private RegistryService registryService; private boolean isServerStarted; private Stack unpublishedApis = new Stack<>(); - private IntegrationClientService integrationClientService; + // private IntegrationClientService integrationClientService; private static APIPublisherDataHolder thisInstance = new APIPublisherDataHolder(); @@ -117,12 +117,12 @@ public class APIPublisherDataHolder { this.unpublishedApis = unpublishedApis; } - public IntegrationClientService getIntegrationClientService() { - return integrationClientService; - } + // public IntegrationClientService getIntegrationClientService() { + // return integrationClientService; + // } - public void setIntegrationClientService( - IntegrationClientService integrationClientService) { - this.integrationClientService = integrationClientService; - } + // public void setIntegrationClientService( + // IntegrationClientService integrationClientService) { + // this.integrationClientService = integrationClientService; + // } } diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/main/java/org/wso2/carbon/apimgt/webapp/publisher/internal/APIPublisherServiceComponent.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/main/java/org/wso2/carbon/apimgt/webapp/publisher/internal/APIPublisherServiceComponent.java index dd5736570c..a714d97aa8 100644 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/main/java/org/wso2/carbon/apimgt/webapp/publisher/internal/APIPublisherServiceComponent.java +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/main/java/org/wso2/carbon/apimgt/webapp/publisher/internal/APIPublisherServiceComponent.java @@ -22,7 +22,7 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.osgi.framework.BundleContext; import org.osgi.service.component.ComponentContext; -import org.wso2.carbon.apimgt.integration.client.service.IntegrationClientService; +//import org.wso2.carbon.apimgt.integration.client.service.IntegrationClientService; import org.wso2.carbon.apimgt.webapp.publisher.APIPublisherService; import org.wso2.carbon.apimgt.webapp.publisher.APIPublisherServiceImpl; import org.wso2.carbon.apimgt.webapp.publisher.APIPublisherStartupHandler; @@ -45,11 +45,7 @@ import org.wso2.carbon.user.core.service.RealmService; * policy="dynamic" * bind="setRegistryService" * unbind="unsetRegistryService" - * interface="org.wso2.carbon.apimgt.integration.client.service.IntegrationClientService" - * cardinality="1..1" - * policy="dynamic" - * bind="setIntegrationClientService" - * unbind="unsetIntegrationClientService" + */ public class APIPublisherServiceComponent { @@ -120,14 +116,14 @@ public class APIPublisherServiceComponent { APIPublisherDataHolder.getInstance().setRegistryService(null); } - protected void setIntegrationClientService(IntegrationClientService integrationClientService) { - if (integrationClientService != null && log.isDebugEnabled()) { - log.debug("integrationClientService initialized"); - } - APIPublisherDataHolder.getInstance().setIntegrationClientService(integrationClientService); - } - - protected void unsetIntegrationClientService(IntegrationClientService integrationClientService) { - APIPublisherDataHolder.getInstance().setIntegrationClientService(null); - } + // protected void setIntegrationClientService(IntegrationClientService integrationClientService) { + // if (integrationClientService != null && log.isDebugEnabled()) { + // log.debug("integrationClientService initialized"); + // } + // APIPublisherDataHolder.getInstance().setIntegrationClientService(integrationClientService); + // } + // + // protected void unsetIntegrationClientService(IntegrationClientService integrationClientService) { + // APIPublisherDataHolder.getInstance().setIntegrationClientService(null); + // } } diff --git a/components/apimgt-extensions/pom.xml b/components/apimgt-extensions/pom.xml index 41507f9fa9..fca4d2100a 100644 --- a/components/apimgt-extensions/pom.xml +++ b/components/apimgt-extensions/pom.xml @@ -34,13 +34,13 @@ http://wso2.org - org.wso2.carbon.apimgt.integration.generated.client - org.wso2.carbon.apimgt.integration.client + + org.wso2.carbon.apimgt.webapp.publisher org.wso2.carbon.apimgt.application.extension org.wso2.carbon.apimgt.application.extension.api org.wso2.carbon.apimgt.annotations - org.wso2.carbon.apimgt.handlers + diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.api/src/main/webapp/META-INF/webapp-classloading.xml b/components/application-mgt/org.wso2.carbon.device.application.mgt.api/src/main/webapp/META-INF/webapp-classloading.xml index e195e08097..9f50930c4f 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.api/src/main/webapp/META-INF/webapp-classloading.xml +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.api/src/main/webapp/META-INF/webapp-classloading.xml @@ -31,5 +31,5 @@ Tomcat environment is the default and every webapps gets it even if they didn't specify it. e.g. If a webapps requires CXF, they will get both Tomcat and CXF. --> - CXF,Carbon + CXF3,Carbon diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.common/pom.xml b/components/application-mgt/org.wso2.carbon.device.application.mgt.common/pom.xml index 876c0ab594..9ebaecc139 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.common/pom.xml +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.common/pom.xml @@ -56,7 +56,7 @@ io.swagger.annotations.*;resolution:=optional, com.fasterxml.jackson.annotation, javax.validation.constraints, - javax.xml.bind.annotation.*, + javax.xml.bind.annotation; version="${javax.xml.bind.imp.pkg.version}", org.wso2.carbon.device.application.mgt.common.* diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/pom.xml b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/pom.xml index 82d75d4687..f861513e29 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/pom.xml +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/pom.xml @@ -51,8 +51,66 @@ Application Management Core Bundle org.wso2.carbon.device.application.mgt.core.internal - org.osgi.framework, - org.osgi.service.component, + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + org.osgi.framework.*;version="${imp.package.version.osgi.framework}", + org.osgi.service.*;version="${imp.package.version.osgi.service}", org.apache.commons.logging, javax.xml.parsers;version="${javax.xml.parsers.import.pkg.version}";resolution:=optional, org.wso2.carbon.context.*, @@ -62,8 +120,8 @@ javax.sql, com.google.gson.*, javax.naming, - javax.xml.bind.annotation, - javax.xml.bind, + javax.xml.bind.annotation; version="${javax.xml.bind.imp.pkg.version}", + javax.xml.bind; version="${javax.xml.bind.imp.pkg.version}", org.wso2.carbon.device.application.mgt.common.*, org.wso2.carbon.device.mgt.core.*, org.wso2.carbon.device.mgt.common.*, @@ -348,6 +406,14 @@ + + org.wso2.carbon.devicemgt + org.wso2.carbon.identity.jwt.client.extension + + + + + diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/util/OAuthUtils.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/util/OAuthUtils.java index b57ffebeb7..33a9d0706f 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/util/OAuthUtils.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/util/OAuthUtils.java @@ -63,7 +63,7 @@ public class OAuthUtils { apiApplicationKeyInfo = apiManagementProviderService. generateAndRetrieveApplicationKeys(registrationProfile.getApplicationName(), registrationProfile.getTags(), Constants.ApplicationInstall.DEFAULT_TOKEN_TYPE, - registrationProfile.getApplicationName(), registrationProfile.isAllowedToAllDomains(), + null, registrationProfile.isAllowedToAllDomains(), Constants.ApplicationInstall.DEFAULT_VALIDITY_PERIOD); } finally { PrivilegedCarbonContext.endTenantFlow(); diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.api/src/main/webapp/META-INF/webapp-classloading.xml b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.api/src/main/webapp/META-INF/webapp-classloading.xml index da8baef61f..7a71395445 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.api/src/main/webapp/META-INF/webapp-classloading.xml +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.api/src/main/webapp/META-INF/webapp-classloading.xml @@ -31,5 +31,5 @@ Tomcat environment is the default and every webapps gets it even if they didn't specify it. e.g. If a webapps requires CXF, they will get both Tomcat and CXF. --> - CXF,Carbon + CXF3,Carbon diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.api/src/main/webapp/META-INF/webapp-classloading.xml b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.api/src/main/webapp/META-INF/webapp-classloading.xml index da8baef61f..7a71395445 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.api/src/main/webapp/META-INF/webapp-classloading.xml +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.api/src/main/webapp/META-INF/webapp-classloading.xml @@ -31,5 +31,5 @@ Tomcat environment is the default and every webapps gets it even if they didn't specify it. e.g. If a webapps requires CXF, they will get both Tomcat and CXF. --> - CXF,Carbon + CXF3,Carbon diff --git a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.api/pom.xml b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.api/pom.xml index fa191390be..888eda3b79 100644 --- a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.api/pom.xml +++ b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.api/pom.xml @@ -133,10 +133,22 @@ + + + + + + + org.springframework + spring-web + provided + org.apache.cxf - cxf-rt-frontend-jaxws + cxf-bundle-jaxrs + provided + commons-codec.wso2 commons-codec @@ -147,24 +159,26 @@ - - org.apache.cxf - cxf-rt-frontend-jaxrs - - - org.apache.cxf - cxf-rt-transports-http - + + + + + + + + + + junit junit test - - javax.ws.rs - jsr311-api - provided - + + + + + org.wso2.carbon org.wso2.carbon.logging @@ -207,11 +221,11 @@ - - javax.servlet - javax.servlet-api - provided - + + + + + org.wso2.carbon.devicemgt org.wso2.carbon.apimgt.annotations diff --git a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.api/src/main/webapp/META-INF/webapp-classloading.xml b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.api/src/main/webapp/META-INF/webapp-classloading.xml index ed2ed21624..60db8782e9 100644 --- a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.api/src/main/webapp/META-INF/webapp-classloading.xml +++ b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.api/src/main/webapp/META-INF/webapp-classloading.xml @@ -31,5 +31,5 @@ Tomcat environment is the default and every webapps gets it even if they didn't specify it. e.g. If a webapps requires CXF, they will get both Tomcat and CXF. --> - CXF,Carbon + CXF3,Carbon diff --git a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.api/pom.xml b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.api/pom.xml index cbe533dd6d..94d2a8fec1 100644 --- a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.api/pom.xml +++ b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.api/pom.xml @@ -133,10 +133,26 @@ + + + + + + org.springframework + spring-web + provided + org.apache.cxf - cxf-rt-frontend-jaxws + cxf-bundle-jaxrs + provided + + + + + + commons-codec.wso2 commons-codec @@ -147,14 +163,10 @@ - - org.apache.cxf - cxf-rt-frontend-jaxrs - - - org.apache.cxf - cxf-rt-transports-http - + + + + junit junit @@ -204,11 +216,11 @@ - - javax.servlet - javax.servlet-api - provided - + + + + + org.wso2.carbon.devicemgt org.wso2.carbon.apimgt.annotations diff --git a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.api/src/main/webapp/META-INF/webapp-classloading.xml b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.api/src/main/webapp/META-INF/webapp-classloading.xml index ed2ed21624..60db8782e9 100644 --- a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.api/src/main/webapp/META-INF/webapp-classloading.xml +++ b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.api/src/main/webapp/META-INF/webapp-classloading.xml @@ -31,5 +31,5 @@ Tomcat environment is the default and every webapps gets it even if they didn't specify it. e.g. If a webapps requires CXF, they will get both Tomcat and CXF. --> - CXF,Carbon + CXF3,Carbon diff --git a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.core/pom.xml b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.core/pom.xml index 6942c86d84..898f828dc5 100644 --- a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.core/pom.xml +++ b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.core/pom.xml @@ -72,8 +72,8 @@ org.wso2.carbon.certificate.mgt.core.util - org.osgi.framework, - org.osgi.service.component, + org.osgi.framework.*;version="${imp.package.version.osgi.framework}", + org.osgi.service.*;version="${imp.package.version.osgi.service}", org.apache.commons.logging, org.apache.commons.collections.map, javax.security.auth.x500, diff --git a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.device.type.deployer/pom.xml b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.device.type.deployer/pom.xml index 6c47262ab0..698bba5d44 100644 --- a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.device.type.deployer/pom.xml +++ b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.device.type.deployer/pom.xml @@ -140,8 +140,8 @@ org.apache.axis2.deployment.*, org.apache.commons.lang;version="${commons-lang.wso2.osgi.version.range}", org.apache.commons.logging, - org.osgi.framework, - org.osgi.service.component, + org.osgi.framework.*;version="${imp.package.version.osgi.framework}", + org.osgi.service.*;version="${imp.package.version.osgi.service}", org.w3c.dom, org.wso2.carbon.context, org.wso2.carbon.device.mgt.common.*, diff --git a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.pull.notification/pom.xml b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.pull.notification/pom.xml index 14a9d8c308..e8f93ec911 100644 --- a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.pull.notification/pom.xml +++ b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.pull.notification/pom.xml @@ -82,8 +82,8 @@ org.wso2.carbon.device.mgt.extensions.pull.notification.* - org.osgi.framework, - org.osgi.service.component, + org.osgi.framework.*;version="${imp.package.version.osgi.framework}", + org.osgi.service.*;version="${imp.package.version.osgi.service}", org.apache.commons.logging, org.wso2.carbon.device.mgt.common.*, org.wso2.carbon.device.mgt.core.service diff --git a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.fcm/pom.xml b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.fcm/pom.xml index b102c68e13..a40a895622 100644 --- a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.fcm/pom.xml +++ b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.fcm/pom.xml @@ -135,7 +135,8 @@ com.google.gson, - org.osgi.service.component, + org.osgi.framework.*;version="${imp.package.version.osgi.framework}", + org.osgi.service.*;version="${imp.package.version.osgi.service}", org.wso2.carbon.device.mgt.common.operation.mgt, org.wso2.carbon.device.mgt.common.push.notification, org.apache.commons.logging, diff --git a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.http/pom.xml b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.http/pom.xml index 447951938b..994f41bfe5 100644 --- a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.http/pom.xml +++ b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.http/pom.xml @@ -126,13 +126,13 @@ org.apache.commons.logging, - org.osgi.service.component, + org.osgi.framework.*;version="${imp.package.version.osgi.framework}", + org.osgi.service.*;version="${imp.package.version.osgi.service}", org.wso2.carbon.context, org.wso2.carbon.device.mgt.common.operation.mgt, org.wso2.carbon.device.mgt.common.push.notification, org.wso2.carbon.device.mgt.common, org.wso2.carbon.device.mgt.core.service, - org.osgi.framework, org.wso2.carbon.device.mgt.core.operation.mgt, org.wso2.carbon.core, com.google.gson, diff --git a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.mqtt/pom.xml b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.mqtt/pom.xml index a59a3728a5..5b6766bb66 100644 --- a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.mqtt/pom.xml +++ b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.mqtt/pom.xml @@ -148,7 +148,8 @@ org.apache.commons.logging, - org.osgi.service.component, + org.osgi.framework.*;version="${imp.package.version.osgi.framework}", + org.osgi.service.*;version="${imp.package.version.osgi.service}", org.wso2.carbon.context, org.wso2.carbon.device.mgt.common.operation.mgt, org.wso2.carbon.device.mgt.common.push.notification, @@ -157,7 +158,6 @@ org.wso2.carbon.device.mgt.core.service, org.wso2.carbon.event.output.adapter.core, org.wso2.carbon.event.output.adapter.core.exception, - org.osgi.framework, org.wso2.carbon.device.mgt.core.operation.mgt, org.wso2.carbon.core, org.wso2.carbon.device.application.mgt.common.*, diff --git a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.xmpp/pom.xml b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.xmpp/pom.xml index 1a6e1a58ab..81ac96adc5 100644 --- a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.xmpp/pom.xml +++ b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.xmpp/pom.xml @@ -135,14 +135,14 @@ org.apache.commons.logging, - org.osgi.service.component, + org.osgi.framework.*;version="${imp.package.version.osgi.framework}", + org.osgi.service.*;version="${imp.package.version.osgi.service}", org.wso2.carbon.context, org.wso2.carbon.device.mgt.common.operation.mgt, org.wso2.carbon.device.mgt.common.push.notification, org.wso2.carbon.device.mgt.core.service, org.wso2.carbon.event.output.adapter.core, org.wso2.carbon.event.output.adapter.core.exception, - org.osgi.framework, org.wso2.carbon.core, org.wso2.carbon.device.mgt.common.* diff --git a/components/device-mgt/io.entgra.carbon.device.mgt.config.api/pom.xml b/components/device-mgt/io.entgra.carbon.device.mgt.config.api/pom.xml index bd43c8b626..4eada72d20 100644 --- a/components/device-mgt/io.entgra.carbon.device.mgt.config.api/pom.xml +++ b/components/device-mgt/io.entgra.carbon.device.mgt.config.api/pom.xml @@ -146,15 +146,26 @@ - org.apache.cxf - cxf-rt-frontend-jaxrs + org.springframework + spring-web provided org.apache.cxf - cxf-rt-transports-http + cxf-bundle-jaxrs provided + + + + + + + + + + + javax.ws.rs jsr311-api diff --git a/components/device-mgt/io.entgra.carbon.device.mgt.config.api/src/main/java/io/entgra/carbon/device/mgt/config/jaxrs/service/impl/DeviceManagementConfigServiceImpl.java b/components/device-mgt/io.entgra.carbon.device.mgt.config.api/src/main/java/io/entgra/carbon/device/mgt/config/jaxrs/service/impl/DeviceManagementConfigServiceImpl.java index 9ccbecda3d..f9ee5e913d 100644 --- a/components/device-mgt/io.entgra.carbon.device.mgt.config.api/src/main/java/io/entgra/carbon/device/mgt/config/jaxrs/service/impl/DeviceManagementConfigServiceImpl.java +++ b/components/device-mgt/io.entgra.carbon.device.mgt.config.api/src/main/java/io/entgra/carbon/device/mgt/config/jaxrs/service/impl/DeviceManagementConfigServiceImpl.java @@ -200,8 +200,8 @@ public class DeviceManagementConfigServiceImpl implements DeviceManagementConfig DeviceManagementConfig deviceManagementConfig = DeviceConfigurationManager.getInstance().getDeviceManagementConfig(); KeyManagerConfigurations kmConfig = deviceManagementConfig.getKeyManagerConfigurations(); AppRegistrationCredentials credentials = DeviceManagerUtil.getApplicationRegistrationCredentials( - System.getProperty(DeviceManagementConstants.ConfigurationManagement.IOT_GATEWAY_HOST), - System.getProperty(DeviceManagementConstants.ConfigurationManagement.IOT_GATEWAY_HTTPS_PORT), + System.getProperty(DeviceManagementConstants.ConfigurationManagement.IOT_CORE_HOST), + System.getProperty(DeviceManagementConstants.ConfigurationManagement.IOT_CORE_HTTPS_PORT), kmConfig.getAdminUsername(), kmConfig.getAdminPassword()); AccessTokenInfo accessTokenForAdmin = DeviceManagerUtil.getAccessTokenForDeviceOwner( diff --git a/components/device-mgt/io.entgra.carbon.device.mgt.config.api/src/main/webapp/META-INF/webapp-classloading.xml b/components/device-mgt/io.entgra.carbon.device.mgt.config.api/src/main/webapp/META-INF/webapp-classloading.xml index 01aceabde5..a16c0a9cbf 100644 --- a/components/device-mgt/io.entgra.carbon.device.mgt.config.api/src/main/webapp/META-INF/webapp-classloading.xml +++ b/components/device-mgt/io.entgra.carbon.device.mgt.config.api/src/main/webapp/META-INF/webapp-classloading.xml @@ -31,5 +31,5 @@ Tomcat environment is the default and every webapps gets it even if they didn't specify it. e.g. If a webapps requires CXF, they will get both Tomcat and CXF. --> - CXF,Carbon + CXF3,Carbon diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.analytics.data.publisher/pom.xml b/components/device-mgt/org.wso2.carbon.device.mgt.analytics.data.publisher/pom.xml index 7e7060e5b2..d4849aceef 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.analytics.data.publisher/pom.xml +++ b/components/device-mgt/org.wso2.carbon.device.mgt.analytics.data.publisher/pom.xml @@ -107,8 +107,8 @@ org.wso2.carbon.device.mgt.analytics.data.publisher.*;version="${carbon.device.mgt.version}" - org.osgi.framework, - org.osgi.service.component, + org.osgi.framework.*;version="${imp.package.version.osgi.framework}", + org.osgi.service.*;version="${imp.package.version.osgi.service}", org.apache.commons.logging.*, org.wso2.carbon.utils.multitenancy, org.wso2.carbon.context;version="${carbon.kernel.version.range}", diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/pom.xml b/components/device-mgt/org.wso2.carbon.device.mgt.api/pom.xml index d2992949d2..86b7e6e035 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/pom.xml +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/pom.xml @@ -146,30 +146,41 @@ - org.apache.cxf - cxf-rt-frontend-jaxws - provided - - - org.apache.cxf - cxf-rt-frontend-jaxrs + org.springframework + spring-web provided org.apache.cxf - cxf-rt-transports-http + cxf-bundle-jaxrs provided + + + + + + + + + + + + + + + + commons-httpclient.wso2 commons-httpclient provided - - javax.ws.rs - jsr311-api - provided - + + + + + org.wso2.carbon org.wso2.carbon.utils @@ -200,11 +211,11 @@ org.wso2.carbon.device.mgt.common provided - - org.wso2.carbon.devicemgt - org.wso2.carbon.device.mgt.analytics.data.publisher - provided - + + + + + org.wso2.carbon.devicemgt org.wso2.carbon.device.mgt.extensions @@ -351,11 +362,11 @@ org.wso2.carbon.analytics.api provided - - org.wso2.carbon.analytics - org.wso2.carbon.analytics.datasource.commons - provided - + + + + + org.wso2.carbon.devicemgt org.wso2.carbon.identity.jwt.client.extension @@ -402,11 +413,11 @@ org.wso2.carbon.event.stream.persistence.stub provided - - org.wso2.carbon.devicemgt - org.wso2.carbon.apimgt.integration.client - provided - + + + + + org.powermock powermock-module-testng diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/DeviceEventManagementService.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/DeviceEventManagementService.java index 9eddd91aeb..fc0ce9c794 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/DeviceEventManagementService.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/DeviceEventManagementService.java @@ -67,64 +67,64 @@ import javax.ws.rs.core.Response; @Consumes(MediaType.APPLICATION_JSON) public interface DeviceEventManagementService { - @POST - @Path("/{type}") - @ApiOperation( - produces = MediaType.APPLICATION_JSON, - httpMethod = "POST", - value = "Adding the Event Type Definition", - notes = "Add the event definition for a device.", - tags = "Device Event Management", - extensions = { - @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:device-types:events") - }) - } - ) - @ApiResponses( - value = { - @ApiResponse( - code = 200, - message = "OK. \n Successfully added the event defintion.", - responseHeaders = { - @ResponseHeader( - name = "Content-Type", - description = "The content type of the body"), - @ResponseHeader( - name = "ETag", - description = "Entity Tag of the response resource.\n" + - "Used by caches, or in conditional requests."), - @ResponseHeader( - name = "Last-Modified", - description = - "Date and time the resource was last modified.\n" + - "Used by caches, or in conditional requests."), - } - ), - @ApiResponse( - code = 400, - message = - "Bad Request. \n"), - @ApiResponse( - code = 406, - message = "Not Acceptable.\n The requested media type is not supported"), - @ApiResponse( - code = 500, - message = "Internal Server Error. \n Server error occurred while fetching the " + - "list of supported device types.", - response = ErrorResponse.class) - } - ) - Response deployDeviceTypeEventDefinition( - @ApiParam(name = "type", value = "The device type, such as android, ios, and windows.") - @PathParam("type")String deviceType, - @ApiParam(name = "skipPersist", value = "Is it required to persist the data or not") - @QueryParam("skipPersist") boolean skipPersist, - @ApiParam(name = "isSharedWithAllTenants", value = "Should artifacts be available to all tenants") - @QueryParam("isSharedWithAllTenants") boolean isSharedWithAllTenants, - @ApiParam(name = "deviceTypeEvent", value = "Add the data to complete the DeviceTypeEvent object.", - required = true) - @Valid DeviceTypeEvent deviceTypeEvent); +// @POST +// @Path("/{type}") +// @ApiOperation( +// produces = MediaType.APPLICATION_JSON, +// httpMethod = "POST", +// value = "Adding the Event Type Definition", +// notes = "Add the event definition for a device.", +// tags = "Device Event Management", +// extensions = { +// @Extension(properties = { +// @ExtensionProperty(name = Constants.SCOPE, value = "perm:device-types:events") +// }) +// } +// ) +// @ApiResponses( +// value = { +// @ApiResponse( +// code = 200, +// message = "OK. \n Successfully added the event defintion.", +// responseHeaders = { +// @ResponseHeader( +// name = "Content-Type", +// description = "The content type of the body"), +// @ResponseHeader( +// name = "ETag", +// description = "Entity Tag of the response resource.\n" + +// "Used by caches, or in conditional requests."), +// @ResponseHeader( +// name = "Last-Modified", +// description = +// "Date and time the resource was last modified.\n" + +// "Used by caches, or in conditional requests."), +// } +// ), +// @ApiResponse( +// code = 400, +// message = +// "Bad Request. \n"), +// @ApiResponse( +// code = 406, +// message = "Not Acceptable.\n The requested media type is not supported"), +// @ApiResponse( +// code = 500, +// message = "Internal Server Error. \n Server error occurred while fetching the " + +// "list of supported device types.", +// response = ErrorResponse.class) +// } +// ) +// Response deployDeviceTypeEventDefinition( +// @ApiParam(name = "type", value = "The device type, such as android, ios, and windows.") +// @PathParam("type")String deviceType, +// @ApiParam(name = "skipPersist", value = "Is it required to persist the data or not") +// @QueryParam("skipPersist") boolean skipPersist, +// @ApiParam(name = "isSharedWithAllTenants", value = "Should artifacts be available to all tenants") +// @QueryParam("isSharedWithAllTenants") boolean isSharedWithAllTenants, +// @ApiParam(name = "deviceTypeEvent", value = "Add the data to complete the DeviceTypeEvent object.", +// required = true) +// @Valid DeviceTypeEvent deviceTypeEvent); @DELETE @Path("/{type}") @@ -178,183 +178,183 @@ public interface DeviceEventManagementService { "ios, and windows.", required = false) @PathParam("type")String deviceType); - @GET - @Path("/{type}/{deviceId}") - @ApiOperation( - produces = MediaType.APPLICATION_JSON, - httpMethod = "GET", - value = "Getting Device Events", - notes = "Get the events for the device.", - tags = "Device Event Management", - extensions = { - @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:device-types:events:view") - }) - } - ) - @ApiResponses( - value = { - @ApiResponse( - code = 200, - message = "OK. \n Successfully fetched the event definition.", - response = EventRecords.class, - responseHeaders = { - @ResponseHeader( - name = "Content-Type", - description = "The content type of the body"), - @ResponseHeader( - name = "ETag", - description = "Entity Tag of the response resource.\n" + - "Used by caches, or in conditional requests."), - @ResponseHeader( - name = "Last-Modified", - description = - "Date and time the resource was last modified.\n" + - "Used by caches, or in conditional requests."), - } - ), - @ApiResponse( - code = 400, - message = - "Bad Request. \n"), - @ApiResponse( - code = 406, - message = "Not Acceptable.\n The requested media type is not supported"), - @ApiResponse( - code = 500, - message = "Internal Server Error. \n Server error occurred while fetching the " + - "list of supported device types.", - response = ErrorResponse.class) - } - ) - Response getData(@ApiParam(name = "deviceId", value = "id of the device ", required = false) - @PathParam("deviceId") String deviceId, - @ApiParam(name = "from", value = "unix timestamp to retrieve", required = false) - @QueryParam("from") long from, - @ApiParam(name = "to", value = "unix time to retrieve", required = false) - @QueryParam("to") long to, - @ApiParam(name = "type", value = "name of the device type", required = false) - @PathParam("type") String deviceType, - @ApiParam(name = "offset", value = "offset of the records that needs to be picked up", required = false) - @QueryParam("offset") int offset, - @ApiParam(name = "limit", value = "limit of the records that needs to be picked up", required = false) - @QueryParam("limit") int limit); +// @GET +// @Path("/{type}/{deviceId}") +// @ApiOperation( +// produces = MediaType.APPLICATION_JSON, +// httpMethod = "GET", +// value = "Getting Device Events", +// notes = "Get the events for the device.", +// tags = "Device Event Management", +// extensions = { +// @Extension(properties = { +// @ExtensionProperty(name = Constants.SCOPE, value = "perm:device-types:events:view") +// }) +// } +// ) +// @ApiResponses( +// value = { +// @ApiResponse( +// code = 200, +// message = "OK. \n Successfully fetched the event definition.", +// response = EventRecords.class, +// responseHeaders = { +// @ResponseHeader( +// name = "Content-Type", +// description = "The content type of the body"), +// @ResponseHeader( +// name = "ETag", +// description = "Entity Tag of the response resource.\n" + +// "Used by caches, or in conditional requests."), +// @ResponseHeader( +// name = "Last-Modified", +// description = +// "Date and time the resource was last modified.\n" + +// "Used by caches, or in conditional requests."), +// } +// ), +// @ApiResponse( +// code = 400, +// message = +// "Bad Request. \n"), +// @ApiResponse( +// code = 406, +// message = "Not Acceptable.\n The requested media type is not supported"), +// @ApiResponse( +// code = 500, +// message = "Internal Server Error. \n Server error occurred while fetching the " + +// "list of supported device types.", +// response = ErrorResponse.class) +// } +// ) +// Response getData(@ApiParam(name = "deviceId", value = "id of the device ", required = false) +// @PathParam("deviceId") String deviceId, +// @ApiParam(name = "from", value = "unix timestamp to retrieve", required = false) +// @QueryParam("from") long from, +// @ApiParam(name = "to", value = "unix time to retrieve", required = false) +// @QueryParam("to") long to, +// @ApiParam(name = "type", value = "name of the device type", required = false) +// @PathParam("type") String deviceType, +// @ApiParam(name = "offset", value = "offset of the records that needs to be picked up", required = false) +// @QueryParam("offset") int offset, +// @ApiParam(name = "limit", value = "limit of the records that needs to be picked up", required = false) +// @QueryParam("limit") int limit); - @GET - @Path("last-known/{type}/{deviceId}") - @ApiOperation( - produces = MediaType.APPLICATION_JSON, - httpMethod = "GET", - value = "Getting Last Known Device Events", - notes = "Get the last known events for the device.", - tags = "Device Event Management", - extensions = { - @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:device-types:events:view") - }) - } - ) - @ApiResponses( - value = { - @ApiResponse( - code = 200, - message = "OK. \n Successfully fetched the event.", - response = EventRecords.class, - responseHeaders = { - @ResponseHeader( - name = "Content-Type", - description = "The content type of the body"), - @ResponseHeader( - name = "ETag", - description = "Entity Tag of the response resource.\n" + - "Used by caches, or in conditional requests."), - @ResponseHeader( - name = "Last-Modified", - description = - "Date and time the resource was last modified.\n" + - "Used by caches, or in conditional requests."), - } - ), - @ApiResponse( - code = 400, - message = - "Bad Request. \n"), - @ApiResponse( - code = 406, - message = "Not Acceptable.\n The requested media type is not supported"), - @ApiResponse( - code = 500, - message = "Internal Server Error. \n Server error occurred while fetching the " + - "list of supported device types.", - response = ErrorResponse.class) - } - ) - Response getLastKnownData(@ApiParam(name = "deviceId", value = "id of the device ", required = true) - @PathParam("deviceId") String deviceId, - @ApiParam(name = "type", value = "name of the device type", required = true) - @PathParam("type") String deviceType, - @ApiParam(name = "limit", value = "limit of the records that needs to be picked up", required = false) - @QueryParam("limit") int limit); +// @GET +// @Path("last-known/{type}/{deviceId}") +// @ApiOperation( +// produces = MediaType.APPLICATION_JSON, +// httpMethod = "GET", +// value = "Getting Last Known Device Events", +// notes = "Get the last known events for the device.", +// tags = "Device Event Management", +// extensions = { +// @Extension(properties = { +// @ExtensionProperty(name = Constants.SCOPE, value = "perm:device-types:events:view") +// }) +// } +// ) +// @ApiResponses( +// value = { +// @ApiResponse( +// code = 200, +// message = "OK. \n Successfully fetched the event.", +// response = EventRecords.class, +// responseHeaders = { +// @ResponseHeader( +// name = "Content-Type", +// description = "The content type of the body"), +// @ResponseHeader( +// name = "ETag", +// description = "Entity Tag of the response resource.\n" + +// "Used by caches, or in conditional requests."), +// @ResponseHeader( +// name = "Last-Modified", +// description = +// "Date and time the resource was last modified.\n" + +// "Used by caches, or in conditional requests."), +// } +// ), +// @ApiResponse( +// code = 400, +// message = +// "Bad Request. \n"), +// @ApiResponse( +// code = 406, +// message = "Not Acceptable.\n The requested media type is not supported"), +// @ApiResponse( +// code = 500, +// message = "Internal Server Error. \n Server error occurred while fetching the " + +// "list of supported device types.", +// response = ErrorResponse.class) +// } +// ) +// Response getLastKnownData(@ApiParam(name = "deviceId", value = "id of the device ", required = true) +// @PathParam("deviceId") String deviceId, +// @ApiParam(name = "type", value = "name of the device type", required = true) +// @PathParam("type") String deviceType, +// @ApiParam(name = "limit", value = "limit of the records that needs to be picked up", required = false) +// @QueryParam("limit") int limit); - @GET - @Path("filter/{type}/{parameter}") - @ApiOperation( - produces = MediaType.APPLICATION_JSON, - httpMethod = "GET", - value = "Getting the filtered devices", - notes = "Get the list of devices based on the filter parameter", - tags = "Device Event Management", - extensions = { - @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:device-types:events:view") - }) - } - ) - @ApiResponses( - value = { - @ApiResponse( - code = 200, - message = "OK. \n Successfully fetched the event.", - response = EventRecords.class, - responseHeaders = { - @ResponseHeader( - name = "Content-Type", - description = "The content type of the body"), - @ResponseHeader( - name = "ETag", - description = "Entity Tag of the response resource.\n" + - "Used by caches, or in conditional requests."), - @ResponseHeader( - name = "Last-Modified", - description = - "Date and time the resource was last modified.\n" + - "Used by caches, or in conditional requests."), - } - ), - @ApiResponse( - code = 400, - message = - "Bad Request. \n"), - @ApiResponse( - code = 406, - message = "Not Acceptable.\n The requested media type is not supported"), - @ApiResponse( - code = 500, - message = "Internal Server Error. \n Server error occurred while fetching the " + - "list of supported device types.", - response = ErrorResponse.class) - } - ) - Response getFilteredDevices( - @ApiParam(name = "type", value = "name of the device type", required = true) - @PathParam("type") String deviceType, - @ApiParam(name = "type", value = "name of the parameter", required = true) - @PathParam("type") String parameter, - @ApiParam(name = "limit", value = "minimum value the parameter can have", required = false) - @QueryParam("min") double min, - @ApiParam(name = "max", value = "max value the parameter can have", required = false) - @QueryParam("max") double max - ); +// @GET +// @Path("filter/{type}/{parameter}") +// @ApiOperation( +// produces = MediaType.APPLICATION_JSON, +// httpMethod = "GET", +// value = "Getting the filtered devices", +// notes = "Get the list of devices based on the filter parameter", +// tags = "Device Event Management", +// extensions = { +// @Extension(properties = { +// @ExtensionProperty(name = Constants.SCOPE, value = "perm:device-types:events:view") +// }) +// } +// ) +// @ApiResponses( +// value = { +// @ApiResponse( +// code = 200, +// message = "OK. \n Successfully fetched the event.", +// response = EventRecords.class, +// responseHeaders = { +// @ResponseHeader( +// name = "Content-Type", +// description = "The content type of the body"), +// @ResponseHeader( +// name = "ETag", +// description = "Entity Tag of the response resource.\n" + +// "Used by caches, or in conditional requests."), +// @ResponseHeader( +// name = "Last-Modified", +// description = +// "Date and time the resource was last modified.\n" + +// "Used by caches, or in conditional requests."), +// } +// ), +// @ApiResponse( +// code = 400, +// message = +// "Bad Request. \n"), +// @ApiResponse( +// code = 406, +// message = "Not Acceptable.\n The requested media type is not supported"), +// @ApiResponse( +// code = 500, +// message = "Internal Server Error. \n Server error occurred while fetching the " + +// "list of supported device types.", +// response = ErrorResponse.class) +// } +// ) +// Response getFilteredDevices( +// @ApiParam(name = "type", value = "name of the device type", required = true) +// @PathParam("type") String deviceType, +// @ApiParam(name = "type", value = "name of the parameter", required = true) +// @PathParam("type") String parameter, +// @ApiParam(name = "limit", value = "minimum value the parameter can have", required = false) +// @QueryParam("min") double min, +// @ApiParam(name = "max", value = "max value the parameter can have", required = false) +// @QueryParam("max") double max +// ); @GET @Path("/{type}") diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/GeoLocationBasedService.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/GeoLocationBasedService.java index 5e55acdc77..8b3071f1ef 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/GeoLocationBasedService.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/GeoLocationBasedService.java @@ -97,71 +97,71 @@ public interface GeoLocationBasedService { /** * Retrieve Analytics for the device type */ - @GET - @Path("stats/{deviceType}/{deviceId}") - @ApiOperation( - consumes = "application/json", - produces = "application/json", - httpMethod = "GET", - value = "Getting the Location Details of a Device", - notes = "Get the location details of a device during a define time period.", - response = Response.class, - tags = "Geo Service Management", - extensions = { - @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:geo-service:analytics-view") - }) - } - ) - @ApiResponses(value = { - @ApiResponse( - code = 200, - message = "OK.", - response = Response.class, - responseHeaders = { - @ResponseHeader( - name = "Content-Type", - description = "The content type of the body"), - @ResponseHeader( - name = "Last-Modified", - description = "Date and time the resource was last modified.\n" + - "Used by caches, or in conditional requests."), - }), - @ApiResponse( - code = 400, - message = "Bad Request. \n Invalid Device Identifiers found.", - response = Response.class), - @ApiResponse( - code = 401, - message = "Unauthorized. \n Unauthorized request."), - @ApiResponse( - code = 500, - message = "Internal Server Error. \n Error on retrieving stats", - response = Response.class) - }) - Response getGeoDeviceStats( - @ApiParam( - name = "deviceId", - value = "The device ID.", - required = true) - @PathParam("deviceId") String deviceId, - @ApiParam( - name = "device-type", - value = "The device type, such as ios, android, or windows.", - required = true) - @PathParam("deviceType") - @Size(max = 45) - String deviceType, - @ApiParam( - name = "from", - value = "Define the time to start getting the geo location history of the device in the Epoch or UNIX format.", - required = true) - @QueryParam("from") long from, - @ApiParam( - name = "to", - value = "Define the time to finish getting the geo location history of the device in the Epoch or UNIX format.", - required = true) - @QueryParam("to") long to); +// @GET +// @Path("stats/{deviceType}/{deviceId}") +// @ApiOperation( +// consumes = "application/json", +// produces = "application/json", +// httpMethod = "GET", +// value = "Getting the Location Details of a Device", +// notes = "Get the location details of a device during a define time period.", +// response = Response.class, +// tags = "Geo Service Management", +// extensions = { +// @Extension(properties = { +// @ExtensionProperty(name = Constants.SCOPE, value = "perm:geo-service:analytics-view") +// }) +// } +// ) +// @ApiResponses(value = { +// @ApiResponse( +// code = 200, +// message = "OK.", +// response = Response.class, +// responseHeaders = { +// @ResponseHeader( +// name = "Content-Type", +// description = "The content type of the body"), +// @ResponseHeader( +// name = "Last-Modified", +// description = "Date and time the resource was last modified.\n" + +// "Used by caches, or in conditional requests."), +// }), +// @ApiResponse( +// code = 400, +// message = "Bad Request. \n Invalid Device Identifiers found.", +// response = Response.class), +// @ApiResponse( +// code = 401, +// message = "Unauthorized. \n Unauthorized request."), +// @ApiResponse( +// code = 500, +// message = "Internal Server Error. \n Error on retrieving stats", +// response = Response.class) +// }) +// Response getGeoDeviceStats( +// @ApiParam( +// name = "deviceId", +// value = "The device ID.", +// required = true) +// @PathParam("deviceId") String deviceId, +// @ApiParam( +// name = "device-type", +// value = "The device type, such as ios, android, or windows.", +// required = true) +// @PathParam("deviceType") +// @Size(max = 45) +// String deviceType, +// @ApiParam( +// name = "from", +// value = "Define the time to start getting the geo location history of the device in the Epoch or UNIX format.", +// required = true) +// @QueryParam("from") long from, +// @ApiParam( +// name = "to", +// value = "Define the time to finish getting the geo location history of the device in the Epoch or UNIX format.", +// required = true) +// @QueryParam("to") long to); /** * Get data to show device locations in a map @@ -602,128 +602,128 @@ public interface GeoLocationBasedService { /** * Retrieve Geo alerts history */ - @GET - @Path("alerts/history/{deviceType}/{deviceId}") - @ApiOperation( - consumes = "application/json", - produces = "application/json", - httpMethod = "GET", - value = "Getting the Geo Service Alert History of a Device", - notes = "Get the geo alert history of a device during the defined time period.", - response = Response.class, - tags = "Geo Service Management", - extensions = { - @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:geo-service:alerts-manage") - }) - } - ) - @ApiResponses(value = { - @ApiResponse( - code = 200, - message = "OK.", - response = Response.class, - responseHeaders = { - @ResponseHeader( - name = "Content-Type", - description = "The content type of the body"), - @ResponseHeader( - name = "Last-Modified", - description = "Date and time the resource was last modified.\n" + - "Used by caches, or in conditional requests.") - }), - @ApiResponse( - code = 400, - message = "Bad Request. \n Invalid Device Identifiers found.", - response = Response.class), - @ApiResponse( - code = 401, - message = "Unauthorized. \n Unauthorized request."), - @ApiResponse( - code = 500, - message = "Internal Server Error. \n Error on retrieving stats", - response = Response.class) - }) - Response getGeoAlertsHistory( - @ApiParam( - name = "deviceId", - value = "The device ID.", - required = true) - @PathParam("deviceId") String deviceId, - @ApiParam( - name = "device-type", - value = "The device type, such as ios, android, or windows.", - required = true) - @PathParam("deviceType") - @Size(max = 45) - String deviceType, - @ApiParam( - name = "from", - value = "Define the time to start getting the geo location history of the device in the Epoch or UNIX format.", - required = true) - @QueryParam("from") long from, - @ApiParam( - name = "to", - value = "Define the time to finish getting the geo location history of the device in the Epoch or UNIX format.", - required = true) - @QueryParam("to") long to); +// @GET +// @Path("alerts/history/{deviceType}/{deviceId}") +// @ApiOperation( +// consumes = "application/json", +// produces = "application/json", +// httpMethod = "GET", +// value = "Getting the Geo Service Alert History of a Device", +// notes = "Get the geo alert history of a device during the defined time period.", +// response = Response.class, +// tags = "Geo Service Management", +// extensions = { +// @Extension(properties = { +// @ExtensionProperty(name = Constants.SCOPE, value = "perm:geo-service:alerts-manage") +// }) +// } +// ) +// @ApiResponses(value = { +// @ApiResponse( +// code = 200, +// message = "OK.", +// response = Response.class, +// responseHeaders = { +// @ResponseHeader( +// name = "Content-Type", +// description = "The content type of the body"), +// @ResponseHeader( +// name = "Last-Modified", +// description = "Date and time the resource was last modified.\n" + +// "Used by caches, or in conditional requests.") +// }), +// @ApiResponse( +// code = 400, +// message = "Bad Request. \n Invalid Device Identifiers found.", +// response = Response.class), +// @ApiResponse( +// code = 401, +// message = "Unauthorized. \n Unauthorized request."), +// @ApiResponse( +// code = 500, +// message = "Internal Server Error. \n Error on retrieving stats", +// response = Response.class) +// }) +// Response getGeoAlertsHistory( +// @ApiParam( +// name = "deviceId", +// value = "The device ID.", +// required = true) +// @PathParam("deviceId") String deviceId, +// @ApiParam( +// name = "device-type", +// value = "The device type, such as ios, android, or windows.", +// required = true) +// @PathParam("deviceType") +// @Size(max = 45) +// String deviceType, +// @ApiParam( +// name = "from", +// value = "Define the time to start getting the geo location history of the device in the Epoch or UNIX format.", +// required = true) +// @QueryParam("from") long from, +// @ApiParam( +// name = "to", +// value = "Define the time to finish getting the geo location history of the device in the Epoch or UNIX format.", +// required = true) +// @QueryParam("to") long to); /** * Retrieve Geo alerts history for geo clusters */ - @GET - @Path("alerts/history") - @ApiOperation( - consumes = "application/json", - produces = "application/json", - httpMethod = "GET", - value = "Retrieve Geo alerts history for geo clusters", - notes = "Retrieving geo alert history of all defined alerts for geo clusters", - response = Response.class, - tags = "Geo Service Management", - extensions = { - @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:geo-service:alerts-manage") - }) - } - ) - @ApiResponses(value = { - @ApiResponse( - code = 200, - message = "OK.", - response = Response.class, - responseHeaders = { - @ResponseHeader( - name = "Content-Type", - description = "The content type of the body"), - @ResponseHeader( - name = "Last-Modified", - description = "Date and time the resource was last modified.\n" + - "Used by caches, or in conditional requests.") - }), - @ApiResponse( - code = 400, - message = "Bad Request. \n Invalid Device Identifiers found.", - response = Response.class), - @ApiResponse( - code = 401, - message = "Unauthorized. \n Unauthorized request."), - @ApiResponse( - code = 500, - message = "Internal Server Error. \n Error on retrieving stats", - response = Response.class) - }) - Response getGeoAlertsHistoryForGeoClusters( - @ApiParam( - name = "from", - value = "Get stats from what time", - required = true) - @QueryParam("from") long from, - @ApiParam( - name = "to", - value = "Get stats up to what time", - required = true) - @QueryParam("to") long to); +// @GET +// @Path("alerts/history") +// @ApiOperation( +// consumes = "application/json", +// produces = "application/json", +// httpMethod = "GET", +// value = "Retrieve Geo alerts history for geo clusters", +// notes = "Retrieving geo alert history of all defined alerts for geo clusters", +// response = Response.class, +// tags = "Geo Service Management", +// extensions = { +// @Extension(properties = { +// @ExtensionProperty(name = Constants.SCOPE, value = "perm:geo-service:alerts-manage") +// }) +// } +// ) +// @ApiResponses(value = { +// @ApiResponse( +// code = 200, +// message = "OK.", +// response = Response.class, +// responseHeaders = { +// @ResponseHeader( +// name = "Content-Type", +// description = "The content type of the body"), +// @ResponseHeader( +// name = "Last-Modified", +// description = "Date and time the resource was last modified.\n" + +// "Used by caches, or in conditional requests.") +// }), +// @ApiResponse( +// code = 400, +// message = "Bad Request. \n Invalid Device Identifiers found.", +// response = Response.class), +// @ApiResponse( +// code = 401, +// message = "Unauthorized. \n Unauthorized request."), +// @ApiResponse( +// code = 500, +// message = "Internal Server Error. \n Error on retrieving stats", +// response = Response.class) +// }) +// Response getGeoAlertsHistoryForGeoClusters( +// @ApiParam( +// name = "from", +// value = "Get stats from what time", +// required = true) +// @QueryParam("from") long from, +// @ApiParam( +// name = "to", +// value = "Get stats up to what time", +// required = true) +// @QueryParam("to") long to); /** diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/DeviceAgentServiceImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/DeviceAgentServiceImpl.java index f759ed13a9..52702536d1 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/DeviceAgentServiceImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/DeviceAgentServiceImpl.java @@ -26,7 +26,7 @@ import org.apache.axis2.AxisFault; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.wso2.carbon.context.PrivilegedCarbonContext; -import org.wso2.carbon.device.mgt.analytics.data.publisher.exception.DataPublisherConfigurationException; +//import org.wso2.carbon.device.mgt.analytics.data.publisher.exception.DataPublisherConfigurationException; import org.wso2.carbon.device.mgt.common.Device; import org.wso2.carbon.device.mgt.common.DeviceIdentifier; import org.wso2.carbon.device.mgt.common.EnrolmentInfo; @@ -280,19 +280,20 @@ public class DeviceAgentServiceImpl implements DeviceAgentService { i++; } - if (DeviceMgtAPIUtils.getEventPublisherService().publishEvent(DeviceMgtAPIUtils.getStreamDefinition(type - , PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantDomain()) - , Constants.DEFAULT_STREAM_VERSION, metaData - , null, payloadData)) { + // todo: amalka: commented data publishing +// if (DeviceMgtAPIUtils.getEventPublisherService().publishEvent(DeviceMgtAPIUtils.getStreamDefinition(type +// , PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantDomain()) +// , Constants.DEFAULT_STREAM_VERSION, metaData +// , null, payloadData)) { return Response.status(Response.Status.OK).build(); - } else { - String msg = "Error occurred while publishing the event."; - return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build(); - } - } catch (DataPublisherConfigurationException e) { - String msg = "Error occurred while publishing the event."; - log.error(msg, e); - return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build(); +// } else { +// String msg = "Error occurred while publishing the event."; +// return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build(); +// } +// } catch (DataPublisherConfigurationException e) { +// String msg = "Error occurred while publishing the event."; +// log.error(msg, e); +// return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build(); } catch (DeviceAccessAuthorizationException e) { String msg = "Error occurred when checking for authorization"; log.error(msg, e); @@ -380,19 +381,20 @@ public class DeviceAgentServiceImpl implements DeviceAgentService { i++; } - if (DeviceMgtAPIUtils.getEventPublisherService().publishEvent(DeviceMgtAPIUtils.getStreamDefinition(type - , PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantDomain()) - , Constants.DEFAULT_STREAM_VERSION, metaData - , null, payloadData)) { + // todo: amalka: commented data publishing +// if (DeviceMgtAPIUtils.getEventPublisherService().publishEvent(DeviceMgtAPIUtils.getStreamDefinition(type +// , PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantDomain()) +// , Constants.DEFAULT_STREAM_VERSION, metaData +// , null, payloadData)) { return Response.status(Response.Status.OK).build(); - } else { - String msg = "Error occurred while publishing the event."; - return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build(); - } - } catch (DataPublisherConfigurationException e) { - String msg = "Error occurred while publishing the event."; - log.error(msg, e); - return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build(); +// } else { +// String msg = "Error occurred while publishing the event."; +// return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build(); +// } +// } catch (DataPublisherConfigurationException e) { +// String msg = "Error occurred while publishing the event."; +// log.error(msg, e); +// return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build(); } catch (DeviceAccessAuthorizationException e) { String msg = "Error occurred when checking for authorization"; log.error(msg, e); diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/DeviceEventManagementServiceImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/DeviceEventManagementServiceImpl.java index 6c04581110..f5a7dacfd1 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/DeviceEventManagementServiceImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/DeviceEventManagementServiceImpl.java @@ -4,18 +4,18 @@ import org.apache.axis2.AxisFault; import org.apache.axis2.client.Stub; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.wso2.carbon.analytics.api.AnalyticsDataAPI; -import org.wso2.carbon.analytics.api.AnalyticsDataAPIUtil; -import org.wso2.carbon.analytics.dataservice.commons.AnalyticsDataResponse; -import org.wso2.carbon.analytics.dataservice.commons.SearchResultEntry; -import org.wso2.carbon.analytics.dataservice.commons.SortByField; -import org.wso2.carbon.analytics.dataservice.commons.SortType; -import org.wso2.carbon.analytics.datasource.commons.Record; -import org.wso2.carbon.analytics.datasource.commons.exception.AnalyticsException; -import org.wso2.carbon.analytics.stream.persistence.stub.EventStreamPersistenceAdminServiceEventStreamPersistenceAdminServiceExceptionException; -import org.wso2.carbon.analytics.stream.persistence.stub.EventStreamPersistenceAdminServiceStub; -import org.wso2.carbon.analytics.stream.persistence.stub.dto.AnalyticsTable; -import org.wso2.carbon.analytics.stream.persistence.stub.dto.AnalyticsTableRecord; +//import org.wso2.carbon.analytics.api.AnalyticsDataAPI; +//import org.wso2.carbon.analytics.api.AnalyticsDataAPIUtil; +//import org.wso2.carbon.analytics.dataservice.commons.AnalyticsDataResponse; +//import org.wso2.carbon.analytics.dataservice.commons.SearchResultEntry; +//import org.wso2.carbon.analytics.dataservice.commons.SortByField; +//import org.wso2.carbon.analytics.dataservice.commons.SortType; +//import org.wso2.carbon.analytics.datasource.commons.Record; +//import org.wso2.carbon.analytics.datasource.commons.exception.AnalyticsException; +//import org.wso2.carbon.analytics.stream.persistence.stub.EventStreamPersistenceAdminServiceEventStreamPersistenceAdminServiceExceptionException; +//import org.wso2.carbon.analytics.stream.persistence.stub.EventStreamPersistenceAdminServiceStub; +//import org.wso2.carbon.analytics.stream.persistence.stub.dto.AnalyticsTable; +//import org.wso2.carbon.analytics.stream.persistence.stub.dto.AnalyticsTableRecord; import org.wso2.carbon.base.MultitenantConstants; import org.wso2.carbon.context.CarbonContext; import org.wso2.carbon.context.PrivilegedCarbonContext; @@ -81,49 +81,49 @@ public class DeviceEventManagementServiceImpl implements DeviceEventManagementSe private static final String MQTT_CONTENT_VALIDATOR = "default"; private static final String TIMESTAMP_FIELD_NAME = "_timestamp"; - private static AnalyticsDataAPI getAnalyticsDataAPI() { - PrivilegedCarbonContext ctx = PrivilegedCarbonContext.getThreadLocalCarbonContext(); - AnalyticsDataAPI analyticsDataAPI = - (AnalyticsDataAPI) ctx.getOSGiService(AnalyticsDataAPI.class, null); - if (analyticsDataAPI == null) { - String msg = "Analytics api service has not initialized."; - log.error(msg); - throw new IllegalStateException(msg); - } - return analyticsDataAPI; - } - - private static EventRecords getAllEventsForDevice(String tableName, String query, List sortByFields - , int offset, int limit) throws AnalyticsException { - int tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId(); - AnalyticsDataAPI analyticsDataAPI = getAnalyticsDataAPI(); - EventRecords eventRecords = new EventRecords(); - int eventCount = analyticsDataAPI.searchCount(tenantId, tableName, query); - if (eventCount == 0) { - eventRecords.setCount(0); - } - List resultEntries = analyticsDataAPI.search(tenantId, tableName, query, offset, limit, - sortByFields); - List recordIds = getRecordIds(resultEntries); - AnalyticsDataResponse response = analyticsDataAPI.get(tenantId, tableName, 1, null, recordIds); - eventRecords.setCount(eventCount); - List records = AnalyticsDataAPIUtil.listRecords(analyticsDataAPI, response); - records.sort(new Comparator() { - @Override public int compare(Record r1, Record r2) { - return Long.compare(r2.getTimestamp(), r1.getTimestamp()); - } - }); - eventRecords.setList(records); - return eventRecords; - } - - private static List getRecordIds(List searchResults) { - List ids = new ArrayList<>(); - for (SearchResultEntry searchResult : searchResults) { - ids.add(searchResult.getId()); - } - return ids; - } +// private static AnalyticsDataAPI getAnalyticsDataAPI() { +// PrivilegedCarbonContext ctx = PrivilegedCarbonContext.getThreadLocalCarbonContext(); +// AnalyticsDataAPI analyticsDataAPI = +// (AnalyticsDataAPI) ctx.getOSGiService(AnalyticsDataAPI.class, null); +// if (analyticsDataAPI == null) { +// String msg = "Analytics api service has not initialized."; +// log.error(msg); +// throw new IllegalStateException(msg); +// } +// return analyticsDataAPI; +// } + +// private static EventRecords getAllEventsForDevice(String tableName, String query, List sortByFields +// , int offset, int limit) throws AnalyticsException { +// int tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId(); +// AnalyticsDataAPI analyticsDataAPI = getAnalyticsDataAPI(); +// EventRecords eventRecords = new EventRecords(); +// int eventCount = analyticsDataAPI.searchCount(tenantId, tableName, query); +// if (eventCount == 0) { +// eventRecords.setCount(0); +// } +// List resultEntries = analyticsDataAPI.search(tenantId, tableName, query, offset, limit, +// sortByFields); +// List recordIds = getRecordIds(resultEntries); +// AnalyticsDataResponse response = analyticsDataAPI.get(tenantId, tableName, 1, null, recordIds); +// eventRecords.setCount(eventCount); +// List records = AnalyticsDataAPIUtil.listRecords(analyticsDataAPI, response); +// records.sort(new Comparator() { +// @Override public int compare(Record r1, Record r2) { +// return Long.compare(r2.getTimestamp(), r1.getTimestamp()); +// } +// }); +// eventRecords.setList(records); +// return eventRecords; +// } + +// private static List getRecordIds(List searchResults) { +// List ids = new ArrayList<>(); +// for (SearchResultEntry searchResult : searchResults) { +// ids.add(searchResult.getId()); +// } +// return ids; +// } /** * Retrieves the stream definition from das for the given device type. @@ -195,65 +195,65 @@ public class DeviceEventManagementServiceImpl implements DeviceEventManagementSe /** * Deploy Event Stream, Receiver, Publisher and Store Configuration. */ - @POST - @Path("/{type}") - @Override - public Response deployDeviceTypeEventDefinition(@PathParam("type") String deviceType, - @QueryParam("skipPersist") boolean skipPersist, - @QueryParam("isSharedWithAllTenants") boolean isSharedWithAllTenants, - @Valid DeviceTypeEvent deviceTypeEvent) { - TransportType transportType = deviceTypeEvent.getTransportType(); - EventAttributeList eventAttributes = deviceTypeEvent.getEventAttributeList(); - String tenantDomain = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantDomain(); - try { - if (eventAttributes == null || eventAttributes.getList() == null || eventAttributes.getList().size() == 0 || - deviceType == null || transportType == null || - !DeviceMgtAPIUtils.getDeviceManagementService().getAvailableDeviceTypes().contains(deviceType)) { - String errorMessage = "Invalid Payload"; - log.error(errorMessage); - return Response.status(Response.Status.BAD_REQUEST).build(); - } - String streamName = DeviceMgtAPIUtils.getStreamDefinition(deviceType, tenantDomain); - String streamNameWithVersion = streamName + ":" + Constants.DEFAULT_STREAM_VERSION; - publishStreamDefinitons(streamName, Constants.DEFAULT_STREAM_VERSION, deviceType, eventAttributes); - publishEventReceivers(streamNameWithVersion, transportType, tenantDomain, isSharedWithAllTenants, deviceType); - if (!skipPersist) { - publishEventStore(streamName, Constants.DEFAULT_STREAM_VERSION, eventAttributes); - } - publishWebsocketPublisherDefinition(streamNameWithVersion, deviceType); - try { - PrivilegedCarbonContext.startTenantFlow(); - PrivilegedCarbonContext.getThreadLocalCarbonContext().setTenantDomain( - MultitenantConstants.SUPER_TENANT_DOMAIN_NAME, true); - if (!MultitenantConstants.SUPER_TENANT_DOMAIN_NAME.equals(tenantDomain)) { - publishStreamDefinitons(streamName, Constants.DEFAULT_STREAM_VERSION, deviceType, eventAttributes); - publishEventReceivers(streamNameWithVersion, transportType, tenantDomain, isSharedWithAllTenants, deviceType); - } - } finally { - PrivilegedCarbonContext.endTenantFlow(); - } - return Response.ok().build(); - } catch (AxisFault e) { - log.error("Failed to create event definitions for tenantDomain:" + tenantDomain, e); - return Response.status(Response.Status.INTERNAL_SERVER_ERROR).build(); - } catch (RemoteException e) { - log.error("Failed to connect with the remote services:" + tenantDomain, e); - return Response.status(Response.Status.INTERNAL_SERVER_ERROR).build(); - } catch (JWTClientException e) { - log.error("Failed to generate jwt token for tenantDomain:" + tenantDomain, e); - return Response.status(Response.Status.INTERNAL_SERVER_ERROR).build(); - } catch (UserStoreException e) { - log.error("Failed to connect with the user store, tenantDomain: " + tenantDomain, e); - return Response.status(Response.Status.INTERNAL_SERVER_ERROR).build(); - } catch (DeviceManagementException e) { - log.error("Failed to access device management service, tenantDomain: " + tenantDomain, e); - return Response.status(Response.Status.INTERNAL_SERVER_ERROR).build(); - } catch (EventStreamPersistenceAdminServiceEventStreamPersistenceAdminServiceExceptionException e) { - log.error("Failed to create event store for, tenantDomain: " + tenantDomain + " deviceType" + deviceType, - e); - return Response.status(Response.Status.INTERNAL_SERVER_ERROR).build(); - } - } +// @POST +// @Path("/{type}") +// @Override +// public Response deployDeviceTypeEventDefinition(@PathParam("type") String deviceType, +// @QueryParam("skipPersist") boolean skipPersist, +// @QueryParam("isSharedWithAllTenants") boolean isSharedWithAllTenants, +// @Valid DeviceTypeEvent deviceTypeEvent) { +// TransportType transportType = deviceTypeEvent.getTransportType(); +// EventAttributeList eventAttributes = deviceTypeEvent.getEventAttributeList(); +// String tenantDomain = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantDomain(); +// try { +// if (eventAttributes == null || eventAttributes.getList() == null || eventAttributes.getList().size() == 0 || +// deviceType == null || transportType == null || +// !DeviceMgtAPIUtils.getDeviceManagementService().getAvailableDeviceTypes().contains(deviceType)) { +// String errorMessage = "Invalid Payload"; +// log.error(errorMessage); +// return Response.status(Response.Status.BAD_REQUEST).build(); +// } +// String streamName = DeviceMgtAPIUtils.getStreamDefinition(deviceType, tenantDomain); +// String streamNameWithVersion = streamName + ":" + Constants.DEFAULT_STREAM_VERSION; +// publishStreamDefinitons(streamName, Constants.DEFAULT_STREAM_VERSION, deviceType, eventAttributes); +// publishEventReceivers(streamNameWithVersion, transportType, tenantDomain, isSharedWithAllTenants, deviceType); +// if (!skipPersist) { +// publishEventStore(streamName, Constants.DEFAULT_STREAM_VERSION, eventAttributes); +// } +// publishWebsocketPublisherDefinition(streamNameWithVersion, deviceType); +// try { +// PrivilegedCarbonContext.startTenantFlow(); +// PrivilegedCarbonContext.getThreadLocalCarbonContext().setTenantDomain( +// MultitenantConstants.SUPER_TENANT_DOMAIN_NAME, true); +// if (!MultitenantConstants.SUPER_TENANT_DOMAIN_NAME.equals(tenantDomain)) { +// publishStreamDefinitons(streamName, Constants.DEFAULT_STREAM_VERSION, deviceType, eventAttributes); +// publishEventReceivers(streamNameWithVersion, transportType, tenantDomain, isSharedWithAllTenants, deviceType); +// } +// } finally { +// PrivilegedCarbonContext.endTenantFlow(); +// } +// return Response.ok().build(); +// } catch (AxisFault e) { +// log.error("Failed to create event definitions for tenantDomain:" + tenantDomain, e); +// return Response.status(Response.Status.INTERNAL_SERVER_ERROR).build(); +// } catch (RemoteException e) { +// log.error("Failed to connect with the remote services:" + tenantDomain, e); +// return Response.status(Response.Status.INTERNAL_SERVER_ERROR).build(); +// } catch (JWTClientException e) { +// log.error("Failed to generate jwt token for tenantDomain:" + tenantDomain, e); +// return Response.status(Response.Status.INTERNAL_SERVER_ERROR).build(); +// } catch (UserStoreException e) { +// log.error("Failed to connect with the user store, tenantDomain: " + tenantDomain, e); +// return Response.status(Response.Status.INTERNAL_SERVER_ERROR).build(); +// } catch (DeviceManagementException e) { +// log.error("Failed to access device management service, tenantDomain: " + tenantDomain, e); +// return Response.status(Response.Status.INTERNAL_SERVER_ERROR).build(); +// } catch (EventStreamPersistenceAdminServiceEventStreamPersistenceAdminServiceExceptionException e) { +// log.error("Failed to create event store for, tenantDomain: " + tenantDomain + " deviceType" + deviceType, +// e); +// return Response.status(Response.Status.INTERNAL_SERVER_ERROR).build(); +// } +// } /** * Delete device type specific artifacts from DAS. @@ -349,175 +349,175 @@ public class DeviceEventManagementServiceImpl implements DeviceEventManagementSe /** * Returns device specific data for the give period of time. */ - @GET - @Path("/{type}/{deviceId}") - @Override - public Response getData(@PathParam("deviceId") String deviceId, @QueryParam("from") long from, - @QueryParam("to") long to, @PathParam("type") String deviceType, @QueryParam("offset") - int offset, @QueryParam("limit") int limit) { - if (from == 0 || to == 0) { - String errorMessage = "Invalid values for from/to"; - return Response.status(Response.Status.BAD_REQUEST).entity(errorMessage).build(); - } - if (limit == 0) { - String errorMessage = "Invalid values for offset/limit"; - return Response.status(Response.Status.BAD_REQUEST).entity(errorMessage).build(); - } - String fromDate = String.valueOf(from); - String toDate = String.valueOf(to); - String query = DEFAULT_META_DEVICE_ID_ATTRIBUTE + ":" + deviceId - + " AND _timestamp : [" + fromDate + " TO " + toDate + "]"; - String tenantDomain = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantDomain(); - String sensorTableName = getTableName(DeviceMgtAPIUtils.getStreamDefinition(deviceType, tenantDomain)); - try { - if (deviceType == null || - !DeviceMgtAPIUtils.getDeviceManagementService().getAvailableDeviceTypes().contains(deviceType)) { - String errorMessage = "Invalid device type"; - log.error(errorMessage); - return Response.status(Response.Status.BAD_REQUEST).build(); - } - if (!DeviceMgtAPIUtils.getDeviceAccessAuthorizationService().isUserAuthorized( - new DeviceIdentifier(deviceId, deviceType))) { - return Response.status(Response.Status.UNAUTHORIZED.getStatusCode()).build(); - } - List sortByFields = new ArrayList<>(); - SortByField sortByField = new SortByField(TIMESTAMP_FIELD_NAME, SortType.DESC); - sortByFields.add(sortByField); - EventRecords eventRecords = getAllEventsForDevice(sensorTableName, query, sortByFields, offset, limit); - return Response.status(Response.Status.OK.getStatusCode()).entity(eventRecords).build(); - } catch (AnalyticsException e) { - String errorMsg = "Error on retrieving stats on table " + sensorTableName + " with query " + query; - log.error(errorMsg); - return Response.status(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode()).entity(errorMsg).build(); - } catch (DeviceAccessAuthorizationException e) { - log.error(e.getErrorMessage(), e); - return Response.status(Response.Status.INTERNAL_SERVER_ERROR).build(); - } catch (DeviceManagementException e) { - String errorMsg = "Error on retrieving stats on table " + sensorTableName + " with query " + query; - log.error(errorMsg); - return Response.status(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode()).entity(errorMsg).build(); - } - } +// @GET +// @Path("/{type}/{deviceId}") +// @Override +// public Response getData(@PathParam("deviceId") String deviceId, @QueryParam("from") long from, +// @QueryParam("to") long to, @PathParam("type") String deviceType, @QueryParam("offset") +// int offset, @QueryParam("limit") int limit) { +// if (from == 0 || to == 0) { +// String errorMessage = "Invalid values for from/to"; +// return Response.status(Response.Status.BAD_REQUEST).entity(errorMessage).build(); +// } +// if (limit == 0) { +// String errorMessage = "Invalid values for offset/limit"; +// return Response.status(Response.Status.BAD_REQUEST).entity(errorMessage).build(); +// } +// String fromDate = String.valueOf(from); +// String toDate = String.valueOf(to); +// String query = DEFAULT_META_DEVICE_ID_ATTRIBUTE + ":" + deviceId +// + " AND _timestamp : [" + fromDate + " TO " + toDate + "]"; +// String tenantDomain = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantDomain(); +// String sensorTableName = getTableName(DeviceMgtAPIUtils.getStreamDefinition(deviceType, tenantDomain)); +// try { +// if (deviceType == null || +// !DeviceMgtAPIUtils.getDeviceManagementService().getAvailableDeviceTypes().contains(deviceType)) { +// String errorMessage = "Invalid device type"; +// log.error(errorMessage); +// return Response.status(Response.Status.BAD_REQUEST).build(); +// } +// if (!DeviceMgtAPIUtils.getDeviceAccessAuthorizationService().isUserAuthorized( +// new DeviceIdentifier(deviceId, deviceType))) { +// return Response.status(Response.Status.UNAUTHORIZED.getStatusCode()).build(); +// } +// List sortByFields = new ArrayList<>(); +// SortByField sortByField = new SortByField(TIMESTAMP_FIELD_NAME, SortType.DESC); +// sortByFields.add(sortByField); +// EventRecords eventRecords = getAllEventsForDevice(sensorTableName, query, sortByFields, offset, limit); +// return Response.status(Response.Status.OK.getStatusCode()).entity(eventRecords).build(); +// } catch (AnalyticsException e) { +// String errorMsg = "Error on retrieving stats on table " + sensorTableName + " with query " + query; +// log.error(errorMsg); +// return Response.status(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode()).entity(errorMsg).build(); +// } catch (DeviceAccessAuthorizationException e) { +// log.error(e.getErrorMessage(), e); +// return Response.status(Response.Status.INTERNAL_SERVER_ERROR).build(); +// } catch (DeviceManagementException e) { +// String errorMsg = "Error on retrieving stats on table " + sensorTableName + " with query " + query; +// log.error(errorMsg); +// return Response.status(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode()).entity(errorMsg).build(); +// } +// } /** * Returns last known data points up to the limit if limit is specified. Otherwise returns last known data point. * Limit parameter needs to be zero or positive. */ - @GET - @Path("/last-known/{type}/{deviceId}") - @Override - public Response getLastKnownData(@PathParam("deviceId") String deviceId, @PathParam("type") String deviceType, @QueryParam("limit") int limit) { - String query = DEFAULT_META_DEVICE_ID_ATTRIBUTE + ":" + deviceId; - String tenantDomain = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantDomain(); - String sensorTableName = getTableName(DeviceMgtAPIUtils.getStreamDefinition(deviceType, tenantDomain)); - try { - if (deviceType == null || - !DeviceMgtAPIUtils.getDeviceManagementService().getAvailableDeviceTypes().contains(deviceType)) { - String errorMessage = "Invalid device type"; - log.error(errorMessage); - return Response.status(Response.Status.BAD_REQUEST).build(); - } - if (!DeviceMgtAPIUtils.getDeviceAccessAuthorizationService().isUserAuthorized( - new DeviceIdentifier(deviceId, deviceType))) { - return Response.status(Response.Status.UNAUTHORIZED.getStatusCode()).build(); - } - List sortByFields = new ArrayList<>(); - SortByField sortByField = new SortByField(TIMESTAMP_FIELD_NAME, SortType.DESC); - sortByFields.add(sortByField); - if (limit == 0) { - EventRecords eventRecords = getAllEventsForDevice(sensorTableName, query, sortByFields, 0, 1); - return Response.status(Response.Status.OK.getStatusCode()).entity(eventRecords).build(); - } else if (limit > 0) { - EventRecords eventRecords = getAllEventsForDevice(sensorTableName, query, sortByFields, 0, limit); - return Response.status(Response.Status.OK.getStatusCode()).entity(eventRecords).build(); - } else { - String errorMessage = "Invalid limit value"; - return Response.status(Response.Status.BAD_REQUEST).entity(errorMessage).build(); - } - } catch (AnalyticsException e) { - String errorMsg = "Error on retrieving stats on table " + sensorTableName + " with query " + query; - log.error(errorMsg); - return Response.status(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode()).entity(errorMsg).build(); - } catch (DeviceAccessAuthorizationException e) { - log.error(e.getErrorMessage(), e); - return Response.status(Response.Status.INTERNAL_SERVER_ERROR).build(); - } catch (DeviceManagementException e) { - String errorMsg = "Error on retrieving stats on table " + sensorTableName + " with query " + query; - log.error(errorMsg); - return Response.status(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode()).entity(errorMsg).build(); - } - } +// @GET +// @Path("/last-known/{type}/{deviceId}") +// @Override +// public Response getLastKnownData(@PathParam("deviceId") String deviceId, @PathParam("type") String deviceType, @QueryParam("limit") int limit) { +// String query = DEFAULT_META_DEVICE_ID_ATTRIBUTE + ":" + deviceId; +// String tenantDomain = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantDomain(); +// String sensorTableName = getTableName(DeviceMgtAPIUtils.getStreamDefinition(deviceType, tenantDomain)); +// try { +// if (deviceType == null || +// !DeviceMgtAPIUtils.getDeviceManagementService().getAvailableDeviceTypes().contains(deviceType)) { +// String errorMessage = "Invalid device type"; +// log.error(errorMessage); +// return Response.status(Response.Status.BAD_REQUEST).build(); +// } +// if (!DeviceMgtAPIUtils.getDeviceAccessAuthorizationService().isUserAuthorized( +// new DeviceIdentifier(deviceId, deviceType))) { +// return Response.status(Response.Status.UNAUTHORIZED.getStatusCode()).build(); +// } +// List sortByFields = new ArrayList<>(); +// SortByField sortByField = new SortByField(TIMESTAMP_FIELD_NAME, SortType.DESC); +// sortByFields.add(sortByField); +// if (limit == 0) { +// EventRecords eventRecords = getAllEventsForDevice(sensorTableName, query, sortByFields, 0, 1); +// return Response.status(Response.Status.OK.getStatusCode()).entity(eventRecords).build(); +// } else if (limit > 0) { +// EventRecords eventRecords = getAllEventsForDevice(sensorTableName, query, sortByFields, 0, limit); +// return Response.status(Response.Status.OK.getStatusCode()).entity(eventRecords).build(); +// } else { +// String errorMessage = "Invalid limit value"; +// return Response.status(Response.Status.BAD_REQUEST).entity(errorMessage).build(); +// } +// } catch (AnalyticsException e) { +// String errorMsg = "Error on retrieving stats on table " + sensorTableName + " with query " + query; +// log.error(errorMsg); +// return Response.status(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode()).entity(errorMsg).build(); +// } catch (DeviceAccessAuthorizationException e) { +// log.error(e.getErrorMessage(), e); +// return Response.status(Response.Status.INTERNAL_SERVER_ERROR).build(); +// } catch (DeviceManagementException e) { +// String errorMsg = "Error on retrieving stats on table " + sensorTableName + " with query " + query; +// log.error(errorMsg); +// return Response.status(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode()).entity(errorMsg).build(); +// } +// } /** * Returns the filterd device list. Devices are filterd using the paramter given and the timestamp of the record. * parameter should given as a range. */ - @GET - @Path("filter/{type}/{parameter}") - @Override - public Response getFilteredDevices(@PathParam("type") String deviceType, @PathParam("parameter") String parameter, - @QueryParam("min") double min, @QueryParam("max") double max) { - String query; - Calendar c = java.util.Calendar.getInstance(); - long currentTimestamp = c.getTimeInMillis(); - long previousTimestamp = currentTimestamp - 300 * 1000; - String fromDate = String.valueOf(previousTimestamp); - String toDate = String.valueOf(currentTimestamp); - if (min != 0 & max != 0) { - query = parameter + " : [" + min + " TO " + max + "]" + - " AND _timestamp : [" + fromDate + " TO " + toDate + "]"; - } else { - String errorMessage = "The of range values need to be given"; - log.error(errorMessage); - return Response.status(Response.Status.BAD_REQUEST).build(); - } - - String tenantDomain = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantDomain(); - String sensorTableName = getTableName(DeviceMgtAPIUtils.getStreamDefinition(deviceType, tenantDomain)); - try { - if (deviceType == null || - !DeviceMgtAPIUtils.getDeviceManagementService().getAvailableDeviceTypes().contains(deviceType)) { - String errorMessage = "Invalid device type"; - log.error(errorMessage); - return Response.status(Response.Status.BAD_REQUEST).build(); - } - - List sortByFields = new ArrayList<>(); - SortByField sortByField = new SortByField(TIMESTAMP_FIELD_NAME, SortType.DESC); - sortByFields.add(sortByField); - EventRecords eventRecords = getAllEventsForDevice(sensorTableName, query, sortByFields, 0, 100); - List filterdEvents = eventRecords.getRecord(); - List uniqueFilterdEvents = new ArrayList(); - Set devices = new HashSet<>(); - - for (int i = 0; i < filterdEvents.size(); i++) { - String deviceid = (String) filterdEvents.get(i).getValue("meta_deviceId"); - if (!devices.contains(deviceid) && DeviceMgtAPIUtils.getDeviceAccessAuthorizationService().isUserAuthorized( - new DeviceIdentifier(deviceid, deviceType))) { - devices.add(deviceid); - uniqueFilterdEvents.add(filterdEvents.get(i)); - } - } - - EventRecords filterdRecords = new EventRecords(); - filterdRecords.setList(uniqueFilterdEvents); - return Response.status(Response.Status.OK.getStatusCode()).entity(filterdRecords).build(); - - } catch (AnalyticsException e) { - String errorMsg = "Error on retrieving stats on table " + sensorTableName + " with query " + query; - log.error(errorMsg); - return Response.status(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode()).entity(errorMsg).build(); - } catch (DeviceManagementException e) { - String errorMsg = "Error on retrieving stats on table " + sensorTableName + " with query " + query; - log.error(errorMsg); - return Response.status(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode()).entity(errorMsg).build(); - } catch (DeviceAccessAuthorizationException e) { - String errorMsg = "Error on retrieving stats on table " + sensorTableName + " with query " + query; - log.error(errorMsg); - return Response.status(Response.Status.UNAUTHORIZED.getStatusCode()).build(); - } - } +// @GET +// @Path("filter/{type}/{parameter}") +// @Override +// public Response getFilteredDevices(@PathParam("type") String deviceType, @PathParam("parameter") String parameter, +// @QueryParam("min") double min, @QueryParam("max") double max) { +// String query; +// Calendar c = java.util.Calendar.getInstance(); +// long currentTimestamp = c.getTimeInMillis(); +// long previousTimestamp = currentTimestamp - 300 * 1000; +// String fromDate = String.valueOf(previousTimestamp); +// String toDate = String.valueOf(currentTimestamp); +// if (min != 0 & max != 0) { +// query = parameter + " : [" + min + " TO " + max + "]" + +// " AND _timestamp : [" + fromDate + " TO " + toDate + "]"; +// } else { +// String errorMessage = "The of range values need to be given"; +// log.error(errorMessage); +// return Response.status(Response.Status.BAD_REQUEST).build(); +// } +// +// String tenantDomain = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantDomain(); +// String sensorTableName = getTableName(DeviceMgtAPIUtils.getStreamDefinition(deviceType, tenantDomain)); +// try { +// if (deviceType == null || +// !DeviceMgtAPIUtils.getDeviceManagementService().getAvailableDeviceTypes().contains(deviceType)) { +// String errorMessage = "Invalid device type"; +// log.error(errorMessage); +// return Response.status(Response.Status.BAD_REQUEST).build(); +// } +// +// List sortByFields = new ArrayList<>(); +// SortByField sortByField = new SortByField(TIMESTAMP_FIELD_NAME, SortType.DESC); +// sortByFields.add(sortByField); +// EventRecords eventRecords = getAllEventsForDevice(sensorTableName, query, sortByFields, 0, 100); +// List filterdEvents = eventRecords.getRecord(); +// List uniqueFilterdEvents = new ArrayList(); +// Set devices = new HashSet<>(); +// +// for (int i = 0; i < filterdEvents.size(); i++) { +// String deviceid = (String) filterdEvents.get(i).getValue("meta_deviceId"); +// if (!devices.contains(deviceid) && DeviceMgtAPIUtils.getDeviceAccessAuthorizationService().isUserAuthorized( +// new DeviceIdentifier(deviceid, deviceType))) { +// devices.add(deviceid); +// uniqueFilterdEvents.add(filterdEvents.get(i)); +// } +// } +// +// EventRecords filterdRecords = new EventRecords(); +// filterdRecords.setList(uniqueFilterdEvents); +// return Response.status(Response.Status.OK.getStatusCode()).entity(filterdRecords).build(); +// +// } catch (AnalyticsException e) { +// String errorMsg = "Error on retrieving stats on table " + sensorTableName + " with query " + query; +// log.error(errorMsg); +// return Response.status(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode()).entity(errorMsg).build(); +// } catch (DeviceManagementException e) { +// String errorMsg = "Error on retrieving stats on table " + sensorTableName + " with query " + query; +// log.error(errorMsg); +// return Response.status(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode()).entity(errorMsg).build(); +// } catch (DeviceAccessAuthorizationException e) { +// String errorMsg = "Error on retrieving stats on table " + sensorTableName + " with query " + query; +// log.error(errorMsg); +// return Response.status(Response.Status.UNAUTHORIZED.getStatusCode()).build(); +// } +// } private void publishEventReceivers(String streamNameWithVersion, TransportType transportType @@ -613,47 +613,47 @@ public class DeviceEventManagementServiceImpl implements DeviceEventManagementSe } } - private void publishEventStore(String streamName, String version, EventAttributeList eventAttributes) - throws RemoteException, UserStoreException, JWTClientException, - EventStreamPersistenceAdminServiceEventStreamPersistenceAdminServiceExceptionException { - EventStreamPersistenceAdminServiceStub eventStreamPersistenceAdminServiceStub = - DeviceMgtAPIUtils.getEventStreamPersistenceAdminServiceStub(); - try { - AnalyticsTable analyticsTable = new AnalyticsTable(); - analyticsTable.setRecordStoreName(DEFAULT_EVENT_STORE_NAME); - analyticsTable.setStreamVersion(version); - analyticsTable.setTableName(streamName); - analyticsTable.setMergeSchema(false); - analyticsTable.setPersist(true); - AnalyticsTableRecord analyticsTableRecords[] = new AnalyticsTableRecord[eventAttributes.getList().size() + 1]; - int i = 0; - for (Attribute attribute : eventAttributes.getList()) { - AnalyticsTableRecord analyticsTableRecord = new AnalyticsTableRecord(); - analyticsTableRecord.setColumnName(attribute.getName()); - analyticsTableRecord.setColumnType(attribute.getType().toString().toUpperCase()); - analyticsTableRecord.setFacet(false); - analyticsTableRecord.setIndexed(false); - analyticsTableRecord.setPersist(true); - analyticsTableRecord.setPrimaryKey(false); - analyticsTableRecord.setScoreParam(false); - analyticsTableRecords[i] = analyticsTableRecord; - i++; - } - AnalyticsTableRecord analyticsTableRecord = new AnalyticsTableRecord(); - analyticsTableRecord.setColumnName(DEFAULT_META_DEVICE_ID_ATTRIBUTE); - analyticsTableRecord.setColumnType(AttributeType.STRING.toString().toUpperCase()); - analyticsTableRecord.setFacet(false); - analyticsTableRecord.setIndexed(true); - analyticsTableRecord.setPersist(true); - analyticsTableRecord.setPrimaryKey(false); - analyticsTableRecord.setScoreParam(false); - analyticsTableRecords[i] = analyticsTableRecord; - analyticsTable.setAnalyticsTableRecords(analyticsTableRecords); - eventStreamPersistenceAdminServiceStub.addAnalyticsTable(analyticsTable); - } finally { - cleanup(eventStreamPersistenceAdminServiceStub); - } - } +// private void publishEventStore(String streamName, String version, EventAttributeList eventAttributes) +// throws RemoteException, UserStoreException, JWTClientException, +// EventStreamPersistenceAdminServiceEventStreamPersistenceAdminServiceExceptionException { +// EventStreamPersistenceAdminServiceStub eventStreamPersistenceAdminServiceStub = +// DeviceMgtAPIUtils.getEventStreamPersistenceAdminServiceStub(); +// try { +// AnalyticsTable analyticsTable = new AnalyticsTable(); +// analyticsTable.setRecordStoreName(DEFAULT_EVENT_STORE_NAME); +// analyticsTable.setStreamVersion(version); +// analyticsTable.setTableName(streamName); +// analyticsTable.setMergeSchema(false); +// analyticsTable.setPersist(true); +// AnalyticsTableRecord analyticsTableRecords[] = new AnalyticsTableRecord[eventAttributes.getList().size() + 1]; +// int i = 0; +// for (Attribute attribute : eventAttributes.getList()) { +// AnalyticsTableRecord analyticsTableRecord = new AnalyticsTableRecord(); +// analyticsTableRecord.setColumnName(attribute.getName()); +// analyticsTableRecord.setColumnType(attribute.getType().toString().toUpperCase()); +// analyticsTableRecord.setFacet(false); +// analyticsTableRecord.setIndexed(false); +// analyticsTableRecord.setPersist(true); +// analyticsTableRecord.setPrimaryKey(false); +// analyticsTableRecord.setScoreParam(false); +// analyticsTableRecords[i] = analyticsTableRecord; +// i++; +// } +// AnalyticsTableRecord analyticsTableRecord = new AnalyticsTableRecord(); +// analyticsTableRecord.setColumnName(DEFAULT_META_DEVICE_ID_ATTRIBUTE); +// analyticsTableRecord.setColumnType(AttributeType.STRING.toString().toUpperCase()); +// analyticsTableRecord.setFacet(false); +// analyticsTableRecord.setIndexed(true); +// analyticsTableRecord.setPersist(true); +// analyticsTableRecord.setPrimaryKey(false); +// analyticsTableRecord.setScoreParam(false); +// analyticsTableRecords[i] = analyticsTableRecord; +// analyticsTable.setAnalyticsTableRecords(analyticsTableRecords); +// eventStreamPersistenceAdminServiceStub.addAnalyticsTable(analyticsTable); +// } finally { +// cleanup(eventStreamPersistenceAdminServiceStub); +// } +// } private void publishWebsocketPublisherDefinition(String streamNameWithVersion, String deviceType) throws RemoteException, UserStoreException, JWTClientException { diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/GeoLocationBasedServiceImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/GeoLocationBasedServiceImpl.java index b2c28d8f1e..9075dceddd 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/GeoLocationBasedServiceImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/GeoLocationBasedServiceImpl.java @@ -25,14 +25,14 @@ import com.google.gson.Gson; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.http.HttpStatus; -import org.wso2.carbon.analytics.api.AnalyticsDataAPI; -import org.wso2.carbon.analytics.api.AnalyticsDataAPIUtil; -import org.wso2.carbon.analytics.dataservice.commons.AnalyticsDataResponse; -import org.wso2.carbon.analytics.dataservice.commons.SearchResultEntry; -import org.wso2.carbon.analytics.dataservice.commons.SortByField; -import org.wso2.carbon.analytics.dataservice.commons.SortType; -import org.wso2.carbon.analytics.datasource.commons.Record; -import org.wso2.carbon.analytics.datasource.commons.exception.AnalyticsException; +//import org.wso2.carbon.analytics.api.AnalyticsDataAPI; +//import org.wso2.carbon.analytics.api.AnalyticsDataAPIUtil; +//import org.wso2.carbon.analytics.dataservice.commons.AnalyticsDataResponse; +//import org.wso2.carbon.analytics.dataservice.commons.SearchResultEntry; +//import org.wso2.carbon.analytics.dataservice.commons.SortByField; +//import org.wso2.carbon.analytics.dataservice.commons.SortType; +//import org.wso2.carbon.analytics.datasource.commons.Record; +//import org.wso2.carbon.analytics.datasource.commons.exception.AnalyticsException; import org.wso2.carbon.context.CarbonContext; import org.wso2.carbon.device.mgt.common.Device; import org.wso2.carbon.device.mgt.common.DeviceIdentifier; @@ -93,63 +93,63 @@ public class GeoLocationBasedServiceImpl implements GeoLocationBasedService { private static Log log = LogFactory.getLog(GeoLocationBasedServiceImpl.class); - @Path("stats/{deviceType}/{deviceId}") - @GET - @Consumes("application/json") - @Produces("application/json") - public Response getGeoDeviceStats(@PathParam("deviceId") String deviceId, - @PathParam("deviceType") String deviceType, - @QueryParam("from") long from, @QueryParam("to") long to) { - try { - if (!DeviceManagerUtil.isPublishLocationResponseEnabled()) { - return Response.status(Response.Status.BAD_REQUEST.getStatusCode()) - .entity("Unable to retrive Geo Device stats. Geo Data publishing does not enabled.").build(); - } - } catch (DeviceManagementException e) { - return Response.status(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode()).entity(e.getMessage()).build(); - } - String tableName = "IOT_PER_DEVICE_STREAM_GEO_FUSEDSPATIALEVENT"; - String fromDate = String.valueOf(from); - String toDate = String.valueOf(to); - String query = "id:" + deviceId + " AND type:" + deviceType; - if (from != 0 || to != 0) { - query += " AND timeStamp : [" + fromDate + " TO " + toDate + "]"; - } - try { - if (!DeviceMgtAPIUtils.getDeviceAccessAuthorizationService().isUserAuthorized( - new DeviceIdentifier(deviceId, deviceType), - DeviceGroupConstants.Permissions.DEFAULT_STATS_MONITOR_PERMISSIONS)) { - return Response.status(Response.Status.UNAUTHORIZED.getStatusCode()).build(); - } - List sortByFields = new ArrayList<>(); - SortByField sortByField = new SortByField("timeStamp", SortType.ASC); - sortByFields.add(sortByField); - - // this is the user who initiates the request - String authorizedUser = MultitenantUtils.getTenantAwareUsername( - CarbonContext.getThreadLocalCarbonContext().getUsername()); - - try { - String tenantDomain = CarbonContext.getThreadLocalCarbonContext().getTenantDomain(); - int tenantId = DeviceMgtAPIUtils.getRealmService().getTenantManager().getTenantId(tenantDomain); - AnalyticsDataAPI analyticsDataAPI = DeviceMgtAPIUtils.getAnalyticsDataAPI(); - List searchResults = analyticsDataAPI.search(tenantId, tableName, query, - 0, - 100, - sortByFields); - List events = getEventBeans(analyticsDataAPI, tenantId, tableName, new ArrayList(), - searchResults); - return Response.ok().entity(events).build(); - } catch (AnalyticsException | UserStoreException e) { - log.error("Failed to perform search on table: " + tableName + " : " + e.getMessage(), e); - throw DeviceMgtUtil.buildBadRequestException( - Constants.ErrorMessages.STATUS_BAD_REQUEST_MESSAGE_DEFAULT); - } - } catch (DeviceAccessAuthorizationException e) { - log.error(e.getErrorMessage()); - return Response.status(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode()).build(); - } - } +// @Path("stats/{deviceType}/{deviceId}") +// @GET +// @Consumes("application/json") +// @Produces("application/json") +// public Response getGeoDeviceStats(@PathParam("deviceId") String deviceId, +// @PathParam("deviceType") String deviceType, +// @QueryParam("from") long from, @QueryParam("to") long to) { +// try { +// if (!DeviceManagerUtil.isPublishLocationResponseEnabled()) { +// return Response.status(Response.Status.BAD_REQUEST.getStatusCode()) +// .entity("Unable to retrive Geo Device stats. Geo Data publishing does not enabled.").build(); +// } +// } catch (DeviceManagementException e) { +// return Response.status(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode()).entity(e.getMessage()).build(); +// } +// String tableName = "IOT_PER_DEVICE_STREAM_GEO_FUSEDSPATIALEVENT"; +// String fromDate = String.valueOf(from); +// String toDate = String.valueOf(to); +// String query = "id:" + deviceId + " AND type:" + deviceType; +// if (from != 0 || to != 0) { +// query += " AND timeStamp : [" + fromDate + " TO " + toDate + "]"; +// } +// try { +// if (!DeviceMgtAPIUtils.getDeviceAccessAuthorizationService().isUserAuthorized( +// new DeviceIdentifier(deviceId, deviceType), +// DeviceGroupConstants.Permissions.DEFAULT_STATS_MONITOR_PERMISSIONS)) { +// return Response.status(Response.Status.UNAUTHORIZED.getStatusCode()).build(); +// } +// List sortByFields = new ArrayList<>(); +// SortByField sortByField = new SortByField("timeStamp", SortType.ASC); +// sortByFields.add(sortByField); +// +// // this is the user who initiates the request +// String authorizedUser = MultitenantUtils.getTenantAwareUsername( +// CarbonContext.getThreadLocalCarbonContext().getUsername()); +// +// try { +// String tenantDomain = CarbonContext.getThreadLocalCarbonContext().getTenantDomain(); +// int tenantId = DeviceMgtAPIUtils.getRealmService().getTenantManager().getTenantId(tenantDomain); +// AnalyticsDataAPI analyticsDataAPI = DeviceMgtAPIUtils.getAnalyticsDataAPI(); +// List searchResults = analyticsDataAPI.search(tenantId, tableName, query, +// 0, +// 100, +// sortByFields); +// List events = getEventBeans(analyticsDataAPI, tenantId, tableName, new ArrayList(), +// searchResults); +// return Response.ok().entity(null).build(); +// } catch (AnalyticsException| UserStoreException e) { +// log.error("Failed to perform search on table: " + tableName + " : " + e.getMessage(), e); +// throw DeviceMgtUtil.buildBadRequestException( +// Constants.ErrorMessages.STATUS_BAD_REQUEST_MESSAGE_DEFAULT); +// } +// } catch (DeviceAccessAuthorizationException e) { +// log.error(e.getErrorMessage()); +// return Response.status(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode()).build(); +// } +// } @Path("stats/device-locations") @GET @@ -471,142 +471,142 @@ public class GeoLocationBasedServiceImpl implements GeoLocationBasedService { } } - @Path("alerts/history/{deviceType}/{deviceId}") - @GET - @Consumes("application/json") - @Produces("application/json") - public Response getGeoAlertsHistory(@PathParam("deviceId") String deviceId, - @PathParam("deviceType") String deviceType, - @QueryParam("from") long from, @QueryParam("to") long to) { - String tableName = "IOT_PER_DEVICE_STREAM_GEO_ALERTNOTIFICATIONS"; - String fromDate = String.valueOf(from); - String toDate = String.valueOf(to); - String query = "id:" + deviceId + " AND type:" + deviceType; - if (from != 0 || to != 0) { - query += " AND timeStamp : [" + fromDate + " TO " + toDate + "]"; - } - try { - if (!DeviceMgtAPIUtils.getDeviceAccessAuthorizationService().isUserAuthorized( - new DeviceIdentifier(deviceId, deviceType), - DeviceGroupConstants.Permissions.DEFAULT_STATS_MONITOR_PERMISSIONS)) { - return Response.status(Response.Status.UNAUTHORIZED.getStatusCode()).build(); - } - List sortByFields = new ArrayList<>(); - SortByField sortByField = new SortByField("timeStamp", SortType.ASC); - sortByFields.add(sortByField); - - // this is the user who initiates the request - String authorizedUser = MultitenantUtils.getTenantAwareUsername( - CarbonContext.getThreadLocalCarbonContext().getUsername()); - - try { - String tenantDomain = MultitenantUtils.getTenantDomain(authorizedUser); - int tenantId = DeviceMgtAPIUtils.getRealmService().getTenantManager().getTenantId(tenantDomain); - AnalyticsDataAPI analyticsDataAPI = DeviceMgtAPIUtils.getAnalyticsDataAPI(); - List searchResults = analyticsDataAPI.search(tenantId, tableName, query, - 0, - 100, - sortByFields); - List events = getEventBeans(analyticsDataAPI, tenantId, tableName, new ArrayList(), - searchResults); - return Response.ok().entity(events).build(); - } catch (AnalyticsException | UserStoreException e) { - log.error("Failed to perform search on table: " + tableName + " : " + e.getMessage(), e); - throw DeviceMgtUtil.buildBadRequestException( - Constants.ErrorMessages.STATUS_BAD_REQUEST_MESSAGE_DEFAULT); - } - } catch (DeviceAccessAuthorizationException e) { - log.error(e.getErrorMessage()); - return Response.status(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode()).build(); - } - } - - @Path("alerts/history") - @GET - @Consumes("application/json") - @Produces("application/json") - public Response getGeoAlertsHistoryForGeoClusters(@QueryParam("from") long from, @QueryParam("to") long to) { - String tableName = "IOT_PER_DEVICE_STREAM_GEO_ALERTNOTIFICATIONS"; - String fromDate = String.valueOf(from); - String toDate = String.valueOf(to); - String query = ""; - if (from != 0 || to != 0) { - query = "timeStamp : [" + fromDate + " TO " + toDate + "]"; - } - try { - List sortByFields = new ArrayList<>(); - SortByField sortByField = new SortByField("timeStamp", SortType.ASC); - sortByFields.add(sortByField); - - // this is the user who initiates the request - String authorizedUser = MultitenantUtils.getTenantAwareUsername( - CarbonContext.getThreadLocalCarbonContext().getUsername()); - - String tenantDomain = MultitenantUtils.getTenantDomain(authorizedUser); - int tenantId = DeviceMgtAPIUtils.getRealmService().getTenantManager().getTenantId(tenantDomain); - AnalyticsDataAPI analyticsDataAPI = DeviceMgtAPIUtils.getAnalyticsDataAPI(); - List searchResults = analyticsDataAPI.search(tenantId, tableName, query, - 0, - 100, - sortByFields); - List events = getEventBeans(analyticsDataAPI, tenantId, tableName, new ArrayList(), - searchResults); - return Response.ok().entity(events).build(); - - } catch (AnalyticsException | UserStoreException e) { - log.error("Failed to perform search on table: " + tableName + " : " + e.getMessage(), e); - throw DeviceMgtUtil.buildBadRequestException( - Constants.ErrorMessages.STATUS_BAD_REQUEST_MESSAGE_DEFAULT); - } - } - - private List getEventBeans(AnalyticsDataAPI analyticsDataAPI, int tenantId, String tableName, - List columns, - List searchResults) throws AnalyticsException { - List ids = getIds(searchResults); - List requiredColumns = (columns == null || columns.isEmpty()) ? null : columns; - AnalyticsDataResponse response = analyticsDataAPI.get(tenantId, tableName, 1, requiredColumns, ids); - List records = AnalyticsDataAPIUtil.listRecords(analyticsDataAPI, response); - Map eventBeanMap = getEventBeanKeyedWithIds(records); - return getSortedEventBeans(eventBeanMap, searchResults); - } - - private List getSortedEventBeans(Map eventBeanMap, - List searchResults) { - List sortedRecords = new ArrayList<>(); - for (SearchResultEntry entry : searchResults) { - sortedRecords.add(eventBeanMap.get(entry.getId())); - } - return sortedRecords; - } - - private Map getEventBeanKeyedWithIds(List records) { - Map eventBeanMap = new HashMap<>(); - for (Record record : records) { - Event event = getEventBean(record); - eventBeanMap.put(event.getId(), event); - } - return eventBeanMap; - } - - private List getIds(List searchResults) { - List ids = new ArrayList<>(); - if (searchResults != null) { - for (SearchResultEntry resultEntry : searchResults) { - ids.add(resultEntry.getId()); - } - } - return ids; - } - - private static Event getEventBean(Record record) { - Event eventBean = new Event(); - eventBean.setId(record.getId()); - eventBean.setTableName(record.getTableName()); - eventBean.setTimestamp(record.getTimestamp()); - eventBean.setValues(record.getValues()); - return eventBean; - } +// @Path("alerts/history/{deviceType}/{deviceId}") +// @GET +// @Consumes("application/json") +// @Produces("application/json") +// public Response getGeoAlertsHistory(@PathParam("deviceId") String deviceId, +// @PathParam("deviceType") String deviceType, +// @QueryParam("from") long from, @QueryParam("to") long to) { +// String tableName = "IOT_PER_DEVICE_STREAM_GEO_ALERTNOTIFICATIONS"; +// String fromDate = String.valueOf(from); +// String toDate = String.valueOf(to); +// String query = "id:" + deviceId + " AND type:" + deviceType; +// if (from != 0 || to != 0) { +// query += " AND timeStamp : [" + fromDate + " TO " + toDate + "]"; +// } +// try { +// if (!DeviceMgtAPIUtils.getDeviceAccessAuthorizationService().isUserAuthorized( +// new DeviceIdentifier(deviceId, deviceType), +// DeviceGroupConstants.Permissions.DEFAULT_STATS_MONITOR_PERMISSIONS)) { +// return Response.status(Response.Status.UNAUTHORIZED.getStatusCode()).build(); +// } +// List sortByFields = new ArrayList<>(); +// SortByField sortByField = new SortByField("timeStamp", SortType.ASC); +// sortByFields.add(sortByField); +// +// // this is the user who initiates the request +// String authorizedUser = MultitenantUtils.getTenantAwareUsername( +// CarbonContext.getThreadLocalCarbonContext().getUsername()); +// +// try { +// String tenantDomain = MultitenantUtils.getTenantDomain(authorizedUser); +// int tenantId = DeviceMgtAPIUtils.getRealmService().getTenantManager().getTenantId(tenantDomain); +// AnalyticsDataAPI analyticsDataAPI = DeviceMgtAPIUtils.getAnalyticsDataAPI(); +// List searchResults = analyticsDataAPI.search(tenantId, tableName, query, +// 0, +// 100, +// sortByFields); +// List events = getEventBeans(analyticsDataAPI, tenantId, tableName, new ArrayList(), +// searchResults); +// return Response.ok().entity(events).build(); +// } catch (AnalyticsException | UserStoreException e) { +// log.error("Failed to perform search on table: " + tableName + " : " + e.getMessage(), e); +// throw DeviceMgtUtil.buildBadRequestException( +// Constants.ErrorMessages.STATUS_BAD_REQUEST_MESSAGE_DEFAULT); +// } +// } catch (DeviceAccessAuthorizationException e) { +// log.error(e.getErrorMessage()); +// return Response.status(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode()).build(); +// } +// } + +// @Path("alerts/history") +// @GET +// @Consumes("application/json") +// @Produces("application/json") +// public Response getGeoAlertsHistoryForGeoClusters(@QueryParam("from") long from, @QueryParam("to") long to) { +// String tableName = "IOT_PER_DEVICE_STREAM_GEO_ALERTNOTIFICATIONS"; +// String fromDate = String.valueOf(from); +// String toDate = String.valueOf(to); +// String query = ""; +// if (from != 0 || to != 0) { +// query = "timeStamp : [" + fromDate + " TO " + toDate + "]"; +// } +// try { +// List sortByFields = new ArrayList<>(); +// SortByField sortByField = new SortByField("timeStamp", SortType.ASC); +// sortByFields.add(sortByField); +// +// // this is the user who initiates the request +// String authorizedUser = MultitenantUtils.getTenantAwareUsername( +// CarbonContext.getThreadLocalCarbonContext().getUsername()); +// +// String tenantDomain = MultitenantUtils.getTenantDomain(authorizedUser); +// int tenantId = DeviceMgtAPIUtils.getRealmService().getTenantManager().getTenantId(tenantDomain); +// AnalyticsDataAPI analyticsDataAPI = DeviceMgtAPIUtils.getAnalyticsDataAPI(); +// List searchResults = analyticsDataAPI.search(tenantId, tableName, query, +// 0, +// 100, +// sortByFields); +// List events = getEventBeans(analyticsDataAPI, tenantId, tableName, new ArrayList(), +// searchResults); +// return Response.ok().entity(events).build(); +// +// } catch (AnalyticsException | UserStoreException e) { +// log.error("Failed to perform search on table: " + tableName + " : " + e.getMessage(), e); +// throw DeviceMgtUtil.buildBadRequestException( +// Constants.ErrorMessages.STATUS_BAD_REQUEST_MESSAGE_DEFAULT); +// } +// } + +// private List getEventBeans(AnalyticsDataAPI analyticsDataAPI, int tenantId, String tableName, +// List columns, +// List searchResults) throws AnalyticsException { +// List ids = getIds(searchResults); +// List requiredColumns = (columns == null || columns.isEmpty()) ? null : columns; +// AnalyticsDataResponse response = analyticsDataAPI.get(tenantId, tableName, 1, requiredColumns, ids); +// List records = AnalyticsDataAPIUtil.listRecords(analyticsDataAPI, response); +// Map eventBeanMap = getEventBeanKeyedWithIds(records); +// return getSortedEventBeans(eventBeanMap, searchResults); +// } + +// private List getSortedEventBeans(Map eventBeanMap, +// List searchResults) { +// List sortedRecords = new ArrayList<>(); +// for (SearchResultEntry entry : searchResults) { +// sortedRecords.add(eventBeanMap.get(entry.getId())); +// } +// return sortedRecords; +// } + +// private Map getEventBeanKeyedWithIds(List records) { +// Map eventBeanMap = new HashMap<>(); +// for (Record record : records) { +// Event event = getEventBean(record); +// eventBeanMap.put(event.getId(), event); +// } +// return eventBeanMap; +// } + +// private List getIds(List searchResults) { +// List ids = new ArrayList<>(); +// if (searchResults != null) { +// for (SearchResultEntry resultEntry : searchResults) { +// ids.add(resultEntry.getId()); +// } +// } +// return ids; +// } + +// private static Event getEventBean(Record record) { +// Event eventBean = new Event(); +// eventBean.setId(record.getId()); +// eventBean.setTableName(record.getTableName()); +// eventBean.setTimestamp(record.getTimestamp()); +// eventBean.setValues(record.getValues()); +// return eventBean; +// } @Path("/geo-fence") @POST diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/util/CredentialManagementResponseBuilder.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/util/CredentialManagementResponseBuilder.java index d326802c2a..16d4102176 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/util/CredentialManagementResponseBuilder.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/util/CredentialManagementResponseBuilder.java @@ -64,8 +64,9 @@ public class CredentialManagementResponseBuilder { username = CarbonContext.getThreadLocalCarbonContext().getUsername(); userStoreManager.updateCredential(username, credentials.getNewPassword(), credentials.getOldPassword()); - DeviceMgtAPIUtils.getIntegrationClientService().resetUserInfo(username, - PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantDomain()); + //todo:amalka +// DeviceMgtAPIUtils.getIntegrationClientService().resetUserInfo(username, +// PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantDomain()); return Response.status(Response.Status.OK).entity("UserImpl password by username: " + username + " was successfully changed.").build(); } catch (UserStoreException e) { @@ -108,8 +109,9 @@ public class CredentialManagementResponseBuilder { new ErrorResponse.ErrorResponseBuilder().setMessage(errorMsg).build()).build(); } userStoreManager.updateCredentialByAdmin(username, credentials.getNewPassword()); - DeviceMgtAPIUtils.getIntegrationClientService().resetUserInfo(username, - PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantDomain()); + //todo:amalka +// DeviceMgtAPIUtils.getIntegrationClientService().resetUserInfo(username, +// PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantDomain()); return Response.status(Response.Status.OK).entity("UserImpl password by username: " + username + " was successfully changed.").build(); } catch (UserStoreException e) { diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/util/DeviceMgtAPIUtils.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/util/DeviceMgtAPIUtils.java index 6a6f5daf88..fd8b0d9f59 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/util/DeviceMgtAPIUtils.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/util/DeviceMgtAPIUtils.java @@ -46,14 +46,14 @@ import org.apache.commons.httpclient.protocol.ProtocolSocketFactory; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.wso2.carbon.analytics.stream.persistence.stub.EventStreamPersistenceAdminServiceStub; -import org.wso2.carbon.apimgt.integration.client.service.IntegrationClientService; +//import org.wso2.carbon.apimgt.integration.client.service.IntegrationClientService; import org.wso2.carbon.base.ServerConfiguration; import org.wso2.carbon.analytics.api.AnalyticsDataAPI; import org.wso2.carbon.context.CarbonContext; import org.wso2.carbon.context.PrivilegedCarbonContext; import org.wso2.carbon.core.util.Utils; import org.wso2.carbon.device.application.mgt.common.services.SubscriptionManager; -import org.wso2.carbon.device.mgt.analytics.data.publisher.service.EventsPublisherService; +//import org.wso2.carbon.device.mgt.analytics.data.publisher.service.EventsPublisherService; import org.wso2.carbon.device.mgt.common.DeviceIdentifier; import org.wso2.carbon.device.mgt.common.Device; import org.wso2.carbon.device.mgt.common.EnrolmentInfo; @@ -171,7 +171,7 @@ public class DeviceMgtAPIUtils { private static KeyStore trustStore; private static char[] keyStorePassword; - private static IntegrationClientService integrationClientService; +// private static IntegrationClientService integrationClientService; private static MetadataManagementService metadataManagementService; private static OTPManagementService otpManagementService; @@ -374,22 +374,22 @@ public class DeviceMgtAPIUtils { } - public static IntegrationClientService getIntegrationClientService() { - if (integrationClientService == null) { - synchronized (DeviceMgtAPIUtils.class) { - if (integrationClientService == null) { - PrivilegedCarbonContext ctx = PrivilegedCarbonContext.getThreadLocalCarbonContext(); - integrationClientService = (IntegrationClientService) ctx.getOSGiService(IntegrationClientService.class, null); - if (integrationClientService == null) { - String msg = "IntegrationClientService is not initialized"; - log.error(msg); - throw new IllegalStateException(msg); - } - } - } - } - return integrationClientService; - } +// public static IntegrationClientService getIntegrationClientService() { +// if (integrationClientService == null) { +// synchronized (DeviceMgtAPIUtils.class) { +// if (integrationClientService == null) { +// PrivilegedCarbonContext ctx = PrivilegedCarbonContext.getThreadLocalCarbonContext(); +// integrationClientService = (IntegrationClientService) ctx.getOSGiService(IntegrationClientService.class, null); +// if (integrationClientService == null) { +// String msg = "IntegrationClientService is not initialized"; +// log.error(msg); +// throw new IllegalStateException(msg); +// } +// } +// } +// } +// return integrationClientService; +// } /** * Initializing and accessing method for OTPManagementService. @@ -626,17 +626,18 @@ public class DeviceMgtAPIUtils { return username; } - public static EventsPublisherService getEventPublisherService() { - PrivilegedCarbonContext ctx = PrivilegedCarbonContext.getThreadLocalCarbonContext(); - EventsPublisherService eventsPublisherService = - (EventsPublisherService) ctx.getOSGiService(EventsPublisherService.class, null); - if (eventsPublisherService == null) { - String msg = "Event Publisher service has not initialized."; - log.error(msg); - throw new IllegalStateException(msg); - } - return eventsPublisherService; - } + // todo: amalka: commented +// public static EventsPublisherService getEventPublisherService() { +// PrivilegedCarbonContext ctx = PrivilegedCarbonContext.getThreadLocalCarbonContext(); +// EventsPublisherService eventsPublisherService = +// (EventsPublisherService) ctx.getOSGiService(EventsPublisherService.class, null); +// if (eventsPublisherService == null) { +// String msg = "Event Publisher service has not initialized."; +// log.error(msg); +// throw new IllegalStateException(msg); +// } +// return eventsPublisherService; +// } public static String getStreamDefinition(String deviceType, String tenantDomain) { return STREAM_DEFINITION_PREFIX + tenantDomain + "." + deviceType.replace(" ", "."); diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/webapp/META-INF/webapp-classloading.xml b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/webapp/META-INF/webapp-classloading.xml index ed2ed21624..60db8782e9 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/webapp/META-INF/webapp-classloading.xml +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/webapp/META-INF/webapp-classloading.xml @@ -31,5 +31,5 @@ Tomcat environment is the default and every webapps gets it even if they didn't specify it. e.g. If a webapps requires CXF, they will get both Tomcat and CXF. --> - CXF,Carbon + CXF3,Carbon diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.common/pom.xml b/components/device-mgt/org.wso2.carbon.device.mgt.common/pom.xml index eca6c9a3b7..d896782b1a 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.common/pom.xml +++ b/components/device-mgt/org.wso2.carbon.device.mgt.common/pom.xml @@ -50,7 +50,7 @@ javax.xml.bind.annotation; version="${javax.xml.bind.imp.pkg.version}", com.fasterxml.jackson.annotation;version="${jackson-annotations.version}", - org.wso2.carbon.analytics.datasource.commons;version="${carbon.analytics.version.range}", + io.swagger.annotations; version="${swagger.annotations.version}"; resolution:=optional, com.google.gson @@ -96,14 +96,14 @@ org.wso2.orbit.com.fasterxml.jackson.core jackson-annotations - - org.wso2.carbon.analytics - org.wso2.carbon.analytics.api - - - org.wso2.carbon.analytics - org.wso2.carbon.analytics.datasource.commons - + + + + + + + + com.google.code.gson gson diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/pom.xml b/components/device-mgt/org.wso2.carbon.device.mgt.core/pom.xml index d9b34a770d..ae28f57c44 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/pom.xml +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/pom.xml @@ -78,8 +78,8 @@ org.wso2.carbon.device.mgt.core.internal org.apache.axis2.*;version="${axis2.osgi.version.range}", - org.osgi.framework, - org.osgi.service.component, + org.osgi.framework.*;version="${imp.package.version.osgi.framework}", + org.osgi.service.*;version="${imp.package.version.osgi.service}", org.apache.commons.logging, javax.naming, javax.xml.parsers;version="${javax.xml.parsers.import.pkg.version}";resolution:=optional, @@ -90,7 +90,7 @@ org.wso2.carbon.core, org.wso2.carbon.utils.*, org.wso2.carbon.device.mgt.common.*, - org.wso2.carbon.device.mgt.analytics.data.publisher.service, + org.wso2.carbon.user.api, org.wso2.carbon.user.core.*, org.wso2.carbon.registry.core.service, @@ -104,8 +104,8 @@ org.wso2.carbon.ndatasource.core, org.wso2.carbon.ntask.core.*, org.wso2.carbon.ntask.common, - org.apache.catalina, - org.apache.catalina.core, + + org.apache.commons.collections;version="${commons-collections.version.range}", org.wso2.carbon.email.sender.*, io.swagger.annotations.*;resolution:=optional, @@ -166,32 +166,32 @@ org.wso2.carbon.devicemgt org.wso2.carbon.device.mgt.common - - org.wso2.carbon.devicemgt - org.wso2.carbon.device.mgt.analytics.data.publisher - - - org.slf4j - slf4j-api - - - javax.servlet - javax.servlet-api - - - org.wso2.carbon.registry - org.wso2.carbon.registry.indexing - - - org.wso2.carbon.identity.framework - org.wso2.carbon.user.mgt - - - commons-lang - commons-lang - - - + + + + + + + + + + + + + + + + + + + + + + + + + + org.wso2.carbon org.wso2.carbon.logging diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/DeviceManagementConstants.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/DeviceManagementConstants.java index df5f030684..f29afccfcf 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/DeviceManagementConstants.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/DeviceManagementConstants.java @@ -53,6 +53,8 @@ public final class DeviceManagementConstants { public static final String SCOPES_FOR_TOKEN = "perm:device:operations perm:device:publish-event perm:windows:enroll"; public static final String IOT_GATEWAY_HOST = "iot.gateway.host"; public static final String IOT_GATEWAY_HTTPS_PORT = "iot.gateway.https.port"; + public static final String IOT_CORE_HOST = "iot.core.host"; + public static final String IOT_CORE_HTTPS_PORT = "iot.core.https.port"; public static final String APPLICATION_REGISTRATION_API_ENDPOINT = "/api-application-registration/register"; public static final String AUTHORIZATION_HEADER = "authorization"; diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/device/details/mgt/impl/DeviceInformationManagerImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/device/details/mgt/impl/DeviceInformationManagerImpl.java index b152e65a84..396df0f61f 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/device/details/mgt/impl/DeviceInformationManagerImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/device/details/mgt/impl/DeviceInformationManagerImpl.java @@ -23,7 +23,7 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.wso2.carbon.context.CarbonContext; import org.wso2.carbon.context.PrivilegedCarbonContext; -import org.wso2.carbon.device.mgt.analytics.data.publisher.exception.DataPublisherConfigurationException; +//import org.wso2.carbon.device.mgt.analytics.data.publisher.exception.DataPublisherConfigurationException; import org.wso2.carbon.device.mgt.common.Device; import org.wso2.carbon.device.mgt.common.DeviceIdentifier; import org.wso2.carbon.device.mgt.common.configuration.mgt.PlatformConfigurationManagementService; @@ -178,9 +178,9 @@ public class DeviceInformationManagerImpl implements DeviceInformationManager { deviceInfo.getAvailableRAMMemory(), deviceInfo.isPluggedIn() }; - DeviceManagerUtil.getEventPublisherService().publishEvent( - DEVICE_INFO_EVENT_STREAM_DEFINITION, "1.0.0", metaData, new Object[0], payload - ); +// DeviceManagerUtil.getEventPublisherService().publishEvent( +// DEVICE_INFO_EVENT_STREAM_DEFINITION, "1.0.0", metaData, new Object[0], payload +// ); } } catch (TransactionManagementException e) { throw new DeviceDetailsMgtException("Transactional error occurred while adding the device information.", e); @@ -193,8 +193,8 @@ public class DeviceInformationManagerImpl implements DeviceInformationManager { DeviceManagementDAOFactory.rollbackTransaction(); throw new DeviceDetailsMgtException("Error occurred while updating the last update timestamp of the " + "device", e); - } catch (DataPublisherConfigurationException e) { - throw new DeviceDetailsMgtException("Error occurred while publishing the device location information.", e); +// } catch (DataPublisherConfigurationException e) { +// throw new DeviceDetailsMgtException("Error occurred while publishing the device location information.", e); } finally { DeviceManagementDAOFactory.closeConnection(); } @@ -389,9 +389,9 @@ public class DeviceInformationManagerImpl implements DeviceInformationManager { deviceLocation.getBearing(), deviceLocation.getDistance() }; - DeviceManagerUtil.getEventPublisherService().publishEvent( - LOCATION_EVENT_STREAM_DEFINITION, "1.0.0", metaData, new Object[0], payload - ); +// DeviceManagerUtil.getEventPublisherService().publishEvent( +// LOCATION_EVENT_STREAM_DEFINITION, "1.0.0", metaData, new Object[0], payload +// ); } DeviceManagementDAOFactory.commitTransaction(); } catch (TransactionManagementException e) { @@ -403,9 +403,9 @@ public class DeviceInformationManagerImpl implements DeviceInformationManager { } catch (DeviceManagementException e) { DeviceManagementDAOFactory.rollbackTransaction(); throw new DeviceDetailsMgtException("Error occurred while getting the device information.", e); - } catch (DataPublisherConfigurationException e) { - DeviceManagementDAOFactory.rollbackTransaction(); - throw new DeviceDetailsMgtException("Error occurred while publishing the device location information.", e); +// } catch (DataPublisherConfigurationException e) { +// DeviceManagementDAOFactory.rollbackTransaction(); +// throw new DeviceDetailsMgtException("Error occurred while publishing the device location information.", e); } finally { DeviceManagementDAOFactory.closeConnection(); } diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/service/DeviceManagementProviderServiceImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/service/DeviceManagementProviderServiceImpl.java index 7456111973..52a169ef61 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/service/DeviceManagementProviderServiceImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/service/DeviceManagementProviderServiceImpl.java @@ -49,7 +49,7 @@ import org.apache.http.protocol.HTTP; import org.wso2.carbon.CarbonConstants; import org.wso2.carbon.context.CarbonContext; import org.wso2.carbon.context.PrivilegedCarbonContext; -import org.wso2.carbon.device.mgt.analytics.data.publisher.exception.DataPublisherConfigurationException; +//import org.wso2.carbon.device.mgt.analytics.data.publisher.exception.DataPublisherConfigurationException; import org.wso2.carbon.device.mgt.common.ActivityPaginationRequest; import org.wso2.carbon.device.mgt.common.Device; import org.wso2.carbon.device.mgt.common.DeviceEnrollmentInfoNotification; @@ -1964,20 +1964,20 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv operation.getStatus() != null ? operation.getStatus().toString() : null, operation.getOperationResponse() }; - DeviceManagerUtil.getEventPublisherService().publishEvent( - OPERATION_RESPONSE_EVENT_STREAM_DEFINITION, "1.0.0", metaData, new Object[0], payload - ); +// DeviceManagerUtil.getEventPublisherService().publishEvent( +// OPERATION_RESPONSE_EVENT_STREAM_DEFINITION, "1.0.0", metaData, new Object[0], payload +// ); } } } catch (DeviceManagementException e) { String msg = "Error occurred while reading configs."; log.error(msg, e); throw new OperationManagementException(msg, e); - } catch (DataPublisherConfigurationException e) { - String msg = "Error occurred while publishing event."; - log.error(msg, e); - throw new OperationManagementException(msg, e); - } + } //catch (DataPublisherConfigurationException e) { +// String msg = "Error occurred while publishing event."; +// log.error(msg, e); +// throw new OperationManagementException(msg, e); +// } } @Override @@ -2006,20 +2006,20 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv operation.getStatus() != null ? operation.getStatus().toString() : null, operation.getOperationResponse() }; - DeviceManagerUtil.getEventPublisherService().publishEvent( - OPERATION_RESPONSE_EVENT_STREAM_DEFINITION, "1.0.0", metaData, new Object[0], payload - ); +// DeviceManagerUtil.getEventPublisherService().publishEvent( +// OPERATION_RESPONSE_EVENT_STREAM_DEFINITION, "1.0.0", metaData, new Object[0], payload +// ); } } } catch (DeviceManagementException e) { String msg = "Error occurred while reading configs."; log.error(msg, e); throw new OperationManagementException(msg, e); - } catch (DataPublisherConfigurationException e) { - String msg = "Error occurred while publishing event."; - log.error(msg, e); - throw new OperationManagementException(msg, e); - } + } //catch (DataPublisherConfigurationException e) { +// String msg = "Error occurred while publishing event."; +// log.error(msg, e); +// throw new OperationManagementException(msg, e); +// } } @Override diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/util/DeviceManagerUtil.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/util/DeviceManagerUtil.java index 7822754208..13593baf12 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/util/DeviceManagerUtil.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/util/DeviceManagerUtil.java @@ -50,7 +50,7 @@ import org.wso2.carbon.base.MultitenantConstants; import org.wso2.carbon.caching.impl.CacheImpl; import org.wso2.carbon.context.CarbonContext; import org.wso2.carbon.context.PrivilegedCarbonContext; -import org.wso2.carbon.device.mgt.analytics.data.publisher.service.EventsPublisherService; +//import org.wso2.carbon.device.mgt.analytics.data.publisher.service.EventsPublisherService; import org.wso2.carbon.device.mgt.common.AppRegistrationCredentials; import org.wso2.carbon.device.mgt.common.ApplicationRegistration; import org.wso2.carbon.device.mgt.common.ApplicationRegistrationException; @@ -595,17 +595,17 @@ public final class DeviceManagerUtil { return Caching.getCacheManagerFactory().getCacheManager(DeviceManagementConstants.DM_CACHE_MANAGER); } - public static EventsPublisherService getEventPublisherService() { - PrivilegedCarbonContext ctx = PrivilegedCarbonContext.getThreadLocalCarbonContext(); - EventsPublisherService eventsPublisherService = - (EventsPublisherService) ctx.getOSGiService(EventsPublisherService.class, null); - if (eventsPublisherService == null) { - String msg = "Event Publisher service has not initialized."; - log.error(msg); - throw new IllegalStateException(msg); - } - return eventsPublisherService; - } +// public static EventsPublisherService getEventPublisherService() { +// PrivilegedCarbonContext ctx = PrivilegedCarbonContext.getThreadLocalCarbonContext(); +// EventsPublisherService eventsPublisherService = +// (EventsPublisherService) ctx.getOSGiService(EventsPublisherService.class, null); +// if (eventsPublisherService == null) { +// String msg = "Event Publisher service has not initialized."; +// log.error(msg); +// throw new IllegalStateException(msg); +// } +// return eventsPublisherService; +// } /** * Retrieve EventConfigurationProviderService osgi service component diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.extensions/pom.xml b/components/device-mgt/org.wso2.carbon.device.mgt.extensions/pom.xml index 43353e1468..11c9471e76 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.extensions/pom.xml +++ b/components/device-mgt/org.wso2.carbon.device.mgt.extensions/pom.xml @@ -178,15 +178,15 @@ javax.xml.stream, javax.xml.parsers;resolution:=optional, org.apache.commons.lang, - org.osgi.service.component, + org.osgi.framework.*;version="${imp.package.version.osgi.framework}", + org.osgi.service.*;version="${imp.package.version.osgi.service}", org.w3c.dom, org.wso2.carbon.ndatasource.core, org.wso2.carbon.registry.core.service, org.wso2.carbon.utils.dbcreator, org.wso2.carbon.utils.multitenancy, org.wso2.carbon.device.mgt.core.service, - com.google.gson, - org.osgi.framework + com.google.gson org.wso2.carbon.device.mgt.extensions.pull.notification, org.wso2.carbon.device.mgt.extensions.pull.notification.* diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.url.printer/pom.xml b/components/device-mgt/org.wso2.carbon.device.mgt.url.printer/pom.xml index b3bef7291a..744abc8ba1 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.url.printer/pom.xml +++ b/components/device-mgt/org.wso2.carbon.device.mgt.url.printer/pom.xml @@ -61,8 +61,8 @@ IoT Server Impl Bundle org.wso2.carbon.device.mgt.url.printer.internal - org.osgi.framework, - org.osgi.service.component, + org.osgi.framework.*;version="${imp.package.version.osgi.framework}", + org.osgi.service.*;version="${imp.package.version.osgi.service}", org.apache.commons.logging, org.apache.axis2.*;version="${axis2.osgi.version.range}", org.wso2.carbon.core, diff --git a/components/device-mgt/pom.xml b/components/device-mgt/pom.xml index 2d489faa9e..709e09d6bc 100644 --- a/components/device-mgt/pom.xml +++ b/components/device-mgt/pom.xml @@ -38,9 +38,9 @@ org.wso2.carbon.device.mgt.extensions org.wso2.carbon.device.mgt.ui org.wso2.carbon.device.mgt.api - org.wso2.carbon.device.mgt.analytics.data.publisher + org.wso2.carbon.device.mgt.url.printer - org.wso2.carbon.device.mgt.analytics.wsproxy + io.entgra.carbon.device.mgt.config.api diff --git a/components/heartbeat-management/io.entgra.server.bootup.heartbeat.beacon/pom.xml b/components/heartbeat-management/io.entgra.server.bootup.heartbeat.beacon/pom.xml index 70cdb93216..65b62fca38 100644 --- a/components/heartbeat-management/io.entgra.server.bootup.heartbeat.beacon/pom.xml +++ b/components/heartbeat-management/io.entgra.server.bootup.heartbeat.beacon/pom.xml @@ -53,20 +53,20 @@ org.apache.axis2.*;version="${axis2.osgi.version.range}", org.apache.axiom.*; version="${axiom.osgi.version.range}", - org.osgi.framework, - org.osgi.service.component, + org.osgi.framework.*;version="${imp.package.version.osgi.framework}", + org.osgi.service.*;version="${imp.package.version.osgi.service}", org.apache.commons.logging, javax.xml.parsers;version="${javax.xml.parsers.import.pkg.version}";resolution:=optional, org.wso2.carbon.context, org.wso2.carbon.utils.*, org.wso2.carbon.ndatasource.core, org.w3c.dom, - org.apache.velocity;version="${velocity.version}", - org.apache.velocity.app;version="${velocity.version}", - org.apache.velocity.context;version="${velocity.version}", - org.apache.velocity.exception;version="${velocity.version}", - org.apache.velocity.runtime.resource;version="${velocity.version}", - org.apache.velocity.runtime.resource.loader;version="${velocity.version}", + + + + + + org.apache.commons.io, org.apache.axis2.transport.mail, org.apache.commons.collections, @@ -149,10 +149,14 @@ org.apache.axis2.wso2 axis2 - - org.wso2.orbit.org.apache.velocity - velocity - + + + + + + + + commons-io.wso2 commons-io diff --git a/components/identity-extensions/org.wso2.carbon.device.mgt.oauth.extensions/pom.xml b/components/identity-extensions/org.wso2.carbon.device.mgt.oauth.extensions/pom.xml index ae46c74805..27de8ac3a6 100644 --- a/components/identity-extensions/org.wso2.carbon.device.mgt.oauth.extensions/pom.xml +++ b/components/identity-extensions/org.wso2.carbon.device.mgt.oauth.extensions/pom.xml @@ -87,10 +87,11 @@ org.wso2.carbon.device.mgt.oauth.extensions.* - org.wso2.carbon.identity.oauth2.grant.jwt;version="${carbon.identity.jwt.grant.version.range}", + org.apache.commons.lang, org.apache.commons.logging, - org.osgi.service.component, + org.osgi.framework.*;version="${imp.package.version.osgi.framework}", + org.osgi.service.*;version="${imp.package.version.osgi.service}", org.wso2.carbon.identity.application.common.model;version="${carbon.identity.framework.version.range}", org.wso2.carbon.identity.application.common;version="${carbon.identity.framework.version.range}", org.wso2.carbon.identity.application.mgt.*;version="${carbon.identity.framework.version.range}", @@ -113,6 +114,10 @@ org.apache.oltu.oauth2.common.validators, org.apache.commons.lang3.tuple, + + + + diff --git a/components/identity-extensions/org.wso2.carbon.device.mgt.oauth.extensions/src/main/java/org/wso2/carbon/device/mgt/oauth/extensions/handlers/grant/AccessTokenGrantHandler.java b/components/identity-extensions/org.wso2.carbon.device.mgt.oauth.extensions/src/main/java/org/wso2/carbon/device/mgt/oauth/extensions/handlers/grant/AccessTokenGrantHandler.java index 1153cb0561..4cc7881344 100644 --- a/components/identity-extensions/org.wso2.carbon.device.mgt.oauth.extensions/src/main/java/org/wso2/carbon/device/mgt/oauth/extensions/handlers/grant/AccessTokenGrantHandler.java +++ b/components/identity-extensions/org.wso2.carbon.device.mgt.oauth.extensions/src/main/java/org/wso2/carbon/device/mgt/oauth/extensions/handlers/grant/AccessTokenGrantHandler.java @@ -21,7 +21,6 @@ package org.wso2.carbon.device.mgt.oauth.extensions.handlers.grant; import org.apache.commons.lang.StringUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.wso2.carbon.apimgt.keymgt.ScopesIssuer; import org.wso2.carbon.device.mgt.oauth.extensions.handlers.grant.oauth.validator.LocalOAuthValidator; import org.wso2.carbon.device.mgt.oauth.extensions.handlers.grant.oauth.validator.OAuthValidationResponse; import org.wso2.carbon.identity.application.authentication.framework.model.AuthenticatedUser; @@ -58,8 +57,8 @@ public class AccessTokenGrantHandler extends AbstractAuthorizationGrantHandler { } @Override - public boolean validateScope(OAuthTokenReqMessageContext tokReqMsgCtx) { - return ScopesIssuer.getInstance().setScopes(tokReqMsgCtx); + public boolean validateScope(OAuthTokenReqMessageContext tokReqMsgCtx) throws IdentityOAuth2Exception { + return super.validateScope(tokReqMsgCtx); } @Override diff --git a/components/identity-extensions/org.wso2.carbon.device.mgt.oauth.extensions/src/main/java/org/wso2/carbon/device/mgt/oauth/extensions/handlers/grant/ExtendedJWTGrantHandler.java b/components/identity-extensions/org.wso2.carbon.device.mgt.oauth.extensions/src/main/java/org/wso2/carbon/device/mgt/oauth/extensions/handlers/grant/ExtendedJWTGrantHandler.java index 006317f179..f6560e76eb 100644 --- a/components/identity-extensions/org.wso2.carbon.device.mgt.oauth.extensions/src/main/java/org/wso2/carbon/device/mgt/oauth/extensions/handlers/grant/ExtendedJWTGrantHandler.java +++ b/components/identity-extensions/org.wso2.carbon.device.mgt.oauth.extensions/src/main/java/org/wso2/carbon/device/mgt/oauth/extensions/handlers/grant/ExtendedJWTGrantHandler.java @@ -20,14 +20,10 @@ package org.wso2.carbon.device.mgt.oauth.extensions.handlers.grant; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.wso2.carbon.apimgt.keymgt.ScopesIssuer; -import org.wso2.carbon.base.MultitenantConstants; -import org.wso2.carbon.identity.application.authentication.framework.model.AuthenticatedUser; import org.wso2.carbon.identity.oauth2.IdentityOAuth2Exception; import org.wso2.carbon.identity.oauth2.grant.jwt.JWTBearerGrantHandler; import org.wso2.carbon.identity.oauth2.model.RequestParameter; import org.wso2.carbon.identity.oauth2.token.OAuthTokenReqMessageContext; -import org.wso2.carbon.utils.multitenancy.MultitenantUtils; /** * This sets up user with tenant aware username. @@ -38,8 +34,8 @@ public class ExtendedJWTGrantHandler extends JWTBearerGrantHandler { private static final String TENANT_DOMAIN_KEY = "tenantDomain"; @Override - public boolean validateScope(OAuthTokenReqMessageContext tokReqMsgCtx) { - return ScopesIssuer.getInstance().setScopes(tokReqMsgCtx); + public boolean validateScope(OAuthTokenReqMessageContext tokReqMsgCtx) throws IdentityOAuth2Exception { + return super.validateScope(tokReqMsgCtx); } @Override diff --git a/components/identity-extensions/org.wso2.carbon.device.mgt.oauth.extensions/src/main/java/org/wso2/carbon/device/mgt/oauth/extensions/handlers/grant/ExtendedSAML2BearerGrantHandler.java b/components/identity-extensions/org.wso2.carbon.device.mgt.oauth.extensions/src/main/java/org/wso2/carbon/device/mgt/oauth/extensions/handlers/grant/ExtendedSAML2BearerGrantHandler.java index 5caededdaf..2193d2d3ed 100644 --- a/components/identity-extensions/org.wso2.carbon.device.mgt.oauth.extensions/src/main/java/org/wso2/carbon/device/mgt/oauth/extensions/handlers/grant/ExtendedSAML2BearerGrantHandler.java +++ b/components/identity-extensions/org.wso2.carbon.device.mgt.oauth.extensions/src/main/java/org/wso2/carbon/device/mgt/oauth/extensions/handlers/grant/ExtendedSAML2BearerGrantHandler.java @@ -20,7 +20,6 @@ package org.wso2.carbon.device.mgt.oauth.extensions.handlers.grant; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.wso2.carbon.apimgt.keymgt.ScopesIssuer; import org.wso2.carbon.identity.application.authentication.framework.model.AuthenticatedUser; import org.wso2.carbon.identity.oauth2.IdentityOAuth2Exception; import org.wso2.carbon.identity.oauth2.token.OAuthTokenReqMessageContext; @@ -35,8 +34,8 @@ public class ExtendedSAML2BearerGrantHandler extends SAML2BearerGrantHandler { private static Log log = LogFactory.getLog(ExtendedSAML2BearerGrantHandler.class); @Override - public boolean validateScope(OAuthTokenReqMessageContext tokReqMsgCtx) { - return ScopesIssuer.getInstance().setScopes(tokReqMsgCtx); + public boolean validateScope(OAuthTokenReqMessageContext tokReqMsgCtx) throws IdentityOAuth2Exception { + return super.validateScope(tokReqMsgCtx); } @Override diff --git a/components/identity-extensions/org.wso2.carbon.identity.authenticator.backend.oauth/pom.xml b/components/identity-extensions/org.wso2.carbon.identity.authenticator.backend.oauth/pom.xml index 4adb6539ab..abcf3859a3 100644 --- a/components/identity-extensions/org.wso2.carbon.identity.authenticator.backend.oauth/pom.xml +++ b/components/identity-extensions/org.wso2.carbon.identity.authenticator.backend.oauth/pom.xml @@ -109,8 +109,8 @@ org.apache.commons.httpclient, org.apache.commons.logging, org.apache.commons.codec.binary;version="${commons-codec.wso2.osgi.version.range}", - org.osgi.framework, - org.osgi.service.component, + org.osgi.framework.*;version="${imp.package.version.osgi.framework}", + org.osgi.service.*;version="${imp.package.version.osgi.service}", org.wso2.carbon.core.security, org.wso2.carbon.core.services.authentication, org.wso2.carbon.utils.multitenancy, diff --git a/components/identity-extensions/org.wso2.carbon.identity.jwt.client.extension/pom.xml b/components/identity-extensions/org.wso2.carbon.identity.jwt.client.extension/pom.xml index b793b016fa..7e171cd155 100644 --- a/components/identity-extensions/org.wso2.carbon.identity.jwt.client.extension/pom.xml +++ b/components/identity-extensions/org.wso2.carbon.identity.jwt.client.extension/pom.xml @@ -185,8 +185,8 @@ org.wso2.carbon.identity.jwt.client.extension.* - org.osgi.framework, - org.osgi.service.component, + org.osgi.framework.*;version="${imp.package.version.osgi.framework}", + org.osgi.service.*;version="${imp.package.version.osgi.service}", org.wso2.carbon.context, org.wso2.carbon.registry.core, org.wso2.carbon.registry.core.exceptions, diff --git a/components/identity-extensions/pom.xml b/components/identity-extensions/pom.xml index e10007a1ac..de175d9dba 100644 --- a/components/identity-extensions/pom.xml +++ b/components/identity-extensions/pom.xml @@ -33,8 +33,8 @@ http://wso2.org - org.wso2.carbon.identity.authenticator.backend.oauth - org.wso2.carbon.device.mgt.oauth.extensions + + org.wso2.carbon.identity.jwt.client.extension diff --git a/components/policy-mgt/org.wso2.carbon.policy.decision.point/pom.xml b/components/policy-mgt/org.wso2.carbon.policy.decision.point/pom.xml index 89a475e259..0c3d56ebc2 100644 --- a/components/policy-mgt/org.wso2.carbon.policy.decision.point/pom.xml +++ b/components/policy-mgt/org.wso2.carbon.policy.decision.point/pom.xml @@ -35,9 +35,9 @@ Policy Decision Point Bundle org.wso2.carbon.policy.decision.point.internal - org.wso2.carbon.context.*; - org.osgi.framework, - org.osgi.service.component, + org.wso2.carbon.context;version="${carbon.kernel.version.range}", + org.osgi.framework.*;version="${imp.package.version.osgi.framework}", + org.osgi.service.*;version="${imp.package.version.osgi.service}", org.apache.commons.logging, org.wso2.carbon.policy.mgt.common.*, org.wso2.carbon.policy.mgt.core.*, diff --git a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/pom.xml b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/pom.xml index 20aab933b0..38acfd2d93 100644 --- a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/pom.xml +++ b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/pom.xml @@ -53,8 +53,8 @@ Policy Management Core Bundle org.wso2.carbon.policy.mgt.core.internal - org.osgi.framework, - org.osgi.service.component, + org.osgi.framework.*;version="${imp.package.version.osgi.framework}", + org.osgi.service.*;version="${imp.package.version.osgi.service}", org.apache.commons.logging, javax.sql, javax.cache, diff --git a/components/policy-mgt/pom.xml b/components/policy-mgt/pom.xml index dd4d6e80c8..e047aa2278 100644 --- a/components/policy-mgt/pom.xml +++ b/components/policy-mgt/pom.xml @@ -39,7 +39,7 @@ org.wso2.carbon.policy.mgt.core org.wso2.carbon.policy.information.point org.wso2.carbon.policy.decision.point - org.wso2.carbon.complex.policy.decision.point + diff --git a/components/transport-mgt/email-sender/org.wso2.carbon.email.sender.core/pom.xml b/components/transport-mgt/email-sender/org.wso2.carbon.email.sender.core/pom.xml index 1888660a53..6ae1098d84 100644 --- a/components/transport-mgt/email-sender/org.wso2.carbon.email.sender.core/pom.xml +++ b/components/transport-mgt/email-sender/org.wso2.carbon.email.sender.core/pom.xml @@ -53,8 +53,8 @@ org.apache.axis2.*;version="${axis2.osgi.version.range}", org.apache.axiom.*; version="${axiom.osgi.version.range}", - org.osgi.framework, - org.osgi.service.component, + org.osgi.framework.*;version="${imp.package.version.osgi.framework}", + org.osgi.service.*;version="${imp.package.version.osgi.service}", org.apache.commons.logging, javax.xml.parsers;version="${javax.xml.parsers.import.pkg.version}";resolution:=optional, org.wso2.carbon.context, diff --git a/components/transport-mgt/sms-handler/io.entgra.transport.mgt.sms.handler.api/pom.xml b/components/transport-mgt/sms-handler/io.entgra.transport.mgt.sms.handler.api/pom.xml index d4f72461b4..edc6bfedb2 100644 --- a/components/transport-mgt/sms-handler/io.entgra.transport.mgt.sms.handler.api/pom.xml +++ b/components/transport-mgt/sms-handler/io.entgra.transport.mgt.sms.handler.api/pom.xml @@ -87,20 +87,30 @@ - org.apache.cxf - cxf-rt-frontend-jaxws - provided - - - org.apache.cxf - cxf-rt-frontend-jaxrs + org.springframework + spring-web provided org.apache.cxf - cxf-rt-transports-http + cxf-bundle-jaxrs provided + + + + + + + + + + + + + + + javax.servlet javax.servlet-api diff --git a/components/transport-mgt/sms-handler/io.entgra.transport.mgt.sms.handler.api/src/main/webapp/META-INF/webapp-classloading.xml b/components/transport-mgt/sms-handler/io.entgra.transport.mgt.sms.handler.api/src/main/webapp/META-INF/webapp-classloading.xml index d0d7a01621..c0925583a3 100644 --- a/components/transport-mgt/sms-handler/io.entgra.transport.mgt.sms.handler.api/src/main/webapp/META-INF/webapp-classloading.xml +++ b/components/transport-mgt/sms-handler/io.entgra.transport.mgt.sms.handler.api/src/main/webapp/META-INF/webapp-classloading.xml @@ -31,5 +31,5 @@ Tomcat environment is the default and every webapps gets it even if they didn't specify it. e.g. If a webapps requires CXF, they will get both Tomcat and CXF. --> - CXF,Carbon + CXF3,Carbon diff --git a/components/ui-request-interceptor/io.entgra.ui.request.interceptor/pom.xml b/components/ui-request-interceptor/io.entgra.ui.request.interceptor/pom.xml index d00ef252ad..783643a999 100644 --- a/components/ui-request-interceptor/io.entgra.ui.request.interceptor/pom.xml +++ b/components/ui-request-interceptor/io.entgra.ui.request.interceptor/pom.xml @@ -99,20 +99,35 @@ - org.apache.cxf - cxf-rt-frontend-jaxws + org.wso2.carbon.devicemgt + org.wso2.carbon.apimgt.application.extension provided - org.apache.cxf - cxf-rt-frontend-jaxrs + org.springframework + spring-web provided org.apache.cxf - cxf-rt-transports-http + cxf-bundle-jaxrs provided + + + + + + + + + + + + + + + javax.servlet javax.servlet-api diff --git a/components/ui-request-interceptor/io.entgra.ui.request.interceptor/src/main/java/io/entgra/ui/request/interceptor/InvokerHandler.java b/components/ui-request-interceptor/io.entgra.ui.request.interceptor/src/main/java/io/entgra/ui/request/interceptor/InvokerHandler.java index 49e0489de3..7bf0861f72 100644 --- a/components/ui-request-interceptor/io.entgra.ui.request.interceptor/src/main/java/io/entgra/ui/request/interceptor/InvokerHandler.java +++ b/components/ui-request-interceptor/io.entgra.ui.request.interceptor/src/main/java/io/entgra/ui/request/interceptor/InvokerHandler.java @@ -73,6 +73,7 @@ public class InvokerHandler extends HttpServlet { private static final long serialVersionUID = -6508020875358160165L; private static AuthData authData; private static String apiEndpoint; + private static String iotsCoreUrl; @Override protected void doPost(HttpServletRequest req, HttpServletResponse resp) { @@ -368,8 +369,14 @@ public class InvokerHandler extends HttpServlet { if (log.isDebugEnabled()) { log.debug("refreshing the token"); } + String iotsCorePort = System.getProperty("iot.core.https.port"); + if (HandlerConstants.HTTP_PROTOCOL.equals(req.getScheme())) { + iotsCorePort = System.getProperty("iot.core.http.port"); + } + iotsCoreUrl = req.getScheme() + HandlerConstants.SCHEME_SEPARATOR + System.getProperty("iot.core.host") + + HandlerConstants.COLON + iotsCorePort; HttpPost tokenEndpoint = new HttpPost( - apiEndpoint + HandlerConstants.API_COMMON_CONTEXT + HandlerConstants.TOKEN_ENDPOINT); + iotsCoreUrl + HandlerConstants.TOKEN_ENDPOINT); HttpSession session = req.getSession(false); if (session == null) { log.error("Couldn't find a session, hence it is required to login and proceed."); diff --git a/components/ui-request-interceptor/io.entgra.ui.request.interceptor/src/main/java/io/entgra/ui/request/interceptor/LoginHandler.java b/components/ui-request-interceptor/io.entgra.ui.request.interceptor/src/main/java/io/entgra/ui/request/interceptor/LoginHandler.java index 133681355b..5a664552b8 100644 --- a/components/ui-request-interceptor/io.entgra.ui.request.interceptor/src/main/java/io/entgra/ui/request/interceptor/LoginHandler.java +++ b/components/ui-request-interceptor/io.entgra.ui.request.interceptor/src/main/java/io/entgra/ui/request/interceptor/LoginHandler.java @@ -35,7 +35,16 @@ import org.apache.http.client.methods.HttpPost; import org.apache.http.entity.ContentType; import org.apache.http.entity.StringEntity; import org.apache.http.protocol.HTTP; +import org.wso2.carbon.apimgt.application.extension.APIManagementProviderService; +import org.wso2.carbon.apimgt.application.extension.APIManagementProviderServiceImpl; +import org.wso2.carbon.apimgt.application.extension.constants.ApiApplicationConstants; +import org.wso2.carbon.apimgt.application.extension.dto.ApiApplicationKey; +import org.wso2.carbon.apimgt.application.extension.exception.APIManagerException; +import org.wso2.carbon.authenticator.stub.AuthenticationAdmin; +import org.wso2.carbon.authenticator.stub.Login; +import org.wso2.carbon.context.PrivilegedCarbonContext; import io.entgra.ui.request.interceptor.beans.ProxyResponse; +import org.wso2.carbon.utils.multitenancy.MultitenantUtils; import javax.servlet.annotation.MultipartConfig; import javax.servlet.annotation.WebServlet; @@ -44,7 +53,9 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import java.io.IOException; +import java.util.ArrayList; import java.util.Base64; +import java.util.List; @MultipartConfig @WebServlet("/login") @@ -56,6 +67,7 @@ public class LoginHandler extends HttpServlet { private static String password; private static String gatewayUrl; private static String uiConfigUrl; + private static String keyManagerUrl; @Override protected void doPost(HttpServletRequest req, HttpServletResponse resp) { @@ -68,26 +80,37 @@ public class LoginHandler extends HttpServlet { httpSession = req.getSession(true); //setting session to expiry in 5 minutes httpSession.setMaxInactiveInterval(Math.toIntExact(HandlerConstants.TIMEOUT)); - + //todo: amalka do we need this remote call? JsonObject uiConfigJsonObject = HandlerUtil.getUIConfigAndPersistInSession(uiConfigUrl, gatewayUrl, httpSession, resp); JsonArray tags = uiConfigJsonObject.get("appRegistration").getAsJsonObject().get("tags").getAsJsonArray(); JsonArray scopes = uiConfigJsonObject.get("scopes").getAsJsonArray(); - HttpPost apiRegEndpoint = new HttpPost(gatewayUrl + HandlerConstants.APP_REG_ENDPOINT); - apiRegEndpoint.setHeader(HttpHeaders.AUTHORIZATION, HandlerConstants.BASIC + Base64.getEncoder() - .encodeToString((username + HandlerConstants.COLON + password).getBytes())); - apiRegEndpoint.setHeader(HTTP.CONTENT_TYPE, ContentType.APPLICATION_JSON.toString()); - apiRegEndpoint.setEntity(HandlerUtil.constructAppRegPayload(tags, HandlerConstants.PUBLISHER_APPLICATION_NAME, username, password)); + List list = new ArrayList(); + for(int i=0; i < tags.size(); i++) { + list.add(tags.get(i).getAsString()); + } - ProxyResponse clientAppResponse = HandlerUtil.execute(apiRegEndpoint); + String[] tagsAsStringArray = list.toArray(new String[list.size()]); - if (clientAppResponse.getCode() == HttpStatus.SC_UNAUTHORIZED) { - HandlerUtil.handleError(resp, clientAppResponse); - return; + String scopeString = HandlerUtil.getScopeString(scopes); + + if (scopeString != null) { + scopeString = scopeString.trim(); + } else { + scopeString = "default"; } - if (clientAppResponse.getCode() == HttpStatus.SC_CREATED && getTokenAndPersistInSession(req, resp, - clientAppResponse.getData(), scopes)) { + + APIManagementProviderService apiManagementProviderService = new APIManagementProviderServiceImpl(); + ApiApplicationKey apiApplicationKey = apiManagementProviderService.generateAndRetrieveApplicationKeys( + HandlerConstants.PUBLISHER_APPLICATION_NAME, + tagsAsStringArray, HandlerConstants.PRODUCTION_KEY, username, false, + ApiApplicationConstants.DEFAULT_VALIDITY_PERIOD, scopeString); + + if (apiApplicationKey != null && getTokenAndPersistInSession(apiApplicationKey.getConsumerKey(), + apiApplicationKey.getConsumerSecret(), req, resp, scopes)) { + log.info("tenantDomain : " + PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantDomain()); + log.info("username : " + PrivilegedCarbonContext.getThreadLocalCarbonContext().getUsername()); ProxyResponse proxyResponse = new ProxyResponse(); proxyResponse.setCode(HttpStatus.SC_OK); HandlerUtil.handleSuccess(resp, proxyResponse); @@ -100,6 +123,8 @@ public class LoginHandler extends HttpServlet { log.error("Error occurred while parsing the response. ", e); } catch (LoginException e) { log.error("Error occurred while getting token data. ", e); + } catch (APIManagerException e) { + log.error("Error occurred while creating application. ", e); } } @@ -107,19 +132,19 @@ public class LoginHandler extends HttpServlet { * Generates token from token endpoint and persists them inside the session * * @param req - {@link HttpServletRequest} - * @param clientAppResult - clientAppResult +// * @param clientAppResult - clientAppResult * @param scopes - scopes defied in the application-mgt.xml * @throws LoginException - login exception throws when getting token result */ - private boolean getTokenAndPersistInSession(HttpServletRequest req, HttpServletResponse resp, - String clientAppResult, JsonArray scopes) throws LoginException { + private boolean getTokenAndPersistInSession(String clientId, String clientSecret, HttpServletRequest req, + HttpServletResponse resp, JsonArray scopes) throws LoginException { JsonParser jsonParser = new JsonParser(); try { - JsonElement jClientAppResult = jsonParser.parse(clientAppResult); - if (jClientAppResult.isJsonObject()) { - JsonObject jClientAppResultAsJsonObject = jClientAppResult.getAsJsonObject(); - String clientId = jClientAppResultAsJsonObject.get("client_id").getAsString(); - String clientSecret = jClientAppResultAsJsonObject.get("client_secret").getAsString(); +// JsonElement jClientAppResult = jsonParser.parse(clientAppResult); + if (clientId != null && clientSecret != null) { +// JsonObject jClientAppResultAsJsonObject = jClientAppResult.getAsJsonObject(); +// String clientId = jClientAppResultAsJsonObject.get("client_id").getAsString(); +// String clientSecret = jClientAppResultAsJsonObject.get("client_secret").getAsString(); String encodedClientApp = Base64.getEncoder() .encodeToString((clientId + HandlerConstants.COLON + clientSecret).getBytes()); @@ -171,12 +196,18 @@ public class LoginHandler extends HttpServlet { if (HandlerConstants.HTTP_PROTOCOL.equals(req.getScheme())) { iotsCorePort = System.getProperty("iot.core.http.port"); } + + String keyManagerPort = System.getProperty("iot.keymanager.https.port"); + username = req.getParameter("username"); password = req.getParameter("password"); gatewayUrl = req.getScheme() + HandlerConstants.SCHEME_SEPARATOR + System.getProperty("iot.gateway.host") + HandlerConstants.COLON + HandlerUtil.getGatewayPort(req.getScheme()); uiConfigUrl = req.getScheme() + HandlerConstants.SCHEME_SEPARATOR + System.getProperty("iot.core.host") + HandlerConstants.COLON + iotsCorePort + HandlerConstants.UI_CONFIG_ENDPOINT; + keyManagerUrl = HandlerConstants.HTTPS_PROTOCOL + HandlerConstants.SCHEME_SEPARATOR + + System.getProperty("iot.keymanager.host") + HandlerConstants.COLON + keyManagerPort; + if (username == null || password == null) { String msg = "Invalid login request. Username or Password is not received for login request."; log.error(msg); @@ -193,7 +224,7 @@ public class LoginHandler extends HttpServlet { * @throws IOException IO exception throws if an error occurred when invoking token endpoint */ private ProxyResponse getTokenResult(String encodedClientApp, JsonArray scopes) throws IOException { - HttpPost tokenEndpoint = new HttpPost(gatewayUrl + HandlerConstants.TOKEN_ENDPOINT); + HttpPost tokenEndpoint = new HttpPost(keyManagerUrl + HandlerConstants.TOKEN_ENDPOINT); tokenEndpoint.setHeader(HttpHeaders.AUTHORIZATION, HandlerConstants.BASIC + encodedClientApp); tokenEndpoint.setHeader(HttpHeaders.CONTENT_TYPE, ContentType.APPLICATION_FORM_URLENCODED.toString()); String scopeString = HandlerUtil.getScopeString(scopes); diff --git a/components/ui-request-interceptor/io.entgra.ui.request.interceptor/src/main/java/io/entgra/ui/request/interceptor/SsoLoginCallbackHandler.java b/components/ui-request-interceptor/io.entgra.ui.request.interceptor/src/main/java/io/entgra/ui/request/interceptor/SsoLoginCallbackHandler.java index 8ee6ec776b..641aa6d990 100644 --- a/components/ui-request-interceptor/io.entgra.ui.request.interceptor/src/main/java/io/entgra/ui/request/interceptor/SsoLoginCallbackHandler.java +++ b/components/ui-request-interceptor/io.entgra.ui.request.interceptor/src/main/java/io/entgra/ui/request/interceptor/SsoLoginCallbackHandler.java @@ -61,7 +61,7 @@ public class SsoLoginCallbackHandler extends HttpServlet { String iotsCoreUrl = req.getScheme() + HandlerConstants.SCHEME_SEPARATOR + System.getProperty("iot.core.host") + HandlerConstants.COLON + iotsCorePort; - HttpPost tokenEndpoint = new HttpPost(gatewayUrl + HandlerConstants.TOKEN_ENDPOINT); + HttpPost tokenEndpoint = new HttpPost(iotsCoreUrl + HandlerConstants.TOKEN_ENDPOINT); tokenEndpoint.setHeader(HttpHeaders.AUTHORIZATION, HandlerConstants.BASIC + session.getAttribute("encodedClientApp")); tokenEndpoint.setHeader(HttpHeaders.CONTENT_TYPE, ContentType.APPLICATION_FORM_URLENCODED.toString()); diff --git a/components/ui-request-interceptor/io.entgra.ui.request.interceptor/src/main/java/io/entgra/ui/request/interceptor/SsoLoginHandler.java b/components/ui-request-interceptor/io.entgra.ui.request.interceptor/src/main/java/io/entgra/ui/request/interceptor/SsoLoginHandler.java index 1ade046d43..23e76b81ae 100644 --- a/components/ui-request-interceptor/io.entgra.ui.request.interceptor/src/main/java/io/entgra/ui/request/interceptor/SsoLoginHandler.java +++ b/components/ui-request-interceptor/io.entgra.ui.request.interceptor/src/main/java/io/entgra/ui/request/interceptor/SsoLoginHandler.java @@ -101,7 +101,7 @@ public class SsoLoginHandler extends HttpServlet { */ private void dynamicClientRegistration(HttpServletRequest req, HttpServletResponse resp) { try { - File userMgtConf = new File("conf/user-mgt.xml"); + File userMgtConf = new File("repository/conf/user-mgt.xml"); DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder dBuilder = dbFactory.newDocumentBuilder(); Document doc = dBuilder.parse(userMgtConf); @@ -136,7 +136,7 @@ public class SsoLoginHandler extends HttpServlet { JsonArray scopes = uiConfigJsonObject.get("scopes").getAsJsonArray(); // Register the client application - HttpPost apiRegEndpoint = new HttpPost(gatewayUrl + HandlerConstants.APP_REG_ENDPOINT); + HttpPost apiRegEndpoint = new HttpPost(iotsCoreUrl + HandlerConstants.APP_REG_ENDPOINT); encodedAdminCredentials = Base64.getEncoder() .encodeToString((adminUsername + HandlerConstants.COLON + adminPassword).getBytes()); apiRegEndpoint.setHeader(HttpHeaders.AUTHORIZATION, HandlerConstants.BASIC + @@ -262,7 +262,7 @@ public class SsoLoginHandler extends HttpServlet { * @throws IOException IO exception throws if an error occurred when invoking token endpoint */ private ProxyResponse getTokenResult(String encodedClientApp) throws IOException { - HttpPost tokenEndpoint = new HttpPost(gatewayUrl + HandlerConstants.TOKEN_ENDPOINT); + HttpPost tokenEndpoint = new HttpPost(iotsCoreUrl + HandlerConstants.TOKEN_ENDPOINT); tokenEndpoint.setHeader(HttpHeaders.AUTHORIZATION, HandlerConstants.BASIC + encodedClientApp); tokenEndpoint.setHeader(HttpHeaders.CONTENT_TYPE, ContentType.APPLICATION_FORM_URLENCODED.toString()); diff --git a/components/ui-request-interceptor/io.entgra.ui.request.interceptor/src/main/java/io/entgra/ui/request/interceptor/UserHandler.java b/components/ui-request-interceptor/io.entgra.ui.request.interceptor/src/main/java/io/entgra/ui/request/interceptor/UserHandler.java index 9686979d53..67b2834516 100644 --- a/components/ui-request-interceptor/io.entgra.ui.request.interceptor/src/main/java/io/entgra/ui/request/interceptor/UserHandler.java +++ b/components/ui-request-interceptor/io.entgra.ui.request.interceptor/src/main/java/io/entgra/ui/request/interceptor/UserHandler.java @@ -41,6 +41,7 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import java.io.IOException; +import java.util.Base64; @MultipartConfig @WebServlet("/user") @@ -52,8 +53,8 @@ public class UserHandler extends HttpServlet { protected void doPost(HttpServletRequest req, HttpServletResponse resp) { try { String serverUrl = - req.getScheme() + HandlerConstants.SCHEME_SEPARATOR + System.getProperty("iot.gateway.host") - + HandlerConstants.COLON + HandlerUtil.getGatewayPort(req.getScheme()); + req.getScheme() + HandlerConstants.SCHEME_SEPARATOR + System.getProperty("iot.core.host") + + HandlerConstants.COLON + HandlerUtil.getCorePort(req.getScheme()); HttpSession httpSession = req.getSession(false); if (httpSession == null) { HandlerUtil.sendUnAuthorizeResponse(resp); @@ -68,26 +69,32 @@ public class UserHandler extends HttpServlet { String accessToken = authData.getAccessToken(); - HttpPost tokenEndpoint = new HttpPost(serverUrl + HandlerConstants.INTROSPECT_ENDPOINT); - tokenEndpoint.setHeader(HttpHeaders.CONTENT_TYPE, ContentType.APPLICATION_FORM_URLENCODED.toString()); - StringEntity tokenEPPayload = new StringEntity("token=" + accessToken, + HttpPost introspectionEndpoint = new HttpPost(serverUrl + HandlerConstants.INTROSPECT_ENDPOINT); + introspectionEndpoint.setHeader(HttpHeaders.CONTENT_TYPE, + ContentType.APPLICATION_FORM_URLENCODED.toString()); + //todo:amalka + String username = "admin"; + String password = "admin"; + introspectionEndpoint.setHeader(HttpHeaders.AUTHORIZATION, HandlerConstants.BASIC + Base64.getEncoder() + .encodeToString((username + HandlerConstants.COLON + password).getBytes())); + StringEntity introspectionPayload = new StringEntity("token=" + accessToken, ContentType.APPLICATION_FORM_URLENCODED); - tokenEndpoint.setEntity(tokenEPPayload); - ProxyResponse tokenStatus = HandlerUtil.execute(tokenEndpoint); + introspectionEndpoint.setEntity(introspectionPayload); + ProxyResponse introspectionStatus = HandlerUtil.execute(introspectionEndpoint); - if (tokenStatus.getExecutorResponse().contains(HandlerConstants.EXECUTOR_EXCEPTION_PREFIX)) { + if (introspectionStatus.getExecutorResponse().contains(HandlerConstants.EXECUTOR_EXCEPTION_PREFIX)) { log.error("Error occurred while invoking the API to get token status."); - HandlerUtil.handleError(resp, tokenStatus); + HandlerUtil.handleError(resp, introspectionStatus); return; } - String tokenData = tokenStatus.getData(); - if (tokenData == null) { + String introspectionData = introspectionStatus.getData(); + if (introspectionData == null) { log.error("Invalid token data is received."); - HandlerUtil.handleError(resp, tokenStatus); + HandlerUtil.handleError(resp, introspectionStatus); return; } JsonParser jsonParser = new JsonParser(); - JsonElement jTokenResult = jsonParser.parse(tokenData); + JsonElement jTokenResult = jsonParser.parse(introspectionData); if (jTokenResult.isJsonObject()) { JsonObject jTokenResultAsJsonObject = jTokenResult.getAsJsonObject(); if (!jTokenResultAsJsonObject.get("active").getAsBoolean()) { diff --git a/components/ui-request-interceptor/io.entgra.ui.request.interceptor/src/main/java/io/entgra/ui/request/interceptor/util/HandlerConstants.java b/components/ui-request-interceptor/io.entgra.ui.request.interceptor/src/main/java/io/entgra/ui/request/interceptor/util/HandlerConstants.java index 3d4255c0aa..bedf62385c 100644 --- a/components/ui-request-interceptor/io.entgra.ui.request.interceptor/src/main/java/io/entgra/ui/request/interceptor/util/HandlerConstants.java +++ b/components/ui-request-interceptor/io.entgra.ui.request.interceptor/src/main/java/io/entgra/ui/request/interceptor/util/HandlerConstants.java @@ -22,7 +22,7 @@ public class HandlerConstants { public static final String PUBLISHER_APPLICATION_NAME = "application-mgt-publisher"; public static final String APP_REG_ENDPOINT = "/api-application-registration/register"; public static final String UI_CONFIG_ENDPOINT = "/api/device-mgt-config/v1.0/configurations/ui-config"; - public static final String TOKEN_ENDPOINT = "/token"; + public static final String TOKEN_ENDPOINT = "/oauth2/token"; public static final String INTROSPECT_ENDPOINT = "/oauth2/introspect"; public static final String AUTHORIZATION_ENDPOINT = "/oauth2/authorize"; public static final String APIM_APPLICATIONS_ENDPOINT = "/api/am/store/v0.12/applications/"; @@ -59,6 +59,7 @@ public class HandlerConstants { public static final String SCHEME_SEPARATOR = "://"; public static final String COLON = ":"; public static final String HTTP_PROTOCOL = "http"; + public static final String HTTPS_PROTOCOL = "https"; public static final String UNDERSCORE = "_"; public static final int INTERNAL_ERROR_CODE = 500; diff --git a/components/ui-request-interceptor/io.entgra.ui.request.interceptor/src/main/java/io/entgra/ui/request/interceptor/util/HandlerUtil.java b/components/ui-request-interceptor/io.entgra.ui.request.interceptor/src/main/java/io/entgra/ui/request/interceptor/util/HandlerUtil.java index 4582468a0c..bc864c03ee 100644 --- a/components/ui-request-interceptor/io.entgra.ui.request.interceptor/src/main/java/io/entgra/ui/request/interceptor/util/HandlerUtil.java +++ b/components/ui-request-interceptor/io.entgra.ui.request.interceptor/src/main/java/io/entgra/ui/request/interceptor/util/HandlerUtil.java @@ -23,6 +23,8 @@ import com.google.gson.JsonArray; import com.google.gson.JsonElement; import com.google.gson.JsonObject; import com.google.gson.JsonParser; +import com.sun.org.apache.xml.internal.serialize.OutputFormat; +import com.sun.org.apache.xml.internal.serialize.XMLSerializer; import org.apache.commons.lang.StringUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -36,12 +38,12 @@ import org.apache.http.entity.ContentType; import org.apache.http.entity.StringEntity; import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.HttpClients; -import org.apache.xml.serialize.OutputFormat; -import org.apache.xml.serialize.XMLSerializer; import org.json.JSONException; import org.json.JSONObject; import org.w3c.dom.Document; import io.entgra.ui.request.interceptor.beans.ProxyResponse; +import org.wso2.carbon.apimgt.application.extension.APIManagementProviderService; +import org.wso2.carbon.context.PrivilegedCarbonContext; import org.xml.sax.SAXException; import javax.servlet.http.HttpServletRequest; @@ -80,6 +82,7 @@ public class HandlerUtil { HandlerConstants.INTERNAL_ERROR_CODE)); return proxyResponse; } else { + int statusCode = response.getStatusLine().getStatusCode(); try (BufferedReader rd = new BufferedReader(new InputStreamReader(response.getEntity().getContent()))) { StringBuilder result = new StringBuilder(); @@ -400,4 +403,16 @@ public class HandlerUtil { return stringOutput; } + + public static APIManagementProviderService getAPIManagementProviderService() { + PrivilegedCarbonContext ctx = PrivilegedCarbonContext.getThreadLocalCarbonContext(); + APIManagementProviderService apiManagementProviderService = + (APIManagementProviderService) ctx.getOSGiService(APIManagementProviderService.class, null); + if (apiManagementProviderService == null) { + String msg = "API management provider service has not initialized."; + log.error(msg); + throw new IllegalStateException(msg); + } + return apiManagementProviderService; + } } diff --git a/components/ui-request-interceptor/io.entgra.ui.request.interceptor/src/main/webapp/META-INF/webapp-classloading.xml b/components/ui-request-interceptor/io.entgra.ui.request.interceptor/src/main/webapp/META-INF/webapp-classloading.xml index cc5b3c66d7..9f50930c4f 100644 --- a/components/ui-request-interceptor/io.entgra.ui.request.interceptor/src/main/webapp/META-INF/webapp-classloading.xml +++ b/components/ui-request-interceptor/io.entgra.ui.request.interceptor/src/main/webapp/META-INF/webapp-classloading.xml @@ -31,5 +31,5 @@ Tomcat environment is the default and every webapps gets it even if they didn't specify it. e.g. If a webapps requires CXF, they will get both Tomcat and CXF. --> - Carbon + CXF3,Carbon diff --git a/components/webapp-authenticator-framework/org.wso2.carbon.webapp.authenticator.framework/pom.xml b/components/webapp-authenticator-framework/org.wso2.carbon.webapp.authenticator.framework/pom.xml index 2d3df3e061..64e71e342d 100644 --- a/components/webapp-authenticator-framework/org.wso2.carbon.webapp.authenticator.framework/pom.xml +++ b/components/webapp-authenticator-framework/org.wso2.carbon.webapp.authenticator.framework/pom.xml @@ -63,15 +63,15 @@ javax.xml.bind.annotation, javax.xml.parsers;version="${javax.xml.parsers.import.pkg.version}";resolution:=optional, javax.xml.validation, - org.apache.catalina, - org.apache.catalina.connector, - org.apache.catalina.util, + + + org.apache.commons.logging, - org.apache.coyote, - org.apache.tomcat.util.buf, - org.apache.tomcat.util.http, - org.osgi.service.component, - org.osgi.framework, + + + + org.osgi.framework.*;version="${imp.package.version.osgi.framework}", + org.osgi.service.*;version="${imp.package.version.osgi.service}", org.w3c.dom, org.wso2.carbon.context, org.wso2.carbon.core.util, @@ -79,7 +79,7 @@ org.wso2.carbon.identity.core.util; version="${carbon.identity.imp.pkg.version}", org.wso2.carbon.identity.oauth2.*; version="${carbon.identity-inbound-auth-oauth.imp.pkg.version}", - org.wso2.carbon.tomcat.ext.valves, + org.wso2.carbon.user.api, org.wso2.carbon.user.core.service, org.wso2.carbon.user.core.tenant, @@ -106,8 +106,8 @@ org.apache.commons.pool.impl, org.apache.http.conn, org.apache.http.impl.conn, - javax.xml.soap; version="${javax.xml.soap.imp.pkg.version}", - javax.xml.stream, + + org.apache.axiom.*; version="${axiom.osgi.version.range}", org.wso2.carbon.registry.core.*, org.wso2.carbon.registry.common.*;version="${carbon.registry.imp.pkg.version.range}", diff --git a/features/apimgt-extensions/org.wso2.carbon.apimgt.integration.client.feature/pom.xml b/features/apimgt-extensions/org.wso2.carbon.apimgt.integration.client.feature/pom.xml index a934c7dc4c..401ad66f4e 100644 --- a/features/apimgt-extensions/org.wso2.carbon.apimgt.integration.client.feature/pom.xml +++ b/features/apimgt-extensions/org.wso2.carbon.apimgt.integration.client.feature/pom.xml @@ -107,9 +107,9 @@ org.wso2.carbon.devicemgt:org.wso2.carbon.apimgt.integration.client:${project.version} - - org.wso2.carbon.devicemgt:org.wso2.carbon.apimgt.integration.generated.client:${project.version} - + + + diff --git a/features/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher.feature/src/main/resources/conf/webapp-publisher-config.xml b/features/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher.feature/src/main/resources/conf/webapp-publisher-config.xml index 067a6af7f8..ff54fb9cb8 100644 --- a/features/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher.feature/src/main/resources/conf/webapp-publisher-config.xml +++ b/features/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher.feature/src/main/resources/conf/webapp-publisher-config.xml @@ -24,7 +24,7 @@ - https://${iot.core.host}:${iot.core.https.port} + https://localhost:9443 true diff --git a/features/apimgt-extensions/pom.xml b/features/apimgt-extensions/pom.xml index 201296d7d7..956fdf8d49 100644 --- a/features/apimgt-extensions/pom.xml +++ b/features/apimgt-extensions/pom.xml @@ -35,10 +35,10 @@ http://wso2.org - org.wso2.carbon.apimgt.integration.client.feature + org.wso2.carbon.apimgt.webapp.publisher.feature org.wso2.carbon.apimgt.application.extension.feature - org.wso2.carbon.apimgt.handler.server.feature + diff --git a/features/application-mgt/org.wso2.carbon.device.application.mgt.server.feature/src/main/resources/conf/datasources/application-mgt-datasources.xml b/features/application-mgt/org.wso2.carbon.device.application.mgt.server.feature/src/main/resources/conf/datasources/application-mgt-datasources.xml index ddeeaa5005..9e91286a79 100644 --- a/features/application-mgt/org.wso2.carbon.device.application.mgt.server.feature/src/main/resources/conf/datasources/application-mgt-datasources.xml +++ b/features/application-mgt/org.wso2.carbon.device.application.mgt.server.feature/src/main/resources/conf/datasources/application-mgt-datasources.xml @@ -30,7 +30,7 @@ - jdbc:h2:repository/database/WSO2DM_APPM_DB;DB_CLOSE_ON_EXIT=FALSE + jdbc:h2:./repository/database/WSO2DM_APPM_DB;DB_CLOSE_ON_EXIT=FALSE wso2carbon wso2carbon org.h2.Driver diff --git a/features/certificate-mgt/pom.xml b/features/certificate-mgt/pom.xml index bce727f0f2..29ce4363df 100644 --- a/features/certificate-mgt/pom.xml +++ b/features/certificate-mgt/pom.xml @@ -27,7 +27,6 @@ 4.0.0 - org.wso2.carbon.devicemgt certificate-mgt-feature 4.1.16-SNAPSHOT pom diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.basics.feature/pom.xml b/features/device-mgt/org.wso2.carbon.device.mgt.basics.feature/pom.xml index 055fcd0a57..845938c469 100644 --- a/features/device-mgt/org.wso2.carbon.device.mgt.basics.feature/pom.xml +++ b/features/device-mgt/org.wso2.carbon.device.mgt.basics.feature/pom.xml @@ -43,34 +43,34 @@ org.wso2.carbon.devicemgt org.wso2.carbon.device.mgt.common - - org.wso2.carbon.devicemgt - org.wso2.carbon.device.mgt.analytics.data.publisher - - - org.wso2.carbon.registry - org.wso2.carbon.registry.indexing - - - org.wso2.carbon.analytics-common - org.wso2.carbon.event.receiver.stub - - - org.wso2.carbon.analytics-common - org.wso2.carbon.event.stream.stub - - - org.wso2.carbon.analytics-common - org.wso2.carbon.event.publisher.stub - - - org.wso2.carbon.analytics-common - org.wso2.carbon.event.stream.persistence.stub - - - org.wso2.orbit.org.scannotation - scannotation - + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -127,27 +127,27 @@ org.wso2.carbon.devicemgt:org.wso2.carbon.device.mgt.common:${carbon.device.mgt.version} - - org.wso2.carbon.devicemgt:org.wso2.carbon.device.mgt.analytics.data.publisher:${carbon.device.mgt.version} - - - org.wso2.carbon.analytics-common:org.wso2.carbon.event.receiver.stub:${carbon.analytics.common.version} - - - org.wso2.carbon.analytics-common:org.wso2.carbon.event.stream.stub:${carbon.analytics.common.version} - - - org.wso2.carbon.analytics-common:org.wso2.carbon.event.publisher.stub:${carbon.analytics.common.version} - - - org.wso2.carbon.analytics-common:org.wso2.carbon.event.stream.persistence.stub:${carbon.analytics.common.version} - - - org.wso2.orbit.com.fasterxml.jackson.core:jackson-annotations:${jackson-annotations.version} - - - org.wso2.orbit.org.scannotation:scannotation:${scannotation.version} - + + + + + + + + + + + + + + + + + + + + + diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.basics.feature/src/main/resources/apis/admin--OAuth2TokenManagement.xml b/features/device-mgt/org.wso2.carbon.device.mgt.basics.feature/src/main/resources/apis/admin--OAuth2TokenManagement.xml index 9e7e2fd601..23c74aaedb 100644 --- a/features/device-mgt/org.wso2.carbon.device.mgt.basics.feature/src/main/resources/apis/admin--OAuth2TokenManagement.xml +++ b/features/device-mgt/org.wso2.carbon.device.mgt.basics.feature/src/main/resources/apis/admin--OAuth2TokenManagement.xml @@ -20,7 +20,7 @@ - + diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.basics.feature/src/main/resources/apis/admin--UserManagementValidateUser.xml b/features/device-mgt/org.wso2.carbon.device.mgt.basics.feature/src/main/resources/apis/admin--UserManagementValidateUser.xml index 5b8ee2f562..7d26b7b857 100644 --- a/features/device-mgt/org.wso2.carbon.device.mgt.basics.feature/src/main/resources/apis/admin--UserManagementValidateUser.xml +++ b/features/device-mgt/org.wso2.carbon.device.mgt.basics.feature/src/main/resources/apis/admin--UserManagementValidateUser.xml @@ -20,7 +20,7 @@ - + diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.basics.feature/src/main/resources/conf/mdm-ui-config.xml b/features/device-mgt/org.wso2.carbon.device.mgt.basics.feature/src/main/resources/conf/mdm-ui-config.xml index a0ba89e8b7..5bbf9e040b 100644 --- a/features/device-mgt/org.wso2.carbon.device.mgt.basics.feature/src/main/resources/conf/mdm-ui-config.xml +++ b/features/device-mgt/org.wso2.carbon.device.mgt.basics.feature/src/main/resources/conf/mdm-ui-config.xml @@ -19,7 +19,7 @@ true - true + false application_management diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.extensions.feature/pom.xml b/features/device-mgt/org.wso2.carbon.device.mgt.extensions.feature/pom.xml index 3c4216dfb9..0222243bf9 100644 --- a/features/device-mgt/org.wso2.carbon.device.mgt.extensions.feature/pom.xml +++ b/features/device-mgt/org.wso2.carbon.device.mgt.extensions.feature/pom.xml @@ -87,8 +87,8 @@ org.wso2.carbon.core.server:${carbon.kernel.version} - org.wso2.carbon.governance.metadata.server:${carbon.governance.version} - + + diff --git a/features/device-mgt/pom.xml b/features/device-mgt/pom.xml index 28f576bf2e..1c4c45ab71 100644 --- a/features/device-mgt/pom.xml +++ b/features/device-mgt/pom.xml @@ -39,7 +39,7 @@ org.wso2.carbon.device.mgt.api.feature org.wso2.carbon.device.mgt.feature org.wso2.carbon.device.mgt.extensions.feature - org.wso2.carbon.device.mgt.analytics.feature + diff --git a/features/heartbeat-management/io.entgra.server.heart.beat.feature/pom.xml b/features/heartbeat-management/io.entgra.server.heart.beat.feature/pom.xml index db6da06d04..6d17103c21 100644 --- a/features/heartbeat-management/io.entgra.server.heart.beat.feature/pom.xml +++ b/features/heartbeat-management/io.entgra.server.heart.beat.feature/pom.xml @@ -73,14 +73,14 @@ org.codehaus.woodstox wstx-asl - - org.wso2.carbon.devicemgt - org.wso2.carbon.device.mgt.analytics.data.publisher - - - org.wso2.carbon.analytics - org.wso2.carbon.analytics.api - + + + + + + + + diff --git a/pom.xml b/pom.xml index 39f8ff4e85..bfa525b9df 100644 --- a/pom.xml +++ b/pom.xml @@ -27,7 +27,6 @@ WSO2 Carbon - Device Management - Parent http://wso2.org WSO2 Connected Device Manager Components - org.wso2 wso2 @@ -43,21 +42,23 @@ components/application-mgt components/policy-mgt components/certificate-mgt - components/webapp-authenticator-framework components/ui-request-interceptor components/transport-mgt features/device-mgt features/apimgt-extensions features/application-mgt features/policy-mgt - features/webapp-authenticator-framework features/certificate-mgt - features/oauth-extensions features/heartbeat-management features/ui-request-interceptor features/jwt-client features/device-mgt-extensions features/transport-mgt + + + + + @@ -245,16 +246,16 @@ org.wso2.carbon.apimgt.webapp.publisher ${carbon.device.mgt.version} - - org.wso2.carbon.devicemgt - org.wso2.carbon.apimgt.integration.client - ${carbon.device.mgt.version} - - - org.wso2.carbon.devicemgt - org.wso2.carbon.apimgt.integration.generated.client - ${carbon.device.mgt.version} - + + + + + + + + + + org.wso2.carbon.devicemgt org.wso2.carbon.apimgt.annotations @@ -286,11 +287,11 @@ org.wso2.carbon.device.mgt.analytics.data.publisher ${carbon.device.mgt.version} - - org.wso2.carbon.devicemgt - org.wso2.carbon.device.mgt.analytics.wsproxy - ${carbon.device.mgt.version} - + + + + + org.wso2.carbon.devicemgt org.wso2.carbon.device.mgt.server.feature @@ -331,11 +332,11 @@ ${carbon.device.mgt.version} - - org.wso2.carbon.devicemgt - org.wso2.carbon.apimgt.handlers - ${carbon.device.mgt.version} - + + + + + org.wso2.carbon.devicemgt org.wso2.carbon.device.application.mgt.server.feature @@ -832,7 +833,7 @@ org.wso2.carbon org.wso2.carbon.logging - ${carbon.kernel.version} + 4.4.9 org.wso2.carbon @@ -1153,17 +1154,17 @@ - - org.apache.cxf - cxf-rt-bindings-http - ${cxf.bindings.version} - - - org.codehaus.jra - jra - - - + + + + + + + + + + + org.apache.cxf cxf-rt-rs-extension-providers @@ -1347,11 +1348,21 @@ gson ${google.gson.version} + + org.wso2.orbit.com.squareup.okhttp + okhttp + ${okhttp.wso2.version} + com.squareup.okhttp3 okhttp ${squareup.okhttp3.version} + + org.wso2.orbit.com.squareup.okio + okio + ${okio.wso2.version} + com.squareup.okio okio @@ -1794,6 +1805,16 @@ commons-validator ${apache.validator.version} + + org.springframework + spring-web + ${spring-web.version} + + + org.apache.cxf + cxf-bundle-jaxrs + ${cxf-bundle-package.version} + @@ -2054,9 +2075,9 @@ 2.2.1 6.1.1 - 4.4.26 - [4.4.0, 5.0.0) - 1.5.4 + 4.6.1 + [4.6.0, 5.0.0) + 5.1.2 1.3 3.1.3 @@ -2097,16 +2118,16 @@ 4.7.15 - 5.11.148 - [5.2.0, 6.0.0) - 5.6.63 + 5.18.187 + [5.2.0, 7.0.0) + 6.4.111 5.4.6 - 1.0.10 - [1.0.10, 2.0.0) + 1.0.31 + [1.0.31, 2.0.0) [5.7.0, 6.0.0) - [5.2.0, 6.0.0) - [5.1.0, 6.0.0) + [5.2.0, 7.0.0) + [5.1.0, 7.0.0) 4.6.11 @@ -2131,8 +2152,8 @@ [2.6.0,3.0.0) - 6.2.201 - (6.0.0,7.0.0] + 9.0.5 + (6.0.0,10.0.0] 5.1.37 @@ -2142,20 +2163,20 @@ 2.1.23 - 4.6.28 - 4.6.8 - [4.4.8, 5.0.0) + 4.7.38 + ${carbon.registry.version} + [4.7.0, 5.0.0) - 3.2.0 - 2.5.11 + 3.3.6 + 1.1.wso2v1 1.9.0 - 1.52.0.wso2v1 - 1.52.0.wso2v2 - [1.52.0,1.60.0) + 1.60.0.wso2v1 + 1.60.0.wso2v1 + [1.52.0,1.70.0) 2.3.0.wso2v2 @@ -2166,7 +2187,9 @@ 3.0.0.wso2v1 1.3 2.3.1 - 3.8.1 + 4.6.0 + 4.2.0.wso2v1 + 2.4.0.wso2v1 1.13.0 9.3.1 1.1.1 @@ -2282,6 +2305,12 @@ 7.0.85 1.0 1.13.1 + + 5.1.2.RELEASE + 2.7.18 + + [1.6.0, 2.0.0) + [1.2.0,1.3.0)