-
Notifications
You must be signed in to change notification settings - Fork 1
Using Swagger UI
###Swagger UI###
Repox has a embedded a customised version of Swagger UI for REST API documentation and easy using through it's interface.
To setup the Swagger-UI url's you have to update the class /repox-server-rest-jersey/src/main/java/org/theeuropeanlibrary/repox/rest/configuration/SwaggerBootstrap.java. What you need to update before building repox is the following section:
BeanConfig beanConfig = new BeanConfig();
beanConfig.setTitle("Swagger UI For Repox");
beanConfig.setDescription("This is a sample customised Swagger UI used for Repox.");
beanConfig.setVersion("1.0.0");
beanConfig.setBasePath("http://localhost:8080/repox/rest");
beanConfig.setResourcePackage("org.theeuropeanlibrary.repox.rest.servlets");
beanConfig.setScan(true);
The important setter is the setBasePath("http://localhost:8080/repox/rest") which needs the value of <app-context>/<api-context> if you have changed them. This is basically used from the Server integration that dynamically provides JSON at runtime and needs this URL to be able to access the actual rest api endpoint.
Access the Swagger ui through the context /<app-name>/gui/index.html, add your api url location in the first field which should have context /<app-name>/rest/api-docs and should be something like http://<host>:<port>/<app-name>/rest/api-docs and Explore.
This customised Swagger UI has a username and a password field so it can access the REST API calls of Repox that have Basic Authentication using Spring security and configuration of the credentials can be configured in the module repox-server-rest-jersey inside the /WEB-INF/security.xml file.
Sample username = temporary
Sample password = temporary
Example of the homepage:
