Merge branch 'change/api/isExistingApp' into 'master'

Change API that checks if an appName already exists, to accept the appName as query parameter

See merge request entgra/carbon-device-mgt!824
feature/traccar-sync
Pahansith Gunathilake 3 years ago
commit d2df228e8b

@ -683,7 +683,7 @@ public interface ApplicationManagementPublisherAPI {
);
@GET
@Path("/device-type/{deviceType}/app-name/{appName}")
@Path("/device-type/{deviceType}/app-name")
@ApiOperation(
httpMethod = "GET",
value = "Check the application existence",
@ -723,7 +723,7 @@ public interface ApplicationManagementPublisherAPI {
name = "appName",
value = "Application name",
required = true)
@PathParam("appName") String appName
@QueryParam("appName") String appName
);
@PUT

@ -390,11 +390,16 @@ public class ApplicationManagementPublisherAPIImpl implements ApplicationManagem
@Override
@GET
@Path("/device-type/{deviceType}/app-name/{appName}")
@Path("/device-type/{deviceType}/app-name")
public Response isExistingApplication(
@PathParam("deviceType") String deviceType,
@PathParam("appName") String appName ){
@QueryParam("appName") String appName){
try {
if (appName == null) {
String msg = "Invalid app name, appName query param cannot be empty/null.";
log.error(msg);
return Response.status(Response.Status.BAD_REQUEST).build();
}
ApplicationManager applicationManager = APIUtil.getApplicationManager();
if (applicationManager.isExistingAppName(appName, deviceType)) {
return Response.status(Response.Status.CONFLICT).build();

Loading…
Cancel
Save