diff --git a/apps/dnet-is-application/src/main/java/eu/dnetlib/openaire/dsm/DsmAjaxController.java b/apps/dnet-is-application/src/main/java/eu/dnetlib/openaire/dsm/DsmAjaxController.java index e4cd5b2d..c472e057 100644 --- a/apps/dnet-is-application/src/main/java/eu/dnetlib/openaire/dsm/DsmAjaxController.java +++ b/apps/dnet-is-application/src/main/java/eu/dnetlib/openaire/dsm/DsmAjaxController.java @@ -11,8 +11,10 @@ import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import eu.dnetlib.common.controller.AbstractDnetController; +import eu.dnetlib.data.openaire.dsm.model.Api; import eu.dnetlib.data.openaire.dsm.model.BrowseTerm; import eu.dnetlib.data.openaire.dsm.model.view.SimpleDsWithApis; +import eu.dnetlib.is.errors.DsmException; import eu.dnetlib.openaire.dsm.utils.DsmBrowsableFields; @RestController @@ -40,4 +42,9 @@ public class DsmAjaxController extends AbstractDnetController { return dsmService.search(value, page, size); } + @GetMapping("/api") + public Api findApi(@RequestParam final String id) throws DsmException { + return dsmService.findApi(id); + } + } diff --git a/apps/dnet-is-application/src/main/java/eu/dnetlib/openaire/dsm/DsmService.java b/apps/dnet-is-application/src/main/java/eu/dnetlib/openaire/dsm/DsmService.java index 30692dde..a01c0c4c 100644 --- a/apps/dnet-is-application/src/main/java/eu/dnetlib/openaire/dsm/DsmService.java +++ b/apps/dnet-is-application/src/main/java/eu/dnetlib/openaire/dsm/DsmService.java @@ -517,4 +517,8 @@ public class DsmService { return simpleDsWithApisRepository.search(value, PageRequest.of(page, size)); } + public Api findApi(final String id) throws DsmException { + return apiRepository.findById(id).orElseThrow(() -> new DsmException("Api not found. ID: " + id)); + } + } diff --git a/apps/dnet-is-application/src/main/resources/static/dsm/api.html b/apps/dnet-is-application/src/main/resources/static/dsm/api.html new file mode 100644 index 00000000..04185ca0 --- /dev/null +++ b/apps/dnet-is-application/src/main/resources/static/dsm/api.html @@ -0,0 +1,7 @@ +