skip to main content
Corticon Server: Integration & Deployment Guide : Corticon API reference : REST Management API : Using the REST API Swagger documentation
 

Try Corticon Now
Using the REST API Swagger documentation
Many of the execute and management REST API methods in a Corticon Server WAR file can be exposed in Swagger, the popular OpenAPI Specification tool for describing, producing, consuming, and visualizing RESTful Web services. Swagger is built-in to every Corticon Server WAR file.
You can use Swagger through BASIC authentication and HTTPS connections.
Note: Get more information about Swagger at swagger.io

Accessing Swagger on a Corticon Server for Java

To access Swagger and the exposed RESTful methods, enter the following URL into a browser on a machine where Corticon Server is installed and running:
http://localhost:port/context/swagger
where the URL for typical local installation using HTTP is:
http://localhost:8850/axis/swagger

Adjusting Swagger access for custom ports and contexts

If you want to specify a preferred port or a context other than axis, you need to adjust some Swagger configurations.
To use a different port, for example for secure HTTP on port 8851:
1. Edit the file:
[CORTICON_SERVER_WORK_DIR]\pas\server\webapps\axis\swagger\index.html
2. Edit the url line to:
url = "https://localhost:8851/axis/corticon/swagger.json";
To use a different context, for example Java_UAT:
1. Stop the server.
2. Edit the file:
[CORTICON_SERVER_WORK_DIR]\pas\server\webapps\axis\swagger\index.html
3. Edit the url line to:
url = "https://localhost:8851/Java_UAT/corticon/swagger.json";
4. Edit the file:
[CORTICON_SERVER_WORK_DIR]\pas\server\webapps\web.xml
5. Edit the swagger.api.basepath parameter value to:
<param-value>/Java_UAT/corticon</param-value>
6. Restart the server.

Disabling Swagger on a Server

To disable Swagger on a Server, edit its web.xml file to add comment markers as shown:
<servlet>
<servlet-name>Corticon REST Service</servlet-name>
<servlet-class>com.sun.jersey.spi.container.servlet.ServletContainer</servlet-class>
<init-param>
<param-name>javax.ws.rs.Application</param-name>
<param-value>com.corticon.eclipse.rest.CorticonRestApplication</param-value>
</init-param>
<!-- Swagger documentation for the REST APIs -->
<!-- disable Swagger
<init-param>
<param-name>com.sun.jersey.config.property.packages</param-name>
<param-value>io.swagger.jaxrs.json;com.corticon.eclipse.rest;
io.swagger.jaxrs.listing</param-value>
</init-param>
-->
<!-- End of Swagger documentation for the REST APIs -->
and

<!-- Swagger Rest API documentation -->
<!-- disable Swagger
<servlet>
<servlet-name>DefaultJaxrsConfig</servlet-name>
<servlet-class>io.swagger.jaxrs.config.DefaultJaxrsConfig</servlet-class>
<init-param>
<param-name>api.version</param-name>
<param-value>1.1.8</param-value>
</init-param>
<!-- Change this if you deployed you server in a different location -->
<init-param>
<param-name>swagger.api.basepath</param-name>
<param-value>/axis/corticon</param-value>
</init-param>
<load-on-startup>2</load-on-startup>
</servlet>
-->
When you restart the server, access to Swagger on the Server is disabled. Clear the comment delimiters to again enable Swagger on the server.