mirror of
https://repository.entgra.net/community/device-mgt-core.git
synced 2025-10-06 02:01:45 +00:00
adding existing API check before publishing
This commit is contained in:
parent
d242b3ffe1
commit
2002c92032
@ -172,6 +172,7 @@ public final class DeviceManagerUtil {
|
||||
APIIdentifier id = new APIIdentifier(config.getOwner(), config.getName(), config.getVersion());
|
||||
API api = new API(id);
|
||||
try {
|
||||
if(!provider.isAPIAvailable(id)) {
|
||||
api.setContext(config.getContext());
|
||||
api.setUrl(config.getEndpoint());
|
||||
api.setUriTemplates(getURITemplates(config.getEndpoint(),
|
||||
@ -183,6 +184,7 @@ public final class DeviceManagerUtil {
|
||||
api.setTransports(config.getTransports());
|
||||
|
||||
provider.addAPI(api);
|
||||
}
|
||||
} catch (APIManagementException e) {
|
||||
throw new DeviceManagementException("Error occurred while registering the API", e);
|
||||
}
|
||||
|
||||
@ -21,7 +21,7 @@
|
||||
<API>
|
||||
<Name>appmanager</Name>
|
||||
<Owner>admin</Owner>
|
||||
<Context>devices</Context>
|
||||
<Context>/devices</Context>
|
||||
<Version>1.0.0</Version>
|
||||
<Endpoint>http://localhost:9763/</Endpoint>
|
||||
<Transports>http,https</Transports>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user