|
|
|
@ -172,17 +172,19 @@ public final class DeviceManagerUtil {
|
|
|
|
|
APIIdentifier id = new APIIdentifier(config.getOwner(), config.getName(), config.getVersion());
|
|
|
|
|
API api = new API(id);
|
|
|
|
|
try {
|
|
|
|
|
api.setContext(config.getContext());
|
|
|
|
|
api.setUrl(config.getEndpoint());
|
|
|
|
|
api.setUriTemplates(getURITemplates(config.getEndpoint(),
|
|
|
|
|
APIConstants.AUTH_APPLICATION_OR_USER_LEVEL_TOKEN));
|
|
|
|
|
api.setVisibility(APIConstants.API_GLOBAL_VISIBILITY);
|
|
|
|
|
api.addAvailableTiers(provider.getTiers());
|
|
|
|
|
api.setEndpointSecured(false);
|
|
|
|
|
api.setStatus(APIStatus.PUBLISHED);
|
|
|
|
|
api.setTransports(config.getTransports());
|
|
|
|
|
|
|
|
|
|
provider.addAPI(api);
|
|
|
|
|
if(!provider.isAPIAvailable(id)) {
|
|
|
|
|
api.setContext(config.getContext());
|
|
|
|
|
api.setUrl(config.getEndpoint());
|
|
|
|
|
api.setUriTemplates(getURITemplates(config.getEndpoint(),
|
|
|
|
|
APIConstants.AUTH_APPLICATION_OR_USER_LEVEL_TOKEN));
|
|
|
|
|
api.setVisibility(APIConstants.API_GLOBAL_VISIBILITY);
|
|
|
|
|
api.addAvailableTiers(provider.getTiers());
|
|
|
|
|
api.setEndpointSecured(false);
|
|
|
|
|
api.setStatus(APIStatus.PUBLISHED);
|
|
|
|
|
api.setTransports(config.getTransports());
|
|
|
|
|
|
|
|
|
|
provider.addAPI(api);
|
|
|
|
|
}
|
|
|
|
|
} catch (APIManagementException e) {
|
|
|
|
|
throw new DeviceManagementException("Error occurred while registering the API", e);
|
|
|
|
|
}
|
|
|
|
|